diff options
author | Alexander Clouter <alex@digriz.org.uk> | 2010-01-20 20:50:07 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2010-01-28 00:03:30 +0100 |
commit | 9c4a6fce2032fcb5bb8339d53fd3dadfd7ddfb98 (patch) | |
tree | 97bc1532be75bc9faa9574b70be283555e641063 /arch/mips/pci | |
parent | fe1d45e08650213ec83a72d3499c3dd703243792 (diff) | |
download | kernel_samsung_espresso10-9c4a6fce2032fcb5bb8339d53fd3dadfd7ddfb98.zip kernel_samsung_espresso10-9c4a6fce2032fcb5bb8339d53fd3dadfd7ddfb98.tar.gz kernel_samsung_espresso10-9c4a6fce2032fcb5bb8339d53fd3dadfd7ddfb98.tar.bz2 |
MIPS: Fix vmlinuz build for 32bit-only math shells
POSIX requires $((<expression>)) arithmetic in sh only to have long
arithmetic so on 32-bit sh binaries might do only 32-bit arithmetic but
the arithmetic done in arch/mips/boot/compressed/Makefile needs 64-bit.
I play with the AR7 platform, so VMLINUX_LOAD_ADDRESS is
0xffffffff94100000, and for an example 4MiB kernel
VMLINUZ_LOAD_ADDRESS is made out to be:
----
alex@berk:~$ bash -c 'printf "%x\n" $((0xffffffff94100000 + 0x400000))'
ffffffff94500000
alex@berk:~$ dash -c 'printf "%x\n" $((0xffffffff94100000 + 0x400000))'
80000000003fffff
----
The former is obviously correct whilst the later breaks things royally.
Fortunately working with only the lower 32bit's works for both bash and
dash:
----
$ bash -c 'printf "%x\n" $((0x94100000 + 0x400000))'
94500000
$ dash -c 'printf "%x\n" $((0x94100000 + 0x400000))'
94500000
----
So, we can split the original 64bit string to two parts, and only
calculate the low 32bit part, which is big enough (1GiB kernel sizes
anyone?) for a normal Linux kernel image file, now, we calculate the
VMLINUZ_LOAD_ADDRESS like this:
1. if present, append top 32bit of VMLINUX_LOAD_ADDRESS" as a prefix
2. get the sum of the low 32bit of VMLINUX_LOAD_ADDRESS + VMLINUX_SIZE
This patch fixes vmlinuz kernel builds on systems where only a
32bit-only math shell is available.
Patch Changelog:
Version 2
- simplified method by using 'expr' for 'substr' and making it work
with dash once again
Version 1
- Revert the removals of '-n "$(VMLINUX_SIZE)"' to avoid the error
of "make clean"
- Consider more cases of the VMLINUX_LOAD_ADDRESS
Version 0
- initial release
Signed-off-by: Alexander Clouter <alex@digriz.org.uk>
Acked-by: Wu Zhangjin <wuzhangjin@gmail.com>
Patchwork: http://patchwork.linux-mips.org/patch/861/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/pci')
0 files changed, 0 insertions, 0 deletions