From 1cba9353e401e074f57b9e8e929f49e77f28a039 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Tue, 5 Jan 2021 02:06:00 +0100 Subject: [PATCH] rootfsinstall: new -rpi64 platform for aarch64 raspberry pi support --- src/rootfsinstall.sh | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/src/rootfsinstall.sh b/src/rootfsinstall.sh index 455b0c8..72547d7 100755 --- a/src/rootfsinstall.sh +++ b/src/rootfsinstall.sh @@ -12,13 +12,14 @@ TARGET_ARCH=arm VOLUME_LABEL="openmamba" function usage() { - echo "Usage: $0 device rootfs-archive [-bpi|-cubox|-rpi] [-a archive] [-c command] [-fs fstype] [-k kernel] [-p password] [-y]" + echo "Usage: $0 device rootfs-archive [-bpi|-cubox|-rpi|-rpi64] [-a archive] [-c command] [-fs fstype] [-k kernel] [-p password] [-y]" echo echo "Target platform (optional):" echo "-baytrail : make a BayTrail image with boot partition" echo "-bpi : make a BananaPi image with boot partition" echo "-cubox : make a Cubox image with boot partition" - echo "-rpi : make a RaspberryPi image with boot partition" + echo "-rpi : make a RaspberryPi (arm) image with boot partition" + echo "-rpi64 : make a RaspberryPi (aarch64) image with boot partition" echo echo "Options:" echo "-a archive : additional archive to unpack in rootfs root (may be specified multiple times)" @@ -56,6 +57,7 @@ while [ "$1" ]; do -cubox) TARGETDEVICE=cubox ;; -bpi) TARGETDEVICE=bpi ;; -rpi) TARGETDEVICE=rpi ;; + -rpi64) TARGETDEVICE=rpi64; TARGET_ARCH=aarch64 ;; -fs) [ "$2" ] || { echo "Error: -fs option requires an argument; aborting." exit 1 @@ -224,6 +226,17 @@ raspberrypi-utils xf86-video-fbturbo $INSTALLPACKAGES" FSTAB_ROOT_DEVICE="/dev/mmcblk0p2" FSTAB_BOOT_DEVICE="/dev/mmcblk0p1" ;; + rpi64) ARCH=aarch64 + BOOTFSTYPE=fat32 + BOOTFSSIZE=100M + BOOTFSSTART=0 + KERNELDEST="@BOOT@/kernel8.img" + INSTALLPACKAGES="\ +kernel-rpi-v8 raspberrypi-utils xf86-video-fbturbo $INSTALLPACKAGES" + REMOVEPACKAGES="kernel-mamba-aarch64" + FSTAB_ROOT_DEVICE="/dev/mmcblk0p2" + FSTAB_BOOT_DEVICE="/dev/mmcblk0p1" + ;; cubox) ARCH=arm BOOTFSTYPE=ext3 BOOTFSSIZE=20M @@ -254,7 +267,7 @@ else fi echo "Target SD card : ${DRIVE}" -[ "$TARGETDEVICE" ] && echo "Target platform: $TARGETDEVICE" +[ "$TARGETDEVICE" ] && echo "Target platform: $TARGETDEVICE ($TARGET_ARCH)" if [ ! "${IMAGEMODE}" ]; then [ "$BOOTFSTYPE" ] && echo "Boot fs : $BOOTFSTYPE($BOOTFSSIZE)" [ "$BOOTFSTYPE" ] && echo "System fs : $SYSTEMFSTYPE" @@ -381,7 +394,7 @@ trap "[ "$BOOTMP" -a -e $BOOTMP ] && umount $BOOTMP;[ "$ROOTMP" -a -e $ROOTMP ] if [ ! "${IMAGEMODE}" ]; then echo "Uncompressing $ROOTFSARCHIVE..." echo -n "This can take a while, please wait..." - tar xf $ROOTFSARCHIVE || { + tar xf $ROOTFSARCHIVE --exclude=vexpress-v2m-rs1.dtsi || { echo echo "ERROR: unable to uncompress rootfs archive; aborting." exit 1 @@ -420,7 +433,7 @@ if [ "${SAVE_ROOT_PARTUUID}" -a "${GROWIMAGE}" ]; then NEW_ROOT_PARTUUID=`blkid -s PARTUUID -o value ${PARTITION2}` sed -i "s|PARTUUID=${SAVE_ROOT_PARTUUID}|PARTUUID=${NEW_ROOT_PARTUUID}|" ${ROOTMP}/etc/fstab sed -i "s|PARTUUID=${SAVE_BOOT_PARTUUID}|PARTUUID=${NEW_BOOT_PARTUUID}|" ${ROOTMP}/etc/fstab - if [ "$TARGETDEVICE" = "rpi" ]; then + if [ "$TARGETDEVICE" = "rpi" -o "$TARGETDEVICE" = "rpi64" ]; then sed -i "s|PARTUUID=${SAVE_ROOT_PARTUUID}|PARTUUID=${NEW_ROOT_PARTUUID}|" ${BOOTMP}/cmdline.txt fi fi @@ -549,7 +562,7 @@ uenvcmd=run aload_script aload_kernel _EOF dd if=$ROOTMP/boot/Bananapi/u-boot-sunxi-with-spl.bin of=${DRIVE} bs=1024 seek=8 : -elif [ "$TARGETDEVICE" = "rpi" ]; then +elif [ "$TARGETDEVICE" = "rpi" -o "$TARGETDEVICE" = "rpi64" ]; then [ "$USEKERNEL" ] && cp $ROOTMP/boot/$USEKERNEL $KERNELDEST [ "$USEKERNEL2" ] && cp $ROOTMP/boot/$USEKERNEL2 $KERNELDEST2 [ "$USEKERNEL3" ] && cp $ROOTMP/boot/$USEKERNEL3 $KERNELDEST3 @@ -557,7 +570,7 @@ elif [ "$TARGETDEVICE" = "rpi" ]; then [ -e /usr/libexec/init_resize ] && cp /usr/libexec/init_resize ${ROOTMP}/usr/libexec/ [ -e ${ROOTMP}/usr/libexec/init_resize ] && CMDLINE_ADD=" init=/usr/libexec/init_resize" - chroot $ROOTMP depmod -ae + #chroot $ROOTMP depmod -ae # cmdline.txt : parameters passed to the kernel on boot echo "\ @@ -583,9 +596,11 @@ gpu_mem=128 start_x=1 framebuffer_depth=32 framebuffer_ignore_alpha=1 -dtparam=audio=on -" > $BOOTMP/config.txt +dtparam=audio=on" > $BOOTMP/config.txt + if [ "$TARGETDEVICE" = "rpi64" ]; then + echo "arm_64bit=1" >> $BOOTMP/config.txt + fi ## Enable HDMI mode rather than DVI, if required #echo "\ #hdmi_drive=2" >> $BOOTMP/config.txt