aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/boot/compressed
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/boot/compressed')
-rw-r--r--arch/arm/boot/compressed/Makefile3
-rw-r--r--arch/arm/boot/compressed/head.S19
2 files changed, 18 insertions, 4 deletions
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 0c74a6fab952..4867647b9796 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -104,6 +104,9 @@ endif
104ccflags-y := -fpic -fno-builtin 104ccflags-y := -fpic -fno-builtin
105asflags-y := -Wa,-march=all 105asflags-y := -Wa,-march=all
106 106
107# Supply kernel BSS size to the decompressor via a linker symbol.
108KBSS_SZ = $(shell size $(obj)/../../../../vmlinux | awk 'END{print $$3}')
109LDFLAGS_vmlinux = --defsym _kernel_bss_size=$(KBSS_SZ)
107# Supply ZRELADDR to the decompressor via a linker symbol. 110# Supply ZRELADDR to the decompressor via a linker symbol.
108ifneq ($(CONFIG_AUTO_ZRELADDR),y) 111ifneq ($(CONFIG_AUTO_ZRELADDR),y)
109LDFLAGS_vmlinux += --defsym zreladdr=$(ZRELADDR) 112LDFLAGS_vmlinux += --defsym zreladdr=$(ZRELADDR)
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 3ce5738ddb98..ba5c552f8c69 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -248,6 +248,18 @@ restart: adr r0, LC0
248 248
249 mov r8, r6 @ use the appended device tree 249 mov r8, r6 @ use the appended device tree
250 250
251 /*
252 * Make sure that the DTB doesn't end up in the final
253 * kernel's .bss area. To do so, we adjust the decompressed
254 * kernel size to compensate if that .bss size is larger
255 * than the relocated code.
256 */
257 ldr r5, =_kernel_bss_size
258 adr r1, wont_overwrite
259 sub r1, r6, r1
260 subs r1, r5, r1
261 addhi r9, r9, r1
262
251 /* Get the dtb's size */ 263 /* Get the dtb's size */
252 ldr r5, [r6, #4] 264 ldr r5, [r6, #4]
253#ifndef __ARMEB__ 265#ifndef __ARMEB__
@@ -276,15 +288,14 @@ dtb_check_done:
276 * r10 = end of this image, including bss/stack/malloc space if non XIP 288 * r10 = end of this image, including bss/stack/malloc space if non XIP
277 * We basically want: 289 * We basically want:
278 * r4 - 16k page directory >= r10 -> OK 290 * r4 - 16k page directory >= r10 -> OK
279 * r4 + image length <= current position (pc) -> OK 291 * r4 + image length <= address of wont_overwrite -> OK
280 */ 292 */
281 add r10, r10, #16384 293 add r10, r10, #16384
282 cmp r4, r10 294 cmp r4, r10
283 bhs wont_overwrite 295 bhs wont_overwrite
284 add r10, r4, r9 296 add r10, r4, r9
285 ARM( cmp r10, pc ) 297 adr r9, wont_overwrite
286 THUMB( mov lr, pc ) 298 cmp r10, r9
287 THUMB( cmp r10, lr )
288 bls wont_overwrite 299 bls wont_overwrite
289 300
290/* 301/*