First working revision

At this point, we can generate an SD card image that is composed of an
EFI system partition, a SquashFS root partition (a), a blank root
partition (b), and a data partition.  On the EFI system partition are
the Raspberry Pi firmware and device trees, U-Boot and GRUB.  The
SquashFS filesystem contains the kernel and the whole filesystem tree.

A Raspberry Pi can successfully boot from an SD card containing this
image.  It's not quite usable yet, because there's no writable storage
available, or indeed any way to log in.
This commit is contained in:
2025-08-17 16:01:40 -05:00
parent e267f82db1
commit 9dae022788
10 changed files with 173 additions and 0 deletions

View File

View File

@@ -0,0 +1,6 @@
start_file=start.elf
fixup_file=fixup.dat
kernel=u-boot.bin
disable_overscan=1

View File

@@ -0,0 +1,41 @@
# vim: set sw=4 ts=4 sts=4 :
image firmware.img {
vfat {
}
srcpath = "efi-part"
size = 64M
}
image sdcard.img {
hdimage {
partition-table-type = hybrid
align = 1M
}
partition "EFI System Partition" {
partition-type = 0xC
partition-type-uuid = "U"
bootable = true
image = "firmware.img"
}
partition rootfs-a {
partition-type-uuid = "L"
image = "rootfs.squashfs"
size = 512M
}
partition rootfs-b {
partition-type-uuid = "L"
size = 512M
}
partition aimeeos-data {
partition-type-uuid = "L"
autoresize = true
}
size = 4G
}

View File

@@ -0,0 +1,26 @@
#!/bin/sh
set -e
BOARD_DIR=$(dirname "$0")
GRUBENV="${BINARIES_DIR}"/efi-part/EFI/BOOT/grubenv
genimage_tmp=$(mktemp -d)
trap 'rm -rf "${genimage_tmp}"' EXIT
cp -alf "${BINARIES_DIR}"/u-boot.bin "${BINARIES_DIR}"/efi-part/
cp -alf "${BINARIES_DIR}"/*.dtb "${BINARIES_DIR}"/efi-part/
cp -alf "${BINARIES_DIR}"/rpi-firmware/* "${BINARIES_DIR}"/efi-part/
mkdir -p "${genimage_tmp}"/rootfs "${genimage_tmp}"/tmp
cd "${BINARIES_DIR}"
genimage \
--rootpath "${genimage_tmp}/rootfs" \
--tmppath "${genimage_tmp}/tmp" \
--inputpath "${BINARIES_DIR}" \
--outputpath "${BINARIES_DIR}" \
--config "${BOARD_DIR}"/genimage.cfg
grub-editenv "${GRUBENV}" set default=0
grub-editenv "${GRUBENV}" set timeout=3