openwrt/target/linux/realtek
Harshal Gohel 7812d867b4 realtek: Introduce Plasma Cloud sysupgrade helper
Plasma Cloud devices use a dual-firmware regions/slots boot mechanism. On
APs, the u-boot is "intelligent" and checks the NOR/NAND partitions (kernel
+ rootfs) for corruption via "datachk". If validation fails, the bootloader
automatically switches to the fallback partition.

On Realtek-based switches, this "datachk" helper is not available.
However, the bootloader still supports two firmware regions/slots.

When flashing a new image, the "inactive" partition is written instead of
overwriting the active one. If no "inactive" partition exists but
"firmware1" is present, the bootloader always treats "firmware1" as
fallback. Only after a successful flash is the `u-boot-env` updated to
select the newly written partition.

On reboot, the bootloader loads the kernel from the new partition and
passes `mtdparts` information as the kernel cmdline. The Plasma Cloud
switch device tree does not override this with a `bootargs` property, so
the active partition layout is honored from cmdline.

Since offsets, sizes, and names of partitions match between the device tree
and cmdline (except the inactive slot), properties and nodes such as
`nvmem-cells` or `compatible` remain fully usable.

This mechanism also allows switching back to the old firmware slot.  For
example, if `firmware1` is currently active (`/proc/mtd` shows it), it can
be switched to slot 2 using:

    . /lib/upgrade/upgrade_dualboot.sh
    set_boot_part 2
    reboot

Firmware upgrades use standard `sysupgrade` tarballs, chosen for
compatibility with vendor images. In theory, one can switch between vendor
and OpenWrt with:

    sysupgrade -n /tmp/*-squashfs-sysupgrade.bin

Note: configuration files must not be preserved, as they are not compatible
with vanilla OpenWrt.

Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
Signed-off-by: Sharadanand Karanjkar <sk@simonwunderlich.de>
Link: https://github.com/openwrt/openwrt/pull/19362
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2025-08-28 21:07:57 +02:00
..
base-files realtek: Introduce Plasma Cloud sysupgrade helper 2025-08-28 21:07:57 +02:00
dts realtek: add support for XikeStor SKS8310-8X 2025-08-23 19:22:53 +02:00
files/firmware/rtl838x_phy
files-6.12 realtek: Fix nvmem support for ethernet device 2025-08-28 21:07:57 +02:00
image realtek: add support for XikeStor SKS8310-8X 2025-08-23 19:22:53 +02:00
patches-6.12 realtek: rtl8231-aux: add RTL931x support 2025-08-17 17:31:22 +02:00
profiles target: use SPDX license identifiers on Makefiles 2021-02-10 15:47:18 +01:00
rtl838x realtek: backport NAND driver for RTL93xx 2025-07-30 23:22:24 +02:00
rtl839x realtek: backport NAND driver for RTL93xx 2025-07-30 23:22:24 +02:00
rtl930x realtek: rtl930x: Enable parsing of u-boot nvmem layouts 2025-08-28 21:07:57 +02:00
rtl930x_nand realtek: add NAND targets for RTL93xx 2025-08-10 11:46:52 +02:00
rtl931x realtek: add RTL8231 driver configuration to kernel build 2025-08-17 17:31:24 +02:00
rtl931x_nand realtek: add RTL8231 driver configuration to kernel build 2025-08-17 17:31:24 +02:00
Makefile realtek: add NAND targets for RTL93xx 2025-08-10 11:46:52 +02:00