Add rpi-u-boot-scr to support A/B boot partitions
authorHugo Villeneuve <hugo@hugovil.com>
Tue, 17 Jan 2023 22:08:01 +0000 (17:08 -0500)
committerHugo Villeneuve <hugo@hugovil.com>
Wed, 1 Mar 2023 17:10:15 +0000 (12:10 -0500)
raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.in [new file with mode: 0644]
raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bbappend [new file with mode: 0644]

diff --git a/raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.in b/raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.in
new file mode 100644 (file)
index 0000000..9f2bb90
--- /dev/null
@@ -0,0 +1,6 @@
+saveenv
+fdt addr ${fdt_addr} && fdt get value bootargs /chosen bootargs
+if env exists rpipart;then echo Booting from mmcblk0p${rpipart};else setenv rpipart @@ROOT_PART_A_ID@@;echo rpipart not set, default to ${rpipart};fi
+load mmc 0:${rpipart} ${kernel_addr_r} boot/@@KERNEL_IMAGETYPE@@
+setenv bootargs ${bootargs} root=/dev/mmcblk0p${rpipart}
+@@KERNEL_BOOTCMD@@ ${kernel_addr_r} - ${fdt_addr}
diff --git a/raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bbappend b/raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bbappend
new file mode 100644 (file)
index 0000000..475cb3f
--- /dev/null
@@ -0,0 +1,6 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
+
+do_compile:prepend() {
+    sed -i -e 's/@@ROOT_PART_A_ID@@/${ROOT_PART_A_ID}/' \
+        "${WORKDIR}/boot.cmd.in"
+}