openwrt/target/linux/realtek/image/Makefile
Markus Stockhausen d03f3dcf3b realtek: add support for Linksys LGS310C
Hardware specification
----------------------

* RTL8380M SoC, 1 MIPS 4KEc core @ 500MHz
* 256MB DRAM
* 32MB NOR Flash
* 8 x 10/100/1000BASE-T ports
* 2 x SFP ports
* Power LED, Fault LED
* Reset button on front panel
* UART (115200 8N1) via populated standard pin header marked JP1

TODO: The SFP ports use a shared SCL GPIO that the driver cannot handle.
The left SFP port (lan9) is defined and fully functional while the laser
on the right SFP port (lan10) is off by default.

UART pinout
-----------

[o]ooo|JP1
 | ||`------ GND
 | |`------- RX
 | `-------- TX
 `---------- Vcc (3V3)

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

1. Make sure you are running OEM firmware in secondary slot
2. Install squashfs-factory.imag to primary slot by upload via http

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

1. Press "a" "c" "p" during message "Enter correct key to stop autoboot"
2. Load image with "upgrade runtime <TFTP IP>:squashfs-sysupgrade.bin" command
3. Switch to primary slot with "setsys bootpartition 0"
4. Store config with "savesys"
5. Boot the image with `boota` command

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>:LGS310xxxxx.imag"
3. switch to primary partition "setsys bootpartition 0"
4. safe config "savesys"

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

It has been developed and tested on device with v1 revision.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/16068
[Add missing 'w' in name of firmware partition]
Signed-off-by: Sander Vanheule <sander@svanheule.net>
2024-10-02 20:15:21 +02:00

114 lines
2.6 KiB
Makefile

# SPDX-License-Identifier: GPL-2.0-only
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk
KERNEL_LOADADDR = 0x80100000
DEVICE_VARS += \
BELKIN_HEADER \
BELKIN_MODEL \
CAMEO_BOARD_MODEL \
CAMEO_BOARD_VERSION \
CAMEO_CUSTOMER_SIGNATURE \
CAMEO_KERNEL_PART \
CAMEO_KERNEL_PART_SIZE \
CAMEO_ROOTFS_PART \
H3C_DEVICE_ID \
H3C_PRODUCT_ID \
LINKSYS_HEADER \
ZYXEL_VERS
define Build/zyxel-vers
( echo VERS;\
for hw in $(ZYXEL_VERS); do\
echo -n "V9.99($$hw.0) | ";\
date -d @$(SOURCE_DATE_EPOCH) +%m/%d/%Y;\
done ) >> $@
endef
define Build/cameo-tag
$(SCRIPT_DIR)/cameo-tag.py $@ $(CAMEO_KERNEL_PART_SIZE)
endef
define Build/cameo-version
echo -n "OpenWrt" >> $@
dd if=/dev/zero bs=25 count=1 >> $@
endef
define Build/cameo-headers
dd if=$@ bs=$(CAMEO_KERNEL_PART_SIZE) count=1 of=$@.kernel_part; \
dd if=$@ bs=$(CAMEO_KERNEL_PART_SIZE) skip=1 of=$@.rootfs_part; \
$(SCRIPT_DIR)/cameo-imghdr.py $@.kernel_part $@.kernel_part.hex \
"$(CAMEO_BOARD_MODEL)" os $(CAMEO_KERNEL_PART) \
$(CAMEO_CUSTOMER_SIGNATURE) \
$(CAMEO_BOARD_VERSION) \
$(KERNEL_LOADADDR); \
$(SCRIPT_DIR)/cameo-imghdr.py $@.rootfs_part $@.rootfs_part.hex \
"$(CAMEO_BOARD_MODEL)" squashfs $(CAMEO_ROOTFS_PART) \
$(CAMEO_CUSTOMER_SIGNATURE) \
$(CAMEO_BOARD_VERSION); \
cat $@.kernel_part.hex $@.rootfs_part.hex > $@
endef
define Build/7z
$(STAGING_DIR_HOST)/bin/7zr a $(@).new -t7z -m0=lzma $(@)
mv $@.new $@
endef
define Build/h3c-image
$(STAGING_DIR_HOST)/bin/mkh3cimg \
-i $(@) \
-o $(@).new \
-c 7z \
-p $(H3C_PRODUCT_ID) \
-d $(H3C_DEVICE_ID)
mv $@.new $@
endef
define Build/h3c-vfs
$(STAGING_DIR_HOST)/bin/mkh3cvfs \
-i $(@) \
-o $(@).new \
-f openwrt-kernel.bin
mv $@.new $@
endef
define Build/belkin-header
$(SCRIPT_DIR)/belkin-header.py $(@) $(@).new $(BELKIN_HEADER) ${BELKIN_MODEL}
mv $@.new $@
endef
define Build/linksys-image
$(SCRIPT_DIR)/linksys-image.sh $(@) $(@).new $(LINKSYS_MODEL)
mv $@.new $@
endef
define Device/Default
PROFILES = Default
KERNEL := \
kernel-bin | \
append-dtb | \
libdeflate-gzip | \
uImage gzip
KERNEL_INITRAMFS := \
kernel-bin | \
append-dtb | \
libdeflate-gzip | \
uImage gzip
DEVICE_DTS_DIR := ../dts
DEVICE_DTS = $$(SOC)_$(1)
IMAGES := sysupgrade.bin
IMAGE/sysupgrade.bin := \
append-kernel | \
pad-to 64k | \
append-rootfs | \
pad-rootfs | \
check-size | \
append-metadata
endef
include $(SUBTARGET).mk
$(eval $(call BuildImage))