0
0
mirror of https://git.openwrt.org/openwrt/openwrt.git/ synced 2025-10-06 02:42:50 +02:00
Files
openwrt/target/linux/realtek/base-files/lib/upgrade/platform.sh
Markus Stockhausen 853d73f9d1 realtek: add support for Linksys LGS328C
Hardware specification
----------------------

* RTL9301 SoC, 1 MIPS 34KEc core @ 800MHz
* 512MB DRAM
* 2MB NOR Flash
* 128MB NAND Flash
* 24 x 10/100/1000BASE-T ports
* 4 x 10G SFP+ ports
* Power LED, Fault LED
* Reset button on front panel
* UART (115200 8N1) via RJ45

Installation using serial interface
-----------------------------------

1. Press "a" "c" "p" during message "Enter correct key to stop autoboot"
2. Start network "rtk network on"
3. Load image "tftpboot <TFTP IP>:openwrt-realtek-rtl930x_nand-linksys_lgs328c-initramfs-kernel.bin"
4. Boot image "bootm"
5. Switch to first bootpartition "fw_setsys bootpartition 0"
5. Download sysupgrade "scp <IP>:openwrt-realtek-rtl930x_nand-linksys_lgs328c-squashfs-sysupgrade.bin /tmp/."
6. Install sysupgrade "sysupgrade /tmp/openwrt-realtek-rtl930x_nand-linksys_lgs328c-squashfs-sysupgrade.bin"

Installation using OEM webinterface
-----------------------------------

This is not possible because the OpenWrt NAND Flash layout is different
from the vendor layout. To be precise. Vendor uses:

- 64 MB vendor UBI root_data
- 32 MB vendor kernel+root 1 (~19 MB used)
- 32 MB vendor kernel+root 2 (~19 MB used)

OpenWrt uses:

- 64 MB vendor UBI (not touched)
- 10 MB OpenWrt kernel
- 22 MB Openwrt mtd-concat UBI
- 23 MB vendor kernel 2 (space reduced, vendor data unchanged)
- 09 MB OpenWrt mtd-concat UBI

Dual-boot with stock firmware using writable u-boot-env
-------------------------------------------------------

From stock to OpenWrt / primary image 1 (CLI as admin):
   - > boot system image1
   - > reboot

From OpenWrt to stock / boot image 2: (shell as root)
   - # fw_setsys bootpartition 1
   - # reboot

Debrick using serial interface
------------------------------

1. Press "a" "c" "p" during message "Enter correct key to stop autoboot"
2. Load vendor image with "upgrade runtime <TFTP IP>:LGS328xxxxx.imag"
3. switch to primary partition "setsys bootpartition 0"
4. safe config "savesys"

Further documentation
---------------------
See https://openwrt.org/toh/linksys/lgs352c

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/20255
Signed-off-by: Robert Marko <robimarko@gmail.com>
2025-10-05 12:14:05 +02:00

50 lines
1.1 KiB
Bash

PART_NAME=firmware
REQUIRE_IMAGE_METADATA=1
RAMFS_COPY_BIN='fw_printenv fw_setenv'
RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
# The TP-Link bootloader gets its flash layout from "bootargs".
# Use this to our advantage, and:
# 1. Disable the second rootfs (usrimg2)
# 2. Extend the first rootfs (usrimg1) to include more space
# 3. Increase the baudrate to the expected 115200
tplink_sg2xxx_fix_mtdparts() {
local args
args="bootargs mtdparts=spi_flash:896K(boot),128K(env),6144K(sys)"
args="$args,20480K(usrimg1@main),0K(usrimg2)"
args="$args,4096K(usrappfs),1024K(para)\n"
args="$args baudrate 115200"
echo -e "$args" | fw_setenv --script -
}
platform_check_image() {
return 0
}
platform_do_upgrade() {
local board=$(board_name)
case "$board" in
plasmacloud,esx28|\
plasmacloud,psx8|\
plasmacloud,psx10|\
plasmacloud,psx28)
PART_NAME="inactive"
platform_do_upgrade_dualboot_plasmacloud "$1"
;;
tplink,sg2008p-v1|\
tplink,sg2210p-v3)
tplink_sg2xxx_fix_mtdparts
default_do_upgrade "$1"
;;
linksys,lgs328c)
nand_do_upgrade "$1"
;;
*)
default_do_upgrade "$1"
;;
esac
}