[OpenWrt-Devel] [PATCH RFT] ramips: mt7621: use lzma-loader for all devices

Chuanhong Guo gch981213 at gmail.com
Tue Apr 14 02:44:38 EDT 2020

With current kernel reaching 5MB uncompressed, several devices failed
to boot. They either fails on lzma decompression or ends up with a
corrupted kernel image. We already faced this problem two years ago
and it was solved by limiting LZMA dictionary size. Our own lzma-loader
extracts data without this limit just fine and lifting this limit saves
15KB kernel space when compressed.
mediatek u-boot 1.1.3 comes with support for uncompressed uimage by
default and ideally no vendor bother to remove this support.
This commit uses uncompressed uimage with lzma-loader for all mt7621
devices with default kernel template.

Signed-off-by: Chuanhong Guo <gch981213 at gmail.com>

D-Link DIR-860L B1 needs a different loader implementation and isn't
covered by this patch.
Please help testing this patch on top of current master:
75f19deb3a ramips: define image recipe for uncompressed uimage with loader
1. If your device fails to boot after 5.4 switch for mt7621:
     Is the problem fixed by this patch?
2. Other devices:
     Does this patch break your router?

Thanks in advance!

 target/linux/ramips/image/Makefile  | 4 ++++
 target/linux/ramips/image/mt7621.mk | 1 -
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile
index a966ba4349..1fb37d7c6c 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -27,7 +27,11 @@ LOADER_PLATFORM := $(ldrplatform-y)
 KERNEL_DTB = kernel-bin | append-dtb | lzma
 define Device/Default
   PROFILES = Default
+ifeq ($(SUBTARGET),mt7621)
+  $(Device/uimage-lzma-loader)
   KERNEL := $(KERNEL_DTB) | uImage lzma
   DEVICE_DTS_DIR := ../dts
   DEVICE_DTS = $$(SOC)_$(1)
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index 8980ff70d4..942308c29a 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -6,7 +6,6 @@ include ./common-tp-link.mk
 DEFAULT_SOC := mt7621
-KERNEL_DTB += -d21
 # The OEM webinterface expects an kernel with initramfs which has the uImage

openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list