From c339692e33125d895b00644c82fa0a31e5d320f1 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Fri, 31 Jan 2020 23:29:56 +0100 Subject: [PATCH] rootfsinstall.sh: rpi4 support --- src/rootfsinstall.sh | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/rootfsinstall.sh b/src/rootfsinstall.sh index c2a8211..69ab58a 100755 --- a/src/rootfsinstall.sh +++ b/src/rootfsinstall.sh @@ -29,7 +29,7 @@ function usage() { echo "-g [size] : grow system partition to fit storage size (to be used with -I)" echo "-h hostname : set given hostname" echo "-k kernel : extract and use specified kernel file from ROOTFS/boot/ for boot" - echo "-k2 kernel : extract and use specified second kernel file from ROOTFS/boot/ for boot" + echo "-k[2,3] kernel: extract and use specified second/third kernel file from ROOTFS/boot/ for boot" echo "-i packages : install packages using package manager in chroot" echo "-I : treat input as an image file" echo "-l : force local installation only; don't perform installation from network" @@ -103,6 +103,13 @@ while [ "$1" ]; do USEKERNEL2=$2 shift ;; + -k3) [ "$2" ] || { + echo "Error: -k3 option requires a kernel file name as argument; aborting." + exit 1 + } + USEKERNEL3=$2 + shift + ;; -g) GROWIMAGE=1 if [ "${2:0:1}" != "-" ]; then GROWIMAGESIZE=$2 @@ -205,14 +212,23 @@ case $TARGETDEVICE in BOOTFSSTART=0 [ "$USEKERNEL" ] || USEKERNEL="zImage-*-rpi" [ "$USEKERNEL2" ] || USEKERNEL2="zImage-*-rpi-v7" + [ "$USEKERNEL3" ] || USEKERNEL3="zImage-*-rpi-v7l" KERNELDEST="@BOOT@/kernel.img" KERNELDEST2="@BOOT@/kernel7.img" + KERNELDEST3="@BOOT@/kernel7l.img" INSTALLPACKAGES="kernel-rpi kernel-rpi-modules raspberrypi-firmware \ kernel-rpi-v7 kernel-rpi-v7-modules \ +kernel-rpi-v7l kernel-rpi-v7l-modules \ raspberrypi-utils raspi-config $INSTALLPACKAGES" REMOVEPACKAGES="kernel-mamba-arm" - RPI_FIRMWARE_FILES="bootcode.bin fixup_x.dat start_x.elf \ -bcm2708-rpi-b-plus.dtb bcm2708-rpi-b.dtb bcm2708-rpi-cm.dtb bcm2709-rpi-2-b.dtb bcm2710-rpi-3-b.dtb \ + RPI_FIRMWARE_FILES="bootcode.bin \ +fixup_x.dat start_x.elf \ +fixup4x.dat start4x.elf \ +bcm2708-rpi-b-plus.dtb bcm2708-rpi-b.dtb bcm2708-rpi-cm.dtb \ +bcm2708-rpi-zero-w.dtb bcm2708-rpi-zero.dtb \ +bcm2709-rpi-2-b.dtb bcm2710-rpi-2-b.dtb \ +bcm2710-rpi-3-b-plus.dtb bcm2710-rpi-3-b.dtb \ +bcm2710-rpi-cm3.dtb bcm2711-rpi-4-b.dtb \ cmdline.txt config.txt" FSTAB_ROOT_DEVICE="/dev/mmcblk0p2" ;; @@ -252,6 +268,7 @@ if [ ! "${IMAGEMODE}" ]; then [ "$BOOTFSTYPE" ] && echo "System fs : $SYSTEMFSTYPE" [ "$USEKERNEL" ] && echo "Kernel : $USEKERNEL -> $KERNELDEST" [ "$USEKERNEL2" ] && echo "Second kernel : $USEKERNEL2 -> $KERNELDEST2" + [ "$USEKERNEL3" ] && echo "Third kernel : $USEKERNEL3 -> $KERNELDEST3" fi echo @@ -431,6 +448,10 @@ if [ "$INSTALLPACKAGES" -a "$LOCALONLY" != "1" -a ! "${IMAGEMODE}" ]; then cp /etc/resolv.conf $ROOTMP/etc/resolv.conf chroot $ROOTMP bash -c /etc/profile.d/gpg-key-openmamba.sh #chroot $ROOTMP smart channel --enable devel-kernel + chroot $ROOTMP rpm --rebuilddb || { + echo "ERROR: error running chroot command 'rpm --rebuilddb'; aborting." + exit 1 + } chroot $ROOTMP dnf update -y || { echo "ERROR: error running chroot command 'dnf update -y'; aborting." exit 1 @@ -449,6 +470,7 @@ fi KERNELDEST=`echo $KERNELDEST | sed "s|@BOOT@|$BOOTMP|g"` KERNELDEST2=`echo $KERNELDEST2 | sed "s|@BOOT@|$BOOTMP|g"` +KERNELDEST3=`echo $KERNELDEST3 | sed "s|@BOOT@|$BOOTMP|g"` # # Prepare boot partition @@ -547,6 +569,7 @@ elif [ "$TARGETDEVICE" = "rpi" ]; then # IMAGE=`ls $ROOTMP/boot/$USEKERNEL | head -n 1` cp $ROOTMP/boot/$USEKERNEL $KERNELDEST cp $ROOTMP/boot/$USEKERNEL2 $KERNELDEST2 + cp $ROOTMP/boot/$USEKERNEL3 $KERNELDEST3 # cmdline.txt : parameters passed to the kernel on boot [ ! -e $ROOTMP/boot/cmdline.txt ] && \