rootfsinstall.sh: rpi4 support

This commit is contained in:
Silvan Calarco 2020-01-31 23:29:56 +01:00
parent 8aa3a84a62
commit c339692e33

View File

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