kernel-fxtec-pro1x/arch/mips
Alexander Clouter 9c4a6fce20 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>
2010-01-28 00:03:30 +01:00
..
alchemy MIPS: Alchemy: Correct code taking the size of a pointer 2010-01-12 18:19:31 +01:00
ar7 MIPS: AR7: Remove unused prom_getchar() 2010-01-12 18:19:36 +01:00
bcm47xx MIPS: Replace all usages of CL_SIZE by COMMAND_LINE_SIZE 2009-12-17 01:56:56 +00:00
bcm63xx MIPS: BCM63xx: Remove duplicate CONFIG_CMDLINE. 2010-01-12 18:19:36 +01:00
boot MIPS: Fix vmlinuz build for 32bit-only math shells 2010-01-28 00:03:30 +01:00
cavium-octeon MIPS: Octeon: Use non-overflowing arithmetic in sched_clock 2010-01-12 18:19:36 +01:00
cobalt MIPS: Cobalt use strlcat() for the command line arguments 2010-01-12 18:19:34 +01:00
configs MIPS: Fix and enhance built-in kernel command line 2009-12-17 01:57:35 +00:00
dec Merge branch 'timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2009-09-18 09:15:24 -07:00
emma MIPS: Remove useless zero initializations. 2009-09-17 20:07:51 +02:00
fw MIPS: IP22: Remove an unused function 2009-12-17 01:56:56 +00:00
gt64120/wrppmc Update Yoichi Yuasa's e-mail address 2009-07-03 15:45:29 +01:00
include/asm MIPS: cpumask_of_node() should handle -1 as a node 2010-01-12 18:19:37 +01:00
jazz MIPS: Add IRQF_TIMER flag for timer interrupts 2009-11-02 12:00:02 +01:00
kernel MIPS: Cleanup random differences beween lmo and Linus' kernel. 2009-12-17 01:57:36 +00:00
lasat MIPS: Lasat: Fix botched changes to sysctl code. 2009-12-17 01:57:37 +00:00
lib MIPS: Fix __ndelay build error and add 'ull' suffix for 32-bit kernel 2009-06-17 11:06:24 +01:00
loongson MIPS: Loongson: Cleanups of serial port support 2009-12-17 01:57:34 +00:00
math-emu MIPS: Collect FPU emulator statistics per-CPU. 2009-12-17 01:57:08 +00:00
mipssim MIPS: Malta, PowerTV: Remove unnecessary "Linux started" 2010-01-12 18:19:36 +01:00
mm MIPS: Cleanup forgotten label_module_alloc in tlbex.c 2010-01-12 18:19:29 +01:00
mti-malta MIPS: Malta, PowerTV: Remove unnecessary "Linux started" 2010-01-12 18:19:36 +01:00
nxp MIPS: Fixup last users of irq_chip->typename 2009-12-17 01:57:21 +00:00
oprofile MIPS: oprofile: Only do performance counter handling for counter interrupts 2009-12-17 01:57:10 +00:00
pci MIPS: eXcite: Remove platform. 2009-12-17 01:57:35 +00:00
pmc-sierra cpumask: arch_send_call_function_ipi_mask: mips 2009-09-24 09:34:45 +09:30
power MIPS: Use PAGE_SIZE in assembly instead of _PAGE_SIZE. 2009-09-17 20:07:48 +02:00
powertv MIPS: Malta, PowerTV: Remove unnecessary "Linux started" 2010-01-12 18:19:36 +01:00
rb532 MIPS: Replace all usages of CL_SIZE by COMMAND_LINE_SIZE 2009-12-17 01:56:56 +00:00
sgi-ip22 MIPS: Move several variables from .bss to .init.data 2009-12-17 01:57:27 +00:00
sgi-ip27 mm: make totalhigh_pages unsigned long 2010-01-11 09:34:03 -08:00
sgi-ip32 MIPS: Move several variables from .bss to .init.data 2009-12-17 01:57:27 +00:00
sibyte MIPS: Replace all usages of CL_SIZE by COMMAND_LINE_SIZE 2009-12-17 01:56:56 +00:00
sni MIPS: Move several variables from .bss to .init.data 2009-12-17 01:57:27 +00:00
txx9 MIPS: TXx9: Cleanup builtin-cmdline processing 2010-01-12 18:19:34 +01:00
vr41xx MIPS: VR41xx: Use strlcat() for the command line arguments 2010-01-12 18:19:30 +01:00
Kconfig MIPS: Add support of LZO-compressed kernels 2010-01-28 00:03:30 +01:00
Kconfig.debug MIPS: Fix and enhance built-in kernel command line 2009-12-17 01:57:35 +00:00
Makefile MIPS: eXcite: Remove platform. 2009-12-17 01:57:35 +00:00