From f2f09bc00280f5bd60b36d525a5e229550958b6d Mon Sep 17 00:00:00 2001 From: Jan Hoffmann Date: Sat, 23 Jul 2022 22:53:19 +0200 Subject: realtek: add support for HPE 1920 series Hardware information: --------------------- - HPE 1920-8G: - RTL8380 SoC - 8 Gigabit RJ45 ports (built-in RTL8218B) - 2 SFP ports (built-in SerDes) - HPE 1920-16G / HPE 1920-24G (same board): - RTL8382 SoC - 16/24 Gigabit RJ45 ports (built-in RTL8218B, 1/2 external RTL8218D) - 4 SFP ports (external RTL8214FC) - Common: - RJ45 RS232 port on front panel - 32 MiB NOR Flash - 128 MiB DDR3 DRAM - PT7A7514 watchdog Booting initramfs image: ------------------------ - Prepare a FTP or TFTP server serving the OpenWrt initramfs image and connect the server to a switch port. - Connect to the console port of the device and enter the extended boot menu by typing Ctrl+B when prompted. - Choose the menu option "<3> Enter Ethernet SubMenu". - Set network parameters via the option "<5> Modify Ethernet Parameter". Enter the FTP/TFTP filename as "Load File Name" ("Target File Name" can be left blank, it is not required for booting from RAM). Note that the configuration is saved on flash, so it only needs to be done once. - Select "<1> Download Application Program To SDRAM And Run". Initial installation: --------------------- - Boot an initramfs image as described above, then use sysupgrade to install OpenWrt permanently. After initial installation, the bootloader needs to be configured to load the correct image file - Enter the extended boot menu again and choose "<4> File Control", then select "<2> Set Application File type". - Enter the number of the file "openwrt-kernel.bin" (should be 1), and use the option "<1> +Main" to select it as boot image. - Choose "<0> Exit To Main Menu" and then "<1> Boot System". NOTE: The bootloader on these devices can only boot from the VFS filesystem which normally spans most of the flash. With OpenWrt, only the first part of the firmware partition contains a valid filesystem, the rest is used for rootfs. As the bootloader does not know about this, you must not do any file operations in the bootloader, as this may corrupt the OpenWrt installation (selecting the boot image is an exception, as it only stores a flag in the bootloader data, but doesn't write to the filesystem). Signed-off-by: Jan Hoffmann --- target/linux/realtek/image/Makefile | 49 +++++++++++++++++++++++++++++++++++ target/linux/realtek/image/rtl838x.mk | 24 +++++++++++++++++ 2 files changed, 73 insertions(+) (limited to 'target/linux/realtek/image') diff --git a/target/linux/realtek/image/Makefile b/target/linux/realtek/image/Makefile index cf779002e8..6165d99bfc 100644 --- a/target/linux/realtek/image/Makefile +++ b/target/linux/realtek/image/Makefile @@ -8,6 +8,7 @@ KERNEL_ENTRY = 0x80000400 DEVICE_VARS += ZYXEL_VERS DLINK_KERNEL_PART_SIZE DEVICE_VARS += CAMEO_KERNEL_PART CAMEO_ROOTFS_PART CAMEO_CUSTOMER_SIGNATURE CAMEO_BOARD_VERSION +DEVICE_VARS += H3C_PRODUCT_ID H3C_DEVICE_ID define Build/zyxel-vers ( echo VERS;\ @@ -41,6 +42,43 @@ define Build/dlink-headers 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/relocate-kernel + rm -rf $@.relocate + $(CP) ../../generic/image/relocate $@.relocate + $(MAKE) -j1 -C $@.relocate KERNEL_ADDR=$(KERNEL_LOADADDR) LZMA_TEXT_START=0x82000000 \ + CROSS_COMPILE=$(TARGET_CROSS) + ( \ + dd if=$@.relocate/loader.bin bs=32 conv=sync && \ + perl -e '@s = stat("$@"); print pack("N", @s[7])' && \ + cat "$@" \ + ) > "$@.new" + mv "$@.new" "$@" + rm -rf $@.relocate +endef + define Device/Default PROFILES = Default KERNEL := kernel-bin | append-dtb | gzip | uImage gzip @@ -52,6 +90,17 @@ define Device/Default check-size | append-metadata endef +define Device/hpe_1920 + DEVICE_VENDOR := HPE + IMAGE_SIZE := 29632k + BLOCKSIZE := 64k + H3C_PRODUCT_ID := 0x3c010501 + KERNEL := kernel-bin | append-dtb | relocate-kernel | 7z | h3c-image | h3c-vfs + KERNEL_INITRAMFS := kernel-bin | append-dtb | relocate-kernel | 7z | h3c-image + IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | \ + pad-rootfs | check-size | append-metadata +endef + # "NGE" refers to the uImage magic define Device/netgear_nge KERNEL := kernel-bin | append-dtb | lzma | uImage lzma diff --git a/target/linux/realtek/image/rtl838x.mk b/target/linux/realtek/image/rtl838x.mk index 887f82e385..60eda5359d 100644 --- a/target/linux/realtek/image/rtl838x.mk +++ b/target/linux/realtek/image/rtl838x.mk @@ -65,6 +65,30 @@ define Device/engenius_ews2910p endef TARGET_DEVICES += engenius_ews2910p +define Device/hpe_1920-8g + $(Device/hpe_1920) + SOC := rtl8380 + DEVICE_MODEL := 1920-8G (JG920A) + H3C_DEVICE_ID := 0x00010023 +endef +TARGET_DEVICES += hpe_1920-8g + +define Device/hpe_1920-16g + $(Device/hpe_1920) + SOC := rtl8382 + DEVICE_MODEL := 1920-16G (JG923A) + H3C_DEVICE_ID := 0x00010026 +endef +TARGET_DEVICES += hpe_1920-16g + +define Device/hpe_1920-24g + $(Device/hpe_1920) + SOC := rtl8382 + DEVICE_MODEL := 1920-24G (JG924A) + H3C_DEVICE_ID := 0x00010027 +endef +TARGET_DEVICES += hpe_1920-24g + define Device/inaba_aml2-17gp SOC := rtl8382 IMAGE_SIZE := 13504k -- cgit v1.2.3