mirror of
git://git.yoctoproject.org/meta-rockchip.git
synced 2025-07-04 20:54:48 +02:00

Add an example of implementing rauc on a rockchip board. Adding the meta-rauc layer, adding 'rauc' to DISTRO_FEATURES, and enabling RK_RAUC_DEMO will build an image using the example provided in dynamic-layers/rk-rauc-demo. This example uses a simple A/B + D scheme (i.e. two root partitions and a non-updated /data partition). Repartitioning occurs automatically on first boot thanks to systemd's 'repart' mechanism. NOTE: - this example only works with systemd If you wish to provide your own implementation, simply add the meta-rauc layer, add 'rauc' to DISTRO_FEATURES, don't enable RK_RAUC_DEMO, and provide your own implementation in a separate layer. Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de> Signed-off-by: Trevor Woerner <twoerner@gmail.com>
52 lines
1.6 KiB
Batchfile
52 lines
1.6 KiB
Batchfile
echo "devtype: ${devtype}"
|
|
echo "devnum: ${devnum}"
|
|
echo "distro_bootpart: ${distro_bootpart}"
|
|
|
|
test -n "${BOOT_ORDER}" || env set BOOT_ORDER "A B"
|
|
test -n "${BOOT_A_LEFT}" || env set BOOT_A_LEFT 3
|
|
test -n "${BOOT_B_LEFT}" || env set BOOT_B_LEFT 3
|
|
test -n "${RAUC_BOOTDEV}" || env set RAUC_BOOTDEV "${devtype} ${devnum}:${distro_bootpart}"
|
|
|
|
env set RAUC_BOOTPART
|
|
env set RAUC_SLOT
|
|
|
|
echo "BOOT_ORDER: ${BOOT_ORDER}"
|
|
for RAUC_BOOTSLOT in "${BOOT_ORDER}"; do
|
|
if test "x${RAUC_BOOTPART}" != "x"; then
|
|
# skip remaining slots
|
|
elif test "x${RAUC_BOOTSLOT}" = "xA"; then
|
|
if test ${BOOT_A_LEFT} -gt 0; then
|
|
echo "using RAUC slot A"
|
|
setexpr BOOT_A_LEFT ${BOOT_A_LEFT} - 1
|
|
env set RAUC_BOOTPART "PARTLABEL=rootfsA"
|
|
env set RAUC_SLOT "A"
|
|
env set RAUC_BOOTDEV "${devtype} ${devnum}:${distro_bootpart}"
|
|
echo "RAUC_BOOTDEV: ${RAUC_BOOTDEV}"
|
|
fi
|
|
elif test "x${RAUC_BOOTSLOT}" = "xB"; then
|
|
if test ${BOOT_B_LEFT} -gt 0; then
|
|
echo "using RAUC slot B"
|
|
setexpr BOOT_B_LEFT ${BOOT_B_LEFT} - 1
|
|
env set RAUC_BOOTPART "PARTLABEL=rootfsB"
|
|
env set RAUC_SLOT "B"
|
|
setexpr BOOTPART1 ${distro_bootpart} + 1
|
|
env set RAUC_BOOTDEV "${devtype} ${devnum}:${BOOTPART1}"
|
|
echo "RAUC_BOOTDEV: ${RAUC_BOOTDEV}"
|
|
fi
|
|
fi
|
|
done
|
|
|
|
if test -n "${RAUC_BOOTPART}"; then
|
|
env set bootargs "${bootargsbase} root=${RAUC_BOOTPART} rauc.slot=${RAUC_SLOT}"
|
|
env save
|
|
else
|
|
echo "No valid RAUC slot found. Resetting tries to 3"
|
|
env set BOOT_A_LEFT 3
|
|
env set BOOT_B_LEFT 3
|
|
env save
|
|
reset
|
|
fi
|
|
|
|
ext4load ${RAUC_BOOTDEV} ${kernel_addr_r} @@KERNEL_BOOTFILE@@
|
|
bootm ${kernel_addr_r}
|