[OpenWrt-Devel] [PATCH] ath79: move lzma-loader to the end of available RAM

Adrian Schmutzler freifunk at adrianschmutzler.de
Tue Jan 21 15:57:51 EST 2020


In certain cases, the uncompressed initramfs image will overwrite
the lzma-loader, which is currently only 10 MB away from kernel image
start. To prevent this, change LZMA_TEXT_START to 24 MB, so loader
and compressed image have 8 MB at the end of RAM and uncompressed
image has 24 MB available.

This is only enabled for ath79 at the moment, as there we can be sure
that all devices have 32+ MB RAM and TARGET_INITRAMFS_COMPRESSION_LZMA
is not enabled there.

While at it, use the KERNEL_LOADADDR variable in loader-common and
add a variable for the lzma start offset as well.

Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>

---

I plan to take care of other targets, too, and maybe provide a generic
loader-common, but for now this is limited to ath79 so we can support
the mikrotik devices there.

---
 target/linux/ath79/image/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/target/linux/ath79/image/Makefile b/target/linux/ath79/image/Makefile
index 34bd0a2490..34a0934c66 100644
--- a/target/linux/ath79/image/Makefile
+++ b/target/linux/ath79/image/Makefile
@@ -2,6 +2,7 @@ include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/image.mk
 
 KERNEL_LOADADDR = 0x80060000
+LOADER_LZMA_START = 0x81800000
 
 DEVICE_VARS += IMAGE_SIZE LOADER_FLASH_OFFS LOADER_TYPE
 
@@ -10,7 +11,7 @@ define Build/loader-common
 	$(MAKE) -C lzma-loader \
 		PKG_BUILD_DIR="$@.src" \
 		TARGET_DIR="$(dir $@)" LOADER_NAME="$(notdir $@)" \
-		LZMA_TEXT_START=0x80a00000 LOADADDR=0x80060000 \
+		LZMA_TEXT_START=$(LOADER_LZMA_START) LOADADDR=$(KERNEL_LOADADDR) \
 		$(1) compile loader.$(LOADER_TYPE)
 	mv "$@.$(LOADER_TYPE)" "$@"
 	rm -rf $@.src
-- 
2.20.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list