Message ID | 20200121205751.1810-1-freifunk@adrianschmutzler.de |
---|---|
State | Superseded |
Delegated to: | Adrian Schmutzler |
Headers | show |
Series | [OpenWrt-Devel] ath79: move lzma-loader to the end of available RAM | expand |
Hello Adrian, On 1/21/20 9:57 PM, Adrian Schmutzler wrote: > @@ -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) \ To me it seems the LZMA_TEXT_START argument is overwritten to the old value by explicit declaration in target/linux/ath79/image/lzma-loader/src/Makefile Best wishes David
Hi David, > -----Original Message----- > From: David Bauer [mailto:mail@david-bauer.net] > Sent: Dienstag, 21. Januar 2020 22:19 > To: Adrian Schmutzler <freifunk@adrianschmutzler.de> > Cc: openwrt-devel <openwrt-devel@lists.openwrt.org> > Subject: Re: [OpenWrt-Devel] [PATCH] ath79: move lzma-loader to the end > of available RAM > > Hello Adrian, > > On 1/21/20 9:57 PM, Adrian Schmutzler wrote: > > @@ -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) \ > > To me it seems the LZMA_TEXT_START argument is overwritten to the old > value by explicit declaration in > > target/linux/ath79/image/lzma-loader/src/Makefile We've tested it for the Mikrotik PR, and it works with my patch. I can't tell you why overwrite works this direction without further research though. Best Adrian > > Best wishes > David
Hi, On Tue, Jan 21, 2020 at 10:48:28PM +0100, mail@adrianschmutzler.de wrote: > I can't tell you why overwrite works this direction without further > research though. "If a variable has been set with a command argument (*note Overriding Variables: Overriding.), then ordinary assignments in the makefile are ignored." info make 6.7 The 'override' Directive -- Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software! mailto:fercerpav@gmail.com
>> To me it seems the LZMA_TEXT_START argument is overwritten to the old >> value by explicit declaration in >> >> target/linux/ath79/image/lzma-loader/src/Makefile > We've tested it for the Mikrotik PR, and it works with my patch. > I can't tell you why overwrite works this direction without further research though. However, effectively we currently set the value twice. Since lzma-loader/src/Makefile is target-dependent anyway, we might as well remove the "variables" from image/Makefile and just set them in lzma-loader/src/Makefile directly. I also still wonder whether it would be worth unifying the different variants of lzma-loader in ath79, ramips, brcm63xx and brcm47xx and generic. Best Adrian
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
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@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(-)