Add support for Raspberry Pi 4

This commit is contained in:
Trevor 2019-07-22 18:14:34 +02:00 committed by parazyd
parent 6e12a67906
commit 569343502e
10 changed files with 266 additions and 0 deletions

View File

@ -74,6 +74,7 @@ Now is the time you choose the device and OS you want to build the image for.
* `raspi1` - Raspberry Pi 1 and 0 (armel)
* `raspi2` - Raspberry Pi 2 and 3
* `raspi3` - Raspberry Pi 3 (64bit)
* `raspi4` - Raspberry Pi 4 (64bit)
* `rock64` - Rock64 (64bit) (EXPERIMENTAL)
* `sunxi` - Allwinner-based boards

111
boards/raspberry-pi4.sh Normal file
View File

@ -0,0 +1,111 @@
#!/usr/bin/env zsh
# Copyright (c) 2016-2018 Dyne.org Foundation
# arm-sdk is written and maintained by Ivan J. <parazyd@dyne.org>
#
# This file is part of arm-sdk
#
# This source code is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this source code. If not, see <http://www.gnu.org/licenses/>.
## kernel build script for Raspberry Pi 4 boards
## settings & config
vars+=(device_name arch size parted_type parted_boot parted_root bootfs inittab)
vars+=(gitkernel gitbranch rpifirmware)
arrs+=(custmodules)
device_name="raspi4"
arch="arm64"
size=1891
inittab=("T0:23:respawn:/sbin/agetty -L ttyAMA0 115200 vt100")
parted_type="dos"
parted_boot="fat32 2048s 264191s"
parted_root="ext4 264192s 100%"
bootfs="vfat"
extra_packages+=()
custmodules=(snd_bcm2835)
gitkernel="https://github.com/raspberrypi/linux"
gitbranch="rpi-4.19.y"
rpifirmware="https://github.com/raspberrypi/firmware.git"
prebuild() {
fn prebuild
req=(device_name strapdir)
ckreq || return 1
notice "executing $device_name prebuild"
mkdir -p $R/tmp/kernels/$device_name
}
postbuild() {
fn postbuild
notice "executing $device_name postbuild"
copy-root-overlay
postbuild-clean
}
build_kernel_arm64() {
fn build_kernel_armhf
req=(R arch device_name gitkernel gitbranch rpifirmware)
req+=(strapdir)
ckreq || return 1
notice "building $arch kernel"
prebuild || zerr
get-kernel-sources || zerr
pushd $R/tmp/kernels/$device_name/${device_name}-linux
# pi4 defconfig
make \
$MAKEOPTS \
ARCH=arm64 \
CROSS_COMPILE=$compiler \
bcm2711_defconfig || zerr
# compile kernel and modules
make \
$MAKEOPTS \
ARCH=arm64 \
CROSS_COMPILE=$compiler || zerr
# install kernel modules
sudo -E PATH="$PATH" \
make \
$MAKEOPTS \
ARCH=arm64 \
CROSS_COMPILE=$compiler \
INSTALL_MOD_PATH=$strapdir \
modules_install || zerr
popd
clone-git "$rpifirmware" "$R/tmp/kernels/$device_name/${device_name}-firmware"
sudo cp -rf $R/tmp/kernels/$device_name/${device_name}-firmware/boot/* $strapdir/boot/
pushd $R/tmp/kernels/$device_name/${device_name}-linux
# sudo perl scripts/mkknlimg --dtok arch/arm64/boot/Image.gz $strapdir/boot/kernel8.img
sudo cp arch/arm64/boot/Image $strapdir/boot/kernel8.img
sudo cp arch/arm64/boot/dts/broadcom/bcm*.dtb $strapdir/boot/
sudo cp arch/arm64/boot/dts/overlays/*.dtbo $strapdir/boot/overlays/
sudo cp arch/arm64/boot/dts/overlays/README $strapdir/boot/overlays/
popd
postbuild || zerr
}

View File

@ -0,0 +1 @@
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait mem=1G

View File

@ -0,0 +1,20 @@
## always audio
dtparam=audio=on
## maximum amps on usb ports
max_usb_current=1
[pi4]
## Enable DRM VC4 V3D driver on top of the dispmanx display stack
#dtoverlay=vc4-fkms-v3d
#max_framebuffers=2
arm_64bit=1
# enable 64-bit kernel; issue 3032
#kernel=kernel8.img
#device_tree=bcm2711-rpi-4-b.dtb
total_mem=1024
enable_gic=1
#armstub=armstub8-gic.bin
## memory shared with the GPU
gpu_mem=128

View File

@ -0,0 +1,29 @@
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
# source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
#auto eth1
#iface eth1 inet dhcp
# auto eth0
# iface eth0 inet static
# address 10.0.1.10
# netmask 255.255.255.0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
# allow-hotplug wlan1
# iface wlan1 inet dhcp
# wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

View File

@ -0,0 +1,6 @@
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="Your Network"
psk="Your Password"
}

Binary file not shown.

View File

@ -0,0 +1,97 @@
# Cloned from bcm94345wlpagb_p2xx.txt
NVRAMRev=$Rev: 498373 $
sromrev=11
vendid=0x14e4
devid=0x43ab
manfid=0x2d0
prodid=0x06e4
#macaddr=00:90:4c:c5:12:38
macaddr=b8:27:eb:74:f2:6c
nocrc=1
boardtype=0x6e4
boardrev=0x1304
#XTAL 37.4MHz
xtalfreq=37400
btc_mode=1
#------------------------------------------------------
#boardflags: 5GHz eTR switch by default
# 2.4GHz eTR switch by default
# bit1 for btcoex
boardflags=0x00480201
boardflags2=0x40800000
boardflags3=0x44200100
phycal_tempdelta=15
rxchain=1
txchain=1
aa2g=1
aa5g=1
tssipos5g=1
tssipos2g=1
femctrl=0
AvVmid_c0=1,165,2,100,2,100,2,100,2,100
pa2ga0=-129,6525,-718
pa2ga1=-149,4408,-601
pa5ga0=-185,6836,-815,-186,6838,-815,-184,6859,-815,-184,6882,-818
pa5ga1=-202,4285,-574,-201,4312,-578,-196,4391,-586,-201,4294,-575
itrsw=1
pdoffsetcckma0=2
pdoffset2gperchan=0,-2,1,0,1,0,1,1,1,0,0,-1,-1,0
pdoffset2g40ma0=16
pdoffset40ma0=0x8888
pdoffset80ma0=0x8888
extpagain5g=2
extpagain2g=2
tworangetssi2g=1
tworangetssi5g=1
# LTECX flags
# WCI2
ltecxmux=0
ltecxpadnum=0x0504
ltecxfnsel=0x22
ltecxgcigpio=0x32
maxp2ga0=80
ofdmlrbw202gpo=0x0022
dot11agofdmhrbw202gpo=0x4442
mcsbw202gpo=0x98444422
mcsbw402gpo=0x98444422
maxp5ga0=82,82,82,82
mcsbw205glpo=0xb9555000
mcsbw205gmpo=0xb9555000
mcsbw205ghpo=0xb9555000
mcsbw405glpo=0xb9555000
mcsbw405gmpo=0xb9555000
mcsbw405ghpo=0xb9555000
mcsbw805glpo=0xb9555000
mcsbw805gmpo=0xb9555000
mcsbw805ghpo=0xb9555000
swctrlmap_2g=0x00000000,0x00000000,0x00000000,0x010000,0x3ff
swctrlmap_5g=0x00100010,0x00200020,0x00200020,0x010000,0x3fe
swctrlmapext_5g=0x00000000,0x00000000,0x00000000,0x000000,0x3
swctrlmapext_2g=0x00000000,0x00000000,0x00000000,0x000000,0x3
vcodivmode=1
deadman_to=481500000
ed_thresh2g=-54
ed_thresh5g=-54
eu_edthresh2g=-54
eu_edthresh5g=-54
ldo1=4
rawtempsense=0x1ff
cckPwrIdxCorr=3
cckTssiDelay=150
ofdmTssiDelay=150
txpwr2gAdcScale=1
txpwr5gAdcScale=1
dot11b_opts=0x3aa85
cbfilttype=1
fdsslevel_ch11=6
# Improved Bluetooth coexistence parameters from Cypress
btc_mode=1
btc_params8=0x4e20
btc_params1=0x7530

1
sdk
View File

@ -78,6 +78,7 @@ load() {
"raspi1" "$R/boards/raspberry-pi1.sh"
"raspi2" "$R/boards/raspberry-pi2.sh"
"raspi3" "$R/boards/raspberry-pi3.sh"
"raspi4" "$R/boards/raspberry-pi4.sh"
"rock64" "$R/boards/rock64.sh"
"pinephone-dontbeevil" "$R/boards/pinephone-dontbeevil.sh"
"sunxi" "$R/boards/sunxi.sh"