1
1
openwrt/target/linux/mvebu/image/udpu.bootscript
Robert Marko ada2753d6a mvebu: cortexa53: uDPU/eDPU convert to dual firmware (A/B)
Methode uDPU and eDPU devices are one of the rare ones with a completely
custom image format being used with custom partition table with F2FS.

Instead of converting the boards to dual firmware (A/B style) and further
expand the already convoluted custom scripts, especially considering that
dual firmware conversion is a breaking change anyway, lets convert to using
the generic eMMC sysupgrade based images.

F2FS ZSTD compression is preserved thanks to fstools now supporting its use
on overlays.

Dual firmware support is implemented via U-Boot scripts so no U-Boot
upgrade is required.

Since there is a partition table layout change, eMMC must be wiped and
reflashed with the generated GPT image from OpenWrt initramfs.

Then on each sysupgrade the firmware slot will be altered.

Instructions:
1. Boot into OpenWrt initramfs
2. Copy openwrt-mvebu-cortexa53-methode_edpu-squashfs-emmc-gpt.img.gz to
the device into /tmp
3. Erase eMMC:
dd if=/dev/zero of=/dev/mmcblk0 bs=1M
4. Extract image
gzip -d /tmp/openwrt-mvebu-cortexa53-methode_edpu-squashfs-emmc-gpt.img.gz
5. Flash image
dd if=/tmp/openwrt-mvebu-cortexa53-methode_edpu-squashfs-emmc-gpt.img of=/dev/mmcblk0
6. Reboot

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
2026-05-26 19:35:42 +02:00

75 lines
1.6 KiB
Plaintext

# Bootscript for Methode uDPU device
# Device and variables may vary between different revisions
# of device, so we need to make sure everything is set correctly.
# Set the LED's correctly
gpio clear 12; gpio clear 40; gpio clear 45;
# Find eMMC device,
if mmc dev 0; then
setenv mmcdev 0
elif mmc dev 1; then
setenv mmcdev 1
fi
# Check if bootactive variable exists and if not, default to 1
if test -z "${bootactive}"; then
setenv bootactive 1
fi
# Check if bootcount variable exists and if not, default to 0
if test -z "${bootcount}"; then
setenv bootcount 0
fi
if itest ${bootcount} > 2; then
if itest ${bootactive} == 2; then
setenv bootactive 1
else
setenv bootactive 2
fi
setenv bootcount 0
fi
# Find A/B firmware to boot
if itest ${bootactive} == 2; then
setenv kernelpart 3
setenv rootfspart 4
else
setenv kernelpart 1
setenv rootfspart 2
fi
setenv rootdev 'root=/dev/mmcblk'${mmcdev}'p'${rootfspart}
# Set the variables if necessary
if test ${kernel_addr_r}; then
setenv kernel_addr_r 0x5000000
fi
echo 'Booting firmware:' ${bootactive}
if itest ${bootcount} == 0; then
setenv bootcount 1
elif itest ${bootcount} == 1; then
setenv bootcount 2
elif itest ${bootcount} == 2; then
setenv bootcount 3
else
setenv bootcount 4
fi
env save
setenv bootargs $rootdev rootwait fstools_overlay_compression_type=zstd
load mmc ${mmcdev}:${kernelpart} ${kernel_addr_r} Image
bootm ${kernel_addr_r}
# If booting fails before kernel is loaded then reboot
# so the bootcount can trigger a slot switch.
echo 'Booting firmware:' ${bootactive} 'failed, rebooting'
reset