fix: ship Pi images with MontaukOS UEFI boot entry
This commit is contained in:
1 parent
be84506fdf
commit
8b4a938164
4 files changed
+147
-3
No files matched your search
+20
-3
@@ -33,6 +33,13 @@
|
||||
# the image with e.g.
|
||||
# sudo dd if=montauk-rpi4.img of=/dev/sdX bs=4M conv=fsync
|
||||
#
|
||||
# Boot order: the firmware's RPI_EFI.fd ships with an empty variable store,
|
||||
# which scripts/rpi4-efi-bootorder.py seeds with a "MontaukOS" Boot0000 first
|
||||
# in BootOrder, naming the ESP by this image's (random) MBR disk ID and
|
||||
# partition number. The card then boots without a trip to the boot menu,
|
||||
# ahead of the PXE/HTTP entries the firmware adds on its own, from the SD
|
||||
# slot or a USB drive alike.
|
||||
#
|
||||
# Firmware settings (UEFI setup, Esc at boot) MontaukOS relies on are the
|
||||
# defaults: System Table Mode "ACPI" and "Limit RAM to 3 GB" enabled (the
|
||||
# BCM2711's PCIe can only DMA below 3 GB, see the _DMA objects in its ACPI
|
||||
@@ -150,13 +157,19 @@ if [ "$ROOTFS" = ext2 ]; then
|
||||
-d "$WORK/root" "$WORK/root.ext2" "${root_mib}M"
|
||||
fi
|
||||
|
||||
# The MBR disk ID the firmware's boot entry names the ESP by.
|
||||
DISK_ID=0
|
||||
while [ $((DISK_ID)) -eq 0 ]; do
|
||||
DISK_ID="0x$(od -An -N4 -tx4 /dev/urandom | tr -d ' ')"
|
||||
done
|
||||
|
||||
rm -f "$OUTPUT"
|
||||
dd if=/dev/zero of="$OUTPUT" bs=1M count=0 seek=$((1 + esp_mib + root_mib)) status=none
|
||||
if [ "$ROOTFS" = ext2 ]; then
|
||||
printf 'label: dos\nstart=2048, size=%dMiB, type=ef\nstart=%dMiB, type=83\n' \
|
||||
"$esp_mib" "$((1 + esp_mib))"
|
||||
printf 'label: dos\nlabel-id: %s\nstart=2048, size=%dMiB, type=ef\nstart=%dMiB, type=83\n' \
|
||||
"$DISK_ID" "$esp_mib" "$((1 + esp_mib))"
|
||||
else
|
||||
printf 'label: dos\nstart=2048, type=ef\n'
|
||||
printf 'label: dos\nlabel-id: %s\nstart=2048, type=ef\n' "$DISK_ID"
|
||||
fi | PATH=$PATH:/usr/sbin:/sbin sfdisk --quiet "$OUTPUT"
|
||||
|
||||
# The ESP is built as its own file: mtools sizes a filesystem at an @@offset
|
||||
@@ -174,6 +187,10 @@ mformat -i "$IMG" -F -v MONTAUK ::
|
||||
for f in "$FW_DIR"/*; do
|
||||
case "$(basename "$f")" in
|
||||
Readme.md) ;;
|
||||
RPI_EFI.fd)
|
||||
python3 -I "$ROOT/scripts/rpi4-efi-bootorder.py" "$f" "$WORK/RPI_EFI.fd" \
|
||||
"$DISK_ID" 1 2048 $((esp_mib * 2048))
|
||||
mcopy -i "$IMG" "$WORK/RPI_EFI.fd" :: ;;
|
||||
config.txt)
|
||||
{ cat "$f"; printf '\ncore_freq=500\ncore_freq_min=500\n'; } > "$WORK/config.txt"
|
||||
mcopy -i "$IMG" "$WORK/config.txt" :: ;;
|
||||
|
||||
Reference in new issue
Block a user