From 4c2e475842fa4d1c2f1d8508d526fefac1a2948c Mon Sep 17 00:00:00 2001 From: Pawel Dembicki Date: Sat, 9 May 2020 22:08:02 +0200 Subject: [PATCH] uboot-kirkwood: add support for Zyxel NSA310S This patch modifies the u-boot config for the Zyxel NSA310S to work with OpenWrt. Signed-off-by: Pawel Dembicki --- package/boot/uboot-kirkwood/Makefile | 6 +++ .../uboot-kirkwood/patches/160-nsa310s.patch | 54 +++++++++++++++++++ .../patches/200-openwrt-config.patch | 20 +++++++ 3 files changed, 80 insertions(+) create mode 100644 package/boot/uboot-kirkwood/patches/160-nsa310s.patch diff --git a/package/boot/uboot-kirkwood/Makefile b/package/boot/uboot-kirkwood/Makefile index c1b33b4a82e..d2cbc1041b0 100644 --- a/package/boot/uboot-kirkwood/Makefile +++ b/package/boot/uboot-kirkwood/Makefile @@ -59,6 +59,11 @@ define U-Boot/nsa310 BUILD_DEVICES:=zyxel_nsa310b endef +define U-Boot/nsa310s + NAME:=Zyxel NSA310S + BUILD_DEVICES:=zyxel_nsa310s +endef + define U-Boot/nsa325 NAME:=Zyxel NSA325v1 and v2 BUILD_DEVICES:=zyxel_nsa325 @@ -85,6 +90,7 @@ UBOOT_TARGETS := \ ib62x0 ib62x0_second_stage \ iconnect iconnect_second_stage \ nsa310 \ + nsa310s \ nsa325 \ pogo_e02 pogo_e02_second_stage \ pogoplugv4 diff --git a/package/boot/uboot-kirkwood/patches/160-nsa310s.patch b/package/boot/uboot-kirkwood/patches/160-nsa310s.patch new file mode 100644 index 00000000000..fe0cd3f4365 --- /dev/null +++ b/package/boot/uboot-kirkwood/patches/160-nsa310s.patch @@ -0,0 +1,54 @@ +--- a/configs/nsa310s_defconfig ++++ b/configs/nsa310s_defconfig +@@ -5,7 +5,7 @@ CONFIG_KIRKWOOD=y + CONFIG_SYS_TEXT_BASE=0x600000 + CONFIG_TARGET_NSA310S=y + CONFIG_ENV_SIZE=0x20000 +-CONFIG_ENV_OFFSET=0xE0000 ++CONFIG_ENV_OFFSET=0xC0000 + CONFIG_NR_DRAM_BANKS=2 + CONFIG_BOOTDELAY=3 + CONFIG_USE_PREBOOT=y +@@ -25,7 +25,7 @@ CONFIG_CMD_EXT2=y + CONFIG_CMD_FAT=y + CONFIG_CMD_JFFS2=y + CONFIG_CMD_MTDPARTS=y +-CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:0xe0000@0x0(uboot),0x20000@0xe0000(uboot_env),0x100000@0x100000(second_stage_uboot),-@0x200000(root)" ++CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:0xc0000@0x0(uboot),0x80000@0xc0000(uboot_env),-@0x140000(ubi)" + CONFIG_CMD_UBI=y + CONFIG_ISO_PARTITION=y + CONFIG_ENV_IS_IN_NAND=y +--- a/include/configs/nsa310s.h ++++ b/include/configs/nsa310s.h +@@ -30,22 +30,17 @@ + + /* default environment variables */ + #define CONFIG_BOOTCOMMAND \ +- "setenv bootargs ${console} ${mtdparts} ${bootargs_root}; " \ +- "ubi part root; " \ +- "ubifsmount ubi:rootfs; " \ +- "ubifsload 0x800000 ${kernel}; " \ +- "ubifsload 0x700000 ${fdt}; " \ +- "ubifsumount; " \ +- "fdt addr 0x700000; fdt resize; fdt chosen; " \ +- "bootz 0x800000 - 0x700000" ++ "setenv bootargs ${console} ${mtdparts} ${bootargs_root}; " \ ++ "ubi part ubi; " \ ++ "ubifsmount ubi:rootfs; " \ ++ "ubi read 0x800000 kernel; " \ ++ "bootm 0x800000" + + #define CONFIG_EXTRA_ENV_SETTINGS \ +- "console=console=ttyS0,115200\0" \ +- "mtdids=nand0=orion_nand\0" \ +- "mtdparts="CONFIG_MTDPARTS_DEFAULT \ +- "kernel=/boot/zImage\0" \ +- "fdt=/boot/nsa310s.dtb\0" \ +- "bootargs_root=ubi.mtd=3 root=ubi0:rootfs rootfstype=ubifs rw\0" ++ "console=console=ttyS0,115200\0" \ ++ "mtdids=nand0=orion_nand\0" \ ++ "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \ ++ "bootargs_root=\0" + + /* Ethernet driver configuration */ + #ifdef CONFIG_CMD_NET diff --git a/package/boot/uboot-kirkwood/patches/200-openwrt-config.patch b/package/boot/uboot-kirkwood/patches/200-openwrt-config.patch index 2ff4f2f184f..c7c811cee12 100644 --- a/package/boot/uboot-kirkwood/patches/200-openwrt-config.patch +++ b/package/boot/uboot-kirkwood/patches/200-openwrt-config.patch @@ -162,3 +162,23 @@ +CONFIG_FIT_VERBOSE=y +CONFIG_LZMA=y +CONFIG_LZO=y +--- a/configs/nsa310s_defconfig ++++ b/configs/nsa310s_defconfig +@@ -40,5 +40,8 @@ CONFIG_SYS_NS16550=y + CONFIG_USB=y + CONFIG_USB_EHCI_HCD=y + CONFIG_USB_STORAGE=y ++CONFIG_FIT=y ++CONFIG_FIT_VERBOSE=y + CONFIG_LZMA=y ++CONFIG_LZO=y + CONFIG_OF_LIBFDT=y +--- a/include/configs/nsa310s.h ++++ b/include/configs/nsa310s.h +@@ -63,4 +63,6 @@ + #define CONFIG_RTC_MV + #endif /* CONFIG_CMD_DATE */ + ++#include "openwrt-kirkwood-common.h" ++ + #endif /* _CONFIG_NSA310S_H */