Hi, I've been thinking of ways to generalize the bootloader installation for ARM boards. One of the most annoying parts of u-boot is that the u-boot project does NOT include bootloader installers (something like grub-install does not exist in u-boot).
A possible upstream project that builds ARM images is Buildroot (it's basically a Linux distribution). First, it would [probably] be possible to use Buildroot directly, but they have different policies like using *specific* u-boot versions, toolchain and compiler versions etc--also it takes a LOT of time and space to do that, and for something as tiny as u-boot that would be kinda silly. A second way would be to use the buildroot config files and "genimage.cfg"s in order to extract (1) which u-boot configuration to use and (2) have genimage build the bootloader parts of the image (or the entire image just with empty rootfs). For that, we would (for example): * Read configs/orangepi_zero_defconfig to find: BR2_TARGET_UBOOT=y BR2_TARGET_UBOOT_BOARD_DEFCONFIG="orangepi_zero" BR2_TARGET_UBOOT_NEEDS_DTC=y BR2_TARGET_UBOOT_FORMAT_CUSTOM=y BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot-sunxi-with-spl.bin" BR2_TARGET_UBOOT_BOOT_SCRIPT=y BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE="board/orangepi/orangepi-zero/boot.cmd" BR2_PACKAGE_HOST_DOSFSTOOLS=y BR2_PACKAGE_HOST_GENIMAGE=y BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_HOST_UBOOT_TOOLS=y BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh" BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/orangepi/orangepi-zero/genimage.cfg" * Then read board/orangepi/orangepi-zero/genimage.cfg to find: image boot.vfat { ... which files to put there } image sdcard.img { ... which files and partitions to put there } We could reimplement genimage ourselves, but I suggest we just use genimage instead (I've packaged it in guix master). The rootfs size would need to be dynamically adjusted (the "genimage.cfg"s usually specify a fixed size)--not sure how annoying that would be. That way we could generalize u-boot bootloader installation without undue maintenance effort on our side. A possible way forward could be to implement an importer to figure out all the boards to put into gnu/bootloader/u-boot.scm, including an installer that uses genimage in order to install the bootloader (and, really, ideally partitions everything else--so it should run much earlier or else we'd have to do extra modifications that could be avoided). I've started branch "wip-buildroot" in order to do that. To try it out: * Invoke: guix import buildroot sheevaplug_defconfig * Stick the result into gnu/bootloader/u-boot.scm (with appropriate "define") * Build system image using it. (It's not finished yet but it should provide a basis for discussion...)
pgpC22_0LTll3.pgp
Description: OpenPGP digital signature