From 904400d19de26bd51183e63e1da06e4ea6406832 Mon Sep 17 00:00:00 2001 From: sthen Date: Sat, 17 Apr 2021 21:19:40 +0000 Subject: [PATCH] Embiggen arm64 ramdisk kernel and miniroot/install img files. Provide U-Boot binaries that work on Raspberry Pi 3 and 4 (and possibly others) and firmware for Raspberry Pi 4. This allows the same installation method as used on Raspberry Pi 3 without separate UEFI firmware (although UEFI can still be used). Help from kettenis@ jsg@ deraadt@ --- distrib/arm64/iso/Makefile | 15 +++++++++++---- distrib/arm64/ramdisk/Makefile | 20 +++++++++++++------- distrib/arm64/ramdisk/install.md | 4 ++-- distrib/arm64/ramdisk/list | 10 ++++++++-- etc/etc.arm64/disktab | 8 ++++---- sys/arch/arm64/conf/RAMDISK | 4 ++-- 6 files changed, 40 insertions(+), 21 deletions(-) diff --git a/distrib/arm64/iso/Makefile b/distrib/arm64/iso/Makefile index 3d5ba184e76..68c30398cea 100644 --- a/distrib/arm64/iso/Makefile +++ b/distrib/arm64/iso/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.1 2021/04/10 21:02:36 deraadt Exp $ +# $OpenBSD: Makefile,v 1.2 2021/04/17 21:19:41 sthen Exp $ FS= install${OSrev}.img FSSIZE= 1032192 @@ -16,8 +16,9 @@ BASE= ${RELDIR}/base${OSrev}.tgz ${RELDIR}/comp${OSrev}.tgz \ XBASE= ${RELXDIR}/xbase${OSrev}.tgz ${RELXDIR}/xfont${OSrev}.tgz \ ${RELXDIR}/xshare${OSrev}.tgz ${RELXDIR}/xserv${OSrev}.tgz +# this offset is required by Rockchip MSDOSSTART= 32768 -MSDOSSIZE= 8192 +MSDOSSIZE= 16384 FFSSTART!= expr ${MSDOSSTART} + ${MSDOSSIZE} NEWFS_ARGS_msdos=-L boot -c1 -F16 @@ -30,10 +31,16 @@ PRPI= /usr/local/share/raspberrypi-firmware/boot PIFILES=\ bootcode.bin \ start.elf \ + start4.elf \ fixup.dat \ + fixup4.dat \ + bcm2710-rpi-2-b.dtb \ bcm2710-rpi-3-b.dtb \ bcm2710-rpi-3-b-plus.dtb \ - bcm2710-rpi-cm3.dtb + bcm2710-rpi-cm3.dtb \ + bcm2711-rpi-4-b.dtb \ + bcm2711-rpi-400.dtb \ + bcm2711-rpi-cm4.dtb PIDTBO=\ disable-bt.dtbo @@ -55,7 +62,7 @@ ${FS}: ${BASE} ${XBASE} .for FILE in ${PIDTBO} cp ${PRPI}/overlays/${FILE} ${MOUNT_POINT}/overlays/ .endfor - cp ${PUBOOT}/rpi_3/u-boot.bin ${MOUNT_POINT}/ + cp ${PUBOOT}/rpi_arm64/u-boot.bin ${MOUNT_POINT}/u-boot.bin mkdir -p ${MOUNT_POINT}/efi/boot cp /usr/mdec/BOOTAA64.EFI ${MOUNT_POINT}/efi/boot/bootaa64.efi echo bootaa64.efi > ${MOUNT_POINT}/efi/boot/startup.nsh diff --git a/distrib/arm64/ramdisk/Makefile b/distrib/arm64/ramdisk/Makefile index 7d398fdb3eb..a8484267eec 100644 --- a/distrib/arm64/ramdisk/Makefile +++ b/distrib/arm64/ramdisk/Makefile @@ -1,14 +1,14 @@ -# $OpenBSD: Makefile,v 1.21 2021/02/15 07:06:03 semarie Exp $ +# $OpenBSD: Makefile,v 1.22 2021/04/17 21:19:40 sthen Exp $ FS= miniroot${OSrev}.img -FSSIZE= 67584 -FSDISKTYPE= miniroot +FSSIZE= 88064 MOUNT_POINT= /mnt MTREE= ${UTILS}/mtree.conf RAMDISK= RAMDISK +# this offset is required by Rockchip MSDOSSTART= 32768 -MSDOSSIZE= 8192 +MSDOSSIZE= 16384 FFSSTART!= expr ${MSDOSSTART} + ${MSDOSSIZE} NEWFS_ARGS_msdos=-L boot -c1 -F16 @@ -27,10 +27,16 @@ MRMAKEFSARGS= -o disklabel=${MRFSDISKTYPE},minfree=0,density=4096 PIFILES=\ bootcode.bin \ start.elf \ + start4.elf \ fixup.dat \ + fixup4.dat \ + bcm2710-rpi-2-b.dtb \ bcm2710-rpi-3-b.dtb \ bcm2710-rpi-3-b-plus.dtb \ - bcm2710-rpi-cm3.dtb + bcm2710-rpi-cm3.dtb \ + bcm2711-rpi-4-b.dtb \ + bcm2711-rpi-400.dtb \ + bcm2711-rpi-cm4.dtb PIDTBO=\ disable-bt.dtbo @@ -39,7 +45,7 @@ all: ${FS} ${FS}: bsd.rd dd if=/dev/zero of=${FS} bs=512 count=${FSSIZE} - vnconfig -v -t ${FSDISKTYPE} ${FS} > vnd + vnconfig -v ${FS} > vnd echo 'u\ne 0\nc\nn\n${MSDOSSTART}\n${MSDOSSIZE}\ne 3\nA6\nn\n${FFSSTART}\n*\nf 0\nw\nq\n' \ | fdisk -e `cat vnd` >/dev/null echo 'a a\n\n\n\nw\nq\n' | disklabel -E `cat vnd` >/dev/null @@ -52,7 +58,7 @@ ${FS}: bsd.rd .for FILE in ${PIDTBO} cp ${PRPI}/overlays/${FILE} ${MOUNT_POINT}/overlays/ .endfor - cp ${PUBOOT}/rpi_3/u-boot.bin ${MOUNT_POINT}/ + cp ${PUBOOT}/rpi_arm64/u-boot.bin ${MOUNT_POINT}/u-boot.bin mkdir -p ${MOUNT_POINT}/efi/boot cp /usr/mdec/BOOTAA64.EFI ${MOUNT_POINT}/efi/boot/bootaa64.efi echo bootaa64.efi > ${MOUNT_POINT}/efi/boot/startup.nsh diff --git a/distrib/arm64/ramdisk/install.md b/distrib/arm64/ramdisk/install.md index fe97db3b9e7..f522afcf152 100644 --- a/distrib/arm64/ramdisk/install.md +++ b/distrib/arm64/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.14 2019/11/17 06:03:39 jsg Exp $ +# $OpenBSD: install.md,v 1.15 2021/04/17 21:19:40 sthen Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -58,7 +58,7 @@ md_installboot() { bs=1024 seek=8 >/dev/null 2>&1 ;; rpi) - cp $_mdec/{bootcode.bin,start.elf,fixup.dat,*.dtb} /mnt/mnt/ + cp $_mdec/{bootcode.bin,start*.elf,fixup*.dat,*.dtb} /mnt/mnt/ cp $_mdec/u-boot.bin /mnt/mnt/ mkdir -p /mnt/mnt/overlays cp $_mdec/disable-bt.dtbo /mnt/mnt/overlays diff --git a/distrib/arm64/ramdisk/list b/distrib/arm64/ramdisk/list index b8493098a8a..f6b1356c01c 100644 --- a/distrib/arm64/ramdisk/list +++ b/distrib/arm64/ramdisk/list @@ -1,4 +1,4 @@ -# $OpenBSD: list,v 1.13 2021/02/15 07:06:03 semarie Exp $ +# $OpenBSD: list,v 1.14 2021/04/17 21:19:40 sthen Exp $ SRCDIRS distrib/special @@ -92,14 +92,20 @@ COPY ${DESTDIR}/etc/firmware/atu-rfmd2958smc-ext etc/firmware/atu-rfmd2958smc-ex COPY ${DESTDIR}/etc/firmware/atu-rfmd2958smc-int etc/firmware/atu-rfmd2958smc-int MKDIR usr/mdec/rpi +COPY /usr/local/share/raspberrypi-firmware/boot/bcm2710-rpi-2-b.dtb usr/mdec/rpi/bcm2710-rpi-2-b.dtb COPY /usr/local/share/raspberrypi-firmware/boot/bcm2710-rpi-3-b.dtb usr/mdec/rpi/bcm2710-rpi-3-b.dtb COPY /usr/local/share/raspberrypi-firmware/boot/bcm2710-rpi-3-b-plus.dtb usr/mdec/rpi/bcm2710-rpi-3-b-plus.dtb COPY /usr/local/share/raspberrypi-firmware/boot/bcm2710-rpi-cm3.dtb usr/mdec/rpi/bcm2710-rpi-cm3.dtb +COPY /usr/local/share/raspberrypi-firmware/boot/bcm2711-rpi-4-b.dtb usr/mdec/rpi/bcm2711-rpi-4-b.dtb +COPY /usr/local/share/raspberrypi-firmware/boot/bcm2711-rpi-400.dtb usr/mdec/rpi/bcm2711-rpi-400.dtb +COPY /usr/local/share/raspberrypi-firmware/boot/bcm2711-rpi-cm4.dtb usr/mdec/rpi/bcm2711-rpi-cm4.dtb COPY /usr/local/share/raspberrypi-firmware/boot/bootcode.bin usr/mdec/rpi/bootcode.bin COPY /usr/local/share/raspberrypi-firmware/boot/start.elf usr/mdec/rpi/start.elf +COPY /usr/local/share/raspberrypi-firmware/boot/start4.elf usr/mdec/rpi/start4.elf COPY /usr/local/share/raspberrypi-firmware/boot/fixup.dat usr/mdec/rpi/fixup.dat +COPY /usr/local/share/raspberrypi-firmware/boot/fixup4.dat usr/mdec/rpi/fixup4.dat COPY /usr/local/share/raspberrypi-firmware/boot/overlays/disable-bt.dtbo usr/mdec/rpi/disable-bt.dtbo -COPY /usr/local/share/u-boot/rpi_3/u-boot.bin usr/mdec/rpi/u-boot.bin +COPY /usr/local/share/u-boot/rpi_arm64/u-boot.bin usr/mdec/rpi/u-boot.bin MKDIR usr/mdec/pine64 COPY /usr/local/share/u-boot/pine64_plus/u-boot-sunxi-with-spl.bin usr/mdec/pine64/u-boot-sunxi-with-spl.bin diff --git a/etc/etc.arm64/disktab b/etc/etc.arm64/disktab index 79f8c3ea378..87ee80c8281 100644 --- a/etc/etc.arm64/disktab +++ b/etc/etc.arm64/disktab @@ -1,10 +1,10 @@ -# $OpenBSD: disktab,v 1.3 2019/06/28 13:28:21 deraadt Exp $ +# $OpenBSD: disktab,v 1.4 2021/04/17 21:19:40 sthen Exp $ # Leave nc=16; adjust size using: ns rdroot|ramdiskroot|RAM-disk root FS image:\ - :dt=rdroot:se#512:nc#16:nt#2:ns#512:\ - :ta=4.2BSD:oa#0:pa#16384:fa#512:ba#4096:\ - :ob#0:pb#0:oc#0:pc#16384: + :dt=rdroot:se#512:nc#16:nt#2:ns#768:\ + :ta=4.2BSD:oa#0:pa#24576:fa#512:ba#4096:\ + :ob#0:pb#0:oc#0:pc#24576: miniroot:\ :dt=rdroot:se#512:nc#33:nt#16:ns#128:\ diff --git a/sys/arch/arm64/conf/RAMDISK b/sys/arch/arm64/conf/RAMDISK index 361f9bf3e32..3d6381b2ac5 100644 --- a/sys/arch/arm64/conf/RAMDISK +++ b/sys/arch/arm64/conf/RAMDISK @@ -1,4 +1,4 @@ -# $OpenBSD: RAMDISK,v 1.146 2021/03/08 20:56:10 patrick Exp $ +# $OpenBSD: RAMDISK,v 1.147 2021/04/17 21:19:40 sthen Exp $ # # GENERIC machine description file # @@ -28,7 +28,7 @@ option NO_PROPOLICE option BOOT_CONFIG option RAMDISK_HOOKS -option MINIROOTSIZE=16384 +option MINIROOTSIZE=24576 option FFS option FFS2 -- 2.20.1