diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2018-06-06 20:51:05 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2018-06-06 22:27:59 +0200 |
commit | e5301885bc9772f0e5ca5b3870b2c43824e12546 (patch) | |
tree | d85224ce2a2efc766a848702f231563f2412155a /target | |
parent | 023944853241920c20842c0f4649d1dd4e7e273b (diff) | |
download | mtk-20170518-e5301885bc9772f0e5ca5b3870b2c43824e12546.zip mtk-20170518-e5301885bc9772f0e5ca5b3870b2c43824e12546.tar.gz mtk-20170518-e5301885bc9772f0e5ca5b3870b2c43824e12546.tar.bz2 |
ar71xx: lzma-loader: move padding workaround to gzip step
Some devices (TP-Link TL-WR1043ND v1) don't boot reliably when the
uncompressed loader is too small. This was workarounded in the loader by
adding 512KB of padding to the .data section of the loader binary.
This approach had two issues:
- The padding was only working when .data was non-empty (otherwise the
section would become NOBITS, omitting it in the binary). .data was only
empty when no CMDLINE was set, leading to further workarounds like
fe594bf90d09 ("ath79: fix loader-okli, lzma-loader"), and this
workaround was only effective because a missing "const" led to the kernel
argv being stored in .data instead of .rodata
- The padding was not only added to the compressed .gz loader, but also
uncompressed .bin and .elf loaders. The prevented embedding the kernel
cmdline in the loader for non-gz loader types.
To fix both issues, move the creation of the padding from the linker script
to the gzip step.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Diffstat (limited to 'target')
-rw-r--r-- | target/linux/ar71xx/image/lzma-loader/Makefile | 6 | ||||
-rw-r--r-- | target/linux/ar71xx/image/lzma-loader/src/loader.lds | 1 |
2 files changed, 5 insertions, 2 deletions
diff --git a/target/linux/ar71xx/image/lzma-loader/Makefile b/target/linux/ar71xx/image/lzma-loader/Makefile index 9b81e87..738093a 100644 --- a/target/linux/ar71xx/image/lzma-loader/Makefile +++ b/target/linux/ar71xx/image/lzma-loader/Makefile @@ -47,7 +47,11 @@ loader-compile: $(PKG_BUILD_DIR)/.prepared clean all loader.gz: $(PKG_BUILD_DIR)/loader.bin - gzip -nc9 $< > $(LOADER_GZ) + # Workaround for buggy bootloaders: Some devices + # (TP-Link TL-WR1043ND v1) don't work correctly when + # the uncompressed loader is too small (probably a cache + # invalidation issue) + dd if=$< bs=512K conv=sync | gzip -nc9 > $(LOADER_GZ) loader.elf: $(PKG_BUILD_DIR)/loader.elf $(CP) $< $(LOADER_ELF) diff --git a/target/linux/ar71xx/image/lzma-loader/src/loader.lds b/target/linux/ar71xx/image/lzma-loader/src/loader.lds index 80cc7ca..01ff852 100644 --- a/target/linux/ar71xx/image/lzma-loader/src/loader.lds +++ b/target/linux/ar71xx/image/lzma-loader/src/loader.lds @@ -13,7 +13,6 @@ SECTIONS { .data : { *(.data) *(.data.*) - . = . + 524288; /* workaround for buggy bootloaders */ } . = ALIGN(32); |