From: Pawel Dembicki Date: Thu, 10 Jun 2021 15:17:23 +0000 (+0200) Subject: ramips: mt7620: use OKLI loader with Jboot devices X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=794e8123ce625d04f8207ba5fd3b153051b2e67e;p=openwrt%2Fstaging%2Fldir.git ramips: mt7620: use OKLI loader with Jboot devices Jboot devices have problem with >2MB kernelsize. The only way to avoid this problem is use small loader. This patch switch all mt7620 Jboot devices to lzma OKLI loader. Suggested-by: Szabolcs Hubai Co-authored-by: Michael Pratt Signed-off-by: Pawel Dembicki --- diff --git a/target/linux/ramips/dts/mt7620a_dlink_dir-510l.dts b/target/linux/ramips/dts/mt7620a_dlink_dir-510l.dts index 2b8ad2759c..1d29bed6f0 100644 --- a/target/linux/ramips/dts/mt7620a_dlink_dir-510l.dts +++ b/target/linux/ramips/dts/mt7620a_dlink_dir-510l.dts @@ -4,6 +4,7 @@ #include #include +#include / { compatible = "dlink,dir-510l", "ralink,mt7620a-soc"; @@ -85,7 +86,9 @@ }; partition@210000 { - compatible = "amit,jimage"; + compatible = "openwrt,uimage", "denx,uimage"; + openwrt,ih-magic = ; + openwrt,offset = <0x10000>; label = "firmware"; reg = <0x210000 0xde0000>; }; diff --git a/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a1.dts b/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a1.dts index c63a85dd88..8ae566d448 100644 --- a/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a1.dts +++ b/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a1.dts @@ -4,6 +4,7 @@ #include #include +#include / { compatible = "dlink,dwr-118-a1", "ralink,mt7620a-soc"; @@ -106,7 +107,9 @@ }; partition@10000 { - compatible = "amit,jimage"; + compatible = "openwrt,uimage", "denx,uimage"; + openwrt,ih-magic = ; + openwrt,offset = <0x10000>; label = "firmware"; reg = <0x10000 0xfe0000>; }; diff --git a/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a2.dts b/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a2.dts index 711f9f7c9a..42f5c86160 100644 --- a/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a2.dts +++ b/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a2.dts @@ -2,6 +2,7 @@ #include #include +#include / { compatible = "dlink,dwr-118-a2", "ralink,mt7620a-soc"; @@ -103,7 +104,9 @@ }; partition@10000 { - compatible = "amit,jimage"; + compatible = "openwrt,uimage", "denx,uimage"; + openwrt,ih-magic = ; + openwrt,offset = <0x10000>; label = "firmware"; reg = <0x10000 0xfe0000>; }; diff --git a/target/linux/ramips/dts/mt7620a_dlink_dwr-960.dts b/target/linux/ramips/dts/mt7620a_dlink_dwr-960.dts index e80719a4e7..77b94a1190 100644 --- a/target/linux/ramips/dts/mt7620a_dlink_dwr-960.dts +++ b/target/linux/ramips/dts/mt7620a_dlink_dwr-960.dts @@ -4,6 +4,7 @@ #include #include +#include / { compatible = "dlink,dwr-960", "ralink,mt7620a-soc"; @@ -143,7 +144,9 @@ }; partition@10000 { - compatible = "amit,jimage"; + compatible = "openwrt,uimage", "denx,uimage"; + openwrt,ih-magic = ; + openwrt,offset = <0x10000>; label = "firmware"; reg = <0x10000 0xfe0000>; }; diff --git a/target/linux/ramips/dts/mt7620a_lava_lr-25g001.dts b/target/linux/ramips/dts/mt7620a_lava_lr-25g001.dts index 2c2e485f43..07355a05a5 100644 --- a/target/linux/ramips/dts/mt7620a_lava_lr-25g001.dts +++ b/target/linux/ramips/dts/mt7620a_lava_lr-25g001.dts @@ -2,6 +2,7 @@ #include #include +#include / { compatible = "lava,lr-25g001", "ralink,mt7620a-soc"; @@ -83,7 +84,9 @@ }; partition@10000 { - compatible = "amit,jimage"; + compatible = "openwrt,uimage", "denx,uimage"; + openwrt,ih-magic = ; + openwrt,offset = <0x10000>; label = "firmware"; reg = <0x10000 0xfe0000>; }; diff --git a/target/linux/ramips/dts/mt7620n_dlink_dwr-116-a1.dts b/target/linux/ramips/dts/mt7620n_dlink_dwr-116-a1.dts index d659262b0e..1c1a700630 100644 --- a/target/linux/ramips/dts/mt7620n_dlink_dwr-116-a1.dts +++ b/target/linux/ramips/dts/mt7620n_dlink_dwr-116-a1.dts @@ -2,6 +2,7 @@ #include #include +#include / { compatible = "dlink,dwr-116-a1", "ralink,mt7620n-soc"; @@ -69,7 +70,9 @@ }; partition@10000 { - compatible = "amit,jimage"; + compatible = "openwrt,uimage", "denx,uimage"; + openwrt,ih-magic = ; + openwrt,offset = <0x10000>; label = "firmware"; reg = <0x10000 0x7e0000>; }; diff --git a/target/linux/ramips/dts/mt7620n_dlink_dwr-921-c1.dts b/target/linux/ramips/dts/mt7620n_dlink_dwr-921-c1.dts index d37bdb4013..95a93ea4de 100644 --- a/target/linux/ramips/dts/mt7620n_dlink_dwr-921-c1.dts +++ b/target/linux/ramips/dts/mt7620n_dlink_dwr-921-c1.dts @@ -2,6 +2,7 @@ #include #include +#include / { compatible = "dlink,dwr-921-c1", "ralink,mt7620n-soc"; @@ -111,7 +112,9 @@ }; partition@10000 { - compatible = "amit,jimage"; + compatible = "openwrt,uimage", "denx,uimage"; + openwrt,ih-magic = ; + openwrt,offset = <0x10000>; label = "firmware"; reg = <0x10000 0xfe0000>; }; diff --git a/target/linux/ramips/dts/mt7620n_dlink_dwr-922-e2.dts b/target/linux/ramips/dts/mt7620n_dlink_dwr-922-e2.dts index d3ca0dd53f..22bff2c948 100644 --- a/target/linux/ramips/dts/mt7620n_dlink_dwr-922-e2.dts +++ b/target/linux/ramips/dts/mt7620n_dlink_dwr-922-e2.dts @@ -4,6 +4,7 @@ #include #include +#include / { compatible = "dlink,dwr-922-e2", "ralink,mt7620n-soc"; @@ -114,7 +115,9 @@ }; partition@10000 { - compatible = "amit,jimage"; + compatible = "openwrt,uimage", "denx,uimage"; + openwrt,ih-magic = ; + openwrt,offset = <0x10000>; label = "firmware"; reg = <0x10000 0xfe0000>; }; diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile index d523a62e0b..ac256cf1ae 100644 --- a/target/linux/ramips/image/Makefile +++ b/target/linux/ramips/image/Makefile @@ -89,6 +89,16 @@ define Build/mkdlinkfw-factory mv $@.new $@ endef +define Build/mkdlinkfw-loader + -$(STAGING_DIR_HOST)/bin/mkdlinkfw \ + -k $(KDIR)/loader-$(DEVICE_NAME).bin \ + -r $@ \ + -o $@.new \ + $(if $(DLINK_IMAGE_OFFSET), -O $(DLINK_IMAGE_OFFSET)) \ + -s $(DLINK_FIRMWARE_SIZE) + mv $@.new $@ +endef + define Build/netis-tail echo -n $(1) >> $@ echo -n $(UIMAGE_NAME)-yun | $(MKHASH) md5 | \ diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index 17a536e69f..fbf37144b9 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -61,13 +61,18 @@ TARGET_DEVICES += alfa-network_tube-e4g define Device/amit_jboot DLINK_IMAGE_OFFSET := 0x10000 - KERNEL := $(KERNEL_DTB) - KERNEL_SIZE := 2048k + KERNEL := $(KERNEL_DTB) | uImage lzma -M 0x4f4b4c49 + LOADER_FLASH_OFFS := 0x20000 + LOADER_TYPE := bin + COMPILE := loader-$(1).bin + COMPILE/loader-$(1).bin := loader-okli-compile | pad-to 64k | lzma | \ + pad-to 65480 IMAGES += factory.bin - IMAGE/sysupgrade.bin := mkdlinkfw | pad-rootfs | append-metadata - IMAGE/factory.bin := mkdlinkfw | pad-rootfs | mkdlinkfw-factory + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | mkdlinkfw-loader | \ + pad-rootfs | append-metadata + IMAGE/factory.bin := append-kernel | append-rootfs | mkdlinkfw-loader | \ + pad-rootfs | mkdlinkfw-factory DEVICE_PACKAGES := jboot-tools kmod-usb2 kmod-usb-ohci - DEFAULT := n endef define Device/asus_rp-n53 @@ -194,6 +199,7 @@ define Device/dlink_dir-510l $(Device/amit_jboot) SOC := mt7620a IMAGE_SIZE := 14208k + LOADER_FLASH_OFFS := 0x220000 DEVICE_VENDOR := D-Link DEVICE_MODEL := DIR-510L DEVICE_PACKAGES += kmod-mt76x0e