this requires a patch to uboot: - uboot thinks the drive has a capacity of 0 (i.e. 'unknown'). unclear precisely why. could be noncompliant drive firmware, or a timeout somewhere. and a patch to the rpi bootloader: - in order to trampoline into the rpi-4 uboot. and custom kernel modules in the initrd: - in order to detect the USB hub (rpi fw). additionally, i'm MANUALLY placing `bcm2711-rpi-400.dtb` into `/boot/nixos/..-linux-5.10.111-dtbs/broadcom`. i'll want to do this automatically over time. i hope to simplify much of this over time: this is just the first thing which works after a couple days of hacking at it.
39 lines
996 B
Bash
39 lines
996 B
Bash
#! @bash@/bin/sh -e
|
|
|
|
target=/boot # Target directory
|
|
|
|
while getopts "t:c:d:g:" opt; do
|
|
case "$opt" in
|
|
d) target="$OPTARG" ;;
|
|
*) ;;
|
|
esac
|
|
done
|
|
|
|
copyForced() {
|
|
local src="$1"
|
|
local dst="$2"
|
|
cp $src $dst.tmp
|
|
mv $dst.tmp $dst
|
|
}
|
|
|
|
# Call the extlinux builder
|
|
"@extlinuxConfBuilder@" "$@"
|
|
|
|
# Add the firmware files
|
|
fwdir=@firmware@/share/raspberrypi/boot/
|
|
copyForced $fwdir/bootcode.bin $target/bootcode.bin
|
|
copyForced $fwdir/fixup.dat $target/fixup.dat
|
|
copyForced $fwdir/fixup_cd.dat $target/fixup_cd.dat
|
|
copyForced $fwdir/fixup_db.dat $target/fixup_db.dat
|
|
copyForced $fwdir/fixup_x.dat $target/fixup_x.dat
|
|
copyForced $fwdir/start.elf $target/start.elf
|
|
copyForced $fwdir/start_cd.elf $target/start_cd.elf
|
|
copyForced $fwdir/start_db.elf $target/start_db.elf
|
|
copyForced $fwdir/start_x.elf $target/start_x.elf
|
|
|
|
# Add the uboot file
|
|
copyForced @uboot@/u-boot.bin $target/u-boot-rpi.bin
|
|
|
|
# Add the config.txt
|
|
copyForced @configTxt@ $target/config.txt
|