Open SocialLoginDev opened 6 months ago
@SocialLoginDev It might require less adaptions if you name your main.1
slot rootfs.0
instead.
Otherwise, you would also need to update the update-bundle.bb
recipe to emit a slot of name main
(instead of rootfs
).
You may also want to update the bootloader script (recipes-bsp/rpi-u-boot-scr/files/boot.cmd.in:
). It currently has a logic for symmetric updates and uses A
and B
as boot names (instead of update
and main
). For the recovery case, one might be able to simplify the boot logic to "boot A (or main) N times, otherwise boot fallback/update".
I have updated the update-bundle.bb
recipe:
DESCRIPTION = "RAUC bundle generator"
inherit bundle
RAUC_BUNDLE_COMPATIBLE = "RaspberryPi4"
RAUC_BUNDLE_VERSION = "v20240001"
RAUC_BUNDLE_DESCRIPTION = "RAUC datafox bundle"
RAUC_BUNDLE_FORMAT = "verity"
RAUC_BUNDLE_SLOTS = "main"
RAUC_SLOT_main = "core-image-base"
RAUC_SLOT_main[fstype] = "ext4"
RAUC_KEY_FILE = "${THISDIR}/files/development-1.key.pem"
RAUC_CERT_FILE = "${THISDIR}/files/development-1.cert.pem"
and recipes-bsp/rpi-u-boot-scr/files/boot.cmd.in
:
fdt addr ${fdt_addr} && fdt get value bootargs /chosen bootargs
test -n "${BOOT_ORDER}" || setenv BOOT_ORDER "main update"
test -n "${BOOT_MAIN_LEFT}" || setenv BOOT_MAIN_LEFT 3
test -n "${BOOT_UPDATE_LEFT}" || setenv BOOT_UPDATE_LEFT 3
test -n "${BOOT_DEV}" || setenv BOOT_DEV "mmc 0:1"
setenv bootpart
setenv raucslot
for BOOT_SLOT in "${BOOT_ORDER}"; do
if test "x${bootpart}" != "x"; then
# skip remaining slots
elif test "x${BOOT_SLOT}" = "xmain"; then
if test ${BOOT_MAIN_LEFT} -gt 0; then
setexpr BOOT_MAIN_LEFT ${BOOT_MAIN_LEFT} - 1
echo "Found valid RAUC main slot"
setenv bootpart "/dev/mmcblk0p3"
setenv raucslot "main"
setenv BOOT_DEV "mmc 0:3"
fi
elif test "x${BOOT_SLOT}" = "xupdate"; then
if test ${BOOT_UPDATE_LEFT} -gt 0; then
setexpr BOOT_UPDATE_LEFT ${BOOT_UPDATE_LEFT} - 1
echo "Found valid RAUC update slot"
setenv bootpart "/dev/mmcblk0p2"
setenv raucslot "update"
setenv BOOT_DEV "mmc 0:2"
fi
fi
done
if test -n "${bootpart}"; then
setenv bootargs "${bootargs} root=${bootpart} rauc.slot=${raucslot}"
saveenv
else
echo "No valid RAUC slot found. Resetting tries to 3"
setenv BOOT_MAIN_LEFT 3
setenv BOOT_UPDATE_LEFT 3
saveenv
reset
fi
fatload mmc 0:1 ${kernel_addr_r} @@KERNEL_IMAGETYPE@@
if test ! -e mmc 0:1 uboot.env; then saveenv; fi;
@@KERNEL_BOOTCMD@@ ${kernel_addr_r} - ${fdt_addr}
RAUC only works from the update partition; when I try to update from the main partition, it displays the following message:
LastError: Installation error: No target slot for class main of image core-image-base-raspberrypi4-64.ext4 found
Is this normal behavior?
Another question: How to change the update partition to initramfs? In my case, I already have initramfs, it is used to overlayroot the main system using the initramfs-module-overlayroot script. What should be done in this case?
I try using the asymmetric slots scenario. My system.conf:
and wks.in:
What else needs to be fixed and what additional files need to be changed for everything to work properly?