aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/boot
diff options
context:
space:
mode:
authorNicolas Pitre <nicolas.pitre@linaro.org>2011-02-20 22:57:38 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2011-02-26 08:39:51 -0500
commitd239b1dc093d551046a909920b5310c1d1e308c1 (patch)
treeeacba86f9a13fe7fd512219ef88755988dc09a20 /arch/arm/boot
parent6d7d0ae51574943bf571d269da3243257a2d15db (diff)
ARM: 6746/1: remove the 4x expansion presumption while decompressing the kernel
We currently presume a 4x expansion to guess the decompressed kernel size in order to determine if the decompressed kernel is in conflict with the location where zImage is loaded. This guess may cause many issues by overestimating the final kernel image size: - This may force a needless relocation if the location of zImage was fine, wasting some precious microseconds of boot time. - The relocation may be located way too far, possibly overwriting the initrd image in RAM. - If the kernel image includes a large already-compressed initramfs image then the problem is even more exacerbated. And if by some strange means the 4x guess is too low then we may overwrite ourselves with the decompressed image. So let's use the exact decompressed kernel image size instead. For that we need to rely on the stat command, but this is hardly a new build dependency as the kernel already depends on many external commands to be built provided by the coreutils package where stat is found. Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/boot')
-rw-r--r--arch/arm/boot/compressed/Makefile4
-rw-r--r--arch/arm/boot/compressed/vmlinux.lds.in3
2 files changed, 3 insertions, 4 deletions
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 0a8f748e506a..9d328be6e5e3 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -83,9 +83,11 @@ endif
83EXTRA_CFLAGS := -fpic -fno-builtin 83EXTRA_CFLAGS := -fpic -fno-builtin
84EXTRA_AFLAGS := -Wa,-march=all 84EXTRA_AFLAGS := -Wa,-march=all
85 85
86# Provide size of uncompressed kernel to the decompressor via a linker symbol.
87LDFLAGS_vmlinux := --defsym _image_size=$(shell stat -c "%s" $(obj)/../Image)
86# Supply ZRELADDR to the decompressor via a linker symbol. 88# Supply ZRELADDR to the decompressor via a linker symbol.
87ifneq ($(CONFIG_AUTO_ZRELADDR),y) 89ifneq ($(CONFIG_AUTO_ZRELADDR),y)
88LDFLAGS_vmlinux := --defsym zreladdr=$(ZRELADDR) 90LDFLAGS_vmlinux += --defsym zreladdr=$(ZRELADDR)
89endif 91endif
90ifeq ($(CONFIG_CPU_ENDIAN_BE8),y) 92ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
91LDFLAGS_vmlinux += --be8 93LDFLAGS_vmlinux += --be8
diff --git a/arch/arm/boot/compressed/vmlinux.lds.in b/arch/arm/boot/compressed/vmlinux.lds.in
index 366a924019ac..5309909d7282 100644
--- a/arch/arm/boot/compressed/vmlinux.lds.in
+++ b/arch/arm/boot/compressed/vmlinux.lds.in
@@ -43,9 +43,6 @@ SECTIONS
43 43
44 _etext = .; 44 _etext = .;
45 45
46 /* Assume size of decompressed image is 4x the compressed image */
47 _image_size = (_etext - _text) * 4;
48
49 _got_start = .; 46 _got_start = .;
50 .got : { *(.got) } 47 .got : { *(.got) }
51 _got_end = .; 48 _got_end = .;