Commit Graph

14 Commits (ecea10f2b9955d04b6806842976bb9e2b4afca3f)

Author SHA1 Message Date
Matthias Schiffer 9968dcedb4
ar71xx: lzma-loader: constify kernel argv array
By making the kernel argv array const, the .data section can always be
omitted from the laoder binary.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
6 years ago
Matthias Schiffer 8d851a95b7
ar71xx: lzma-loader: set page size to 4KB
The text section in the ELF loader is aligned to the maximum page size,
which defaults to 64KB. Reduce it to the actual page size to avoid wasting
flash space for this alignment.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
6 years ago
Matthias Schiffer a28e46b7cc
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
  fe594bf90d ("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>
6 years ago
Jonas Gorski eeeee885fb ar71xx: fix lzma-loader build with glibc
For an unknown reason gcc tries to link in crti.o when building with a
glibc toolchain (this does not happen with other targets). Prevent this
by telling gcc explicitly to not do that.

Fixes the following build error:

/home/jonas/git/lede/staging_dir/toolchain-mips_24kc_gcc-5.5.0_glibc/lib/gcc/mips-openwrt-linux-gnu/5.5.0/../../../../mips-openwrt-linux-gnu/lib/crti.o: In function `_init':
(.init+0x18): relocation truncated to fit: R_MIPS_GOT16 against `__gmon_start__'
/home/jonas/git/lede/staging_dir/toolchain-mips_24kc_gcc-5.5.0_glibc/lib/gcc/mips-openwrt-linux-gnu/5.5.0/../../../../mips-openwrt-linux-gnu/lib/crti.o: In function `_init':
(.init+0x28): relocation truncated to fit: R_MIPS_CALL16 against `__gmon_start__'
collect2: error: ld returned 1 exit status

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
7 years ago
Julien Dusser 8d9ff6b6f7 ar71xx: lzma loader use LTO
Change the Makefile to use LTO for better code optimisations. Gains are
very low, only 270 bytes saved, but it's only Makefile changes.

Signed-off-by: Julien Dusser <julien.dusser@free.fr>
7 years ago
Julien Dusser 8c5702f2a0 ar71xx: fix lzma loader performance issues
Some bootloaders set a cache cohenrency to a very slow mode. Use code from
Linux kernel to set it to "Cacheable, noncoherent, write-back, write
allocate".

Perfomance impact is significant on TP-Link EAP245 board, kernel
decompression time fall from 33 seconds to less than 1.

Signed-off-by: Julien Dusser <julien.dusser@free.fr>
7 years ago
Gabor Juhos 55b0e261a4 ar71xx/lzma-loader: fix O32 ABI conformance
According to the calling convention of the o32 ABI the caller
function must reserve stack space for $a0-$a3 registers in case
the callee needs to save its arguments.

The assembly code of the loader does not reserve stack space for
these registers thus when the 'loader_main' function needs to save
its arguments, those will be stored in the 'workspace' area instead
of the stack.

Because the workspace area is also used by other part of the code, the
saved register values gets overwritten and this often leads to failed
kernel boots.

Fix the code to reserve stack space for the registers to avoid this
error.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 48279
9 years ago
Felix Fietkau ef215468f1 ar71xx: ensure that LOADADDR is passed to lzma-loader
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 48101
9 years ago
Hauke Mehrtens e1ec8b76e9 ar71xx: fix build of lzma-loader with binutils 2.25.1
To make the lzma-loader build with binutils 2.25.1 it is needed to
remove the .MIPS.abiflags section otherwise I get the following compile
error:

mips-openwrt-linux-musl-objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S loader loader.bin
mips-openwrt-linux-musl-objcopy: Warning: Writing section `.text' to huge (ie negative) file offset 0xffffffff80a00000.
mips-openwrt-linux-musl-objcopy:loader.bin[.text]: File truncated

This should close #20487.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>

SVN-Revision: 46893
9 years ago
Felix Fietkau 320aa30609 ar71xx: fix lzma-loader kernel command line passing
The generic kernel cmdline parser ignores argv[0], this caused a
regression for all lzma-loader based boards with linux 4.1

Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 46544
9 years ago
Gabor Juhos 97867f8717 ar71xx/image: relink loader.elf image to LOADADDR
This allows to load the resulting image directly
from RouterBOOT.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 34271
12 years ago
Gabor Juhos b873051706 ar71xx: image: stop the switch from the lzma-loader on the TL-WR1043ND
SVN-Revision: 32946
12 years ago
Gabor Juhos e29d6bec6f ar71xx: image: allow to use board specific code in the lzma-loader
SVN-Revision: 32945
12 years ago
Gabor Juhos d42968351f ar71xx: add lzma loader
SVN-Revision: 29443
13 years ago