Use dedicated boot partition for bootloader
Librem 5's eMMC has two separate 4MB boot partitions that can be used to boot the device from.
librem5-flash-image could flash the u-boot used to perform flashing itself into one of those partitions and mark it as active. This would allow bootloader-less images to be used, which is a feature often requested by distro maintainers.
Working PoC:
diff --git a/scripts/librem5-flash-image b/scripts/librem5-flash-image
index 21664e11526f..9444fb0acf96 100755
--- a/scripts/librem5-flash-image
+++ b/scripts/librem5-flash-image
@@ -67,7 +67,12 @@ SDPV: jump
# This command will be run when ROM support stream mode
SDPS: boot -f {uboot}
SDPU: delay 1000
-#FB: ucmd setenv fastboot_buffer 0x43000000
+FB: ucmd setenv fastboot_buffer 0x43000000
+FB: download -f {uboot}
+FB: ucmd mmc dev 0 1
+FB: ucmd mmc write 0x43000000 0x42 0x1000
+FB: ucmd mmc partconf 0 0 1 0
+FB: ucmd mmc dev 0 0
FB: ucmd setenv fastboot_dev mmc
FB: ucmd setenv mmcdev 0
FB: flash -raw2sparse all {image}
Would be good to make it optional/configurable with command line parameters though.