linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: nicolas.pitre@linaro.org (Nicolas Pitre)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] ARM: zImage: no need to get the decompressed size from the filesystem
Date: Wed, 20 Apr 2011 00:15:02 -0400	[thread overview]
Message-ID: <1303272904-31392-2-git-send-email-nicolas.pitre@linaro.org> (raw)
In-Reply-To: <1303272904-31392-1-git-send-email-nicolas.pitre@linaro.org>

In commit d239b1dc093d the hardcoded 4x estimate for the decompressed
kernel size was replaced by the exact Image file size and passed to
the linker as a symbol value.  Turns out that this is unneeded as the
size is already included at the end of the compressed piggy data.
For those compressed formats that don't include this data, the build
system already takes care of appending it using size_append in
scripts/Makefile.lib.  So let's use that instead.

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/boot/compressed/Makefile |    2 --
 arch/arm/boot/compressed/head.S   |   18 ++++++++++++++++--
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 8ebbb51..58ac434 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -98,8 +98,6 @@ endif
 ccflags-y := -fpic -fno-builtin
 asflags-y := -Wa,-march=all
 
-# Provide size of uncompressed kernel to the decompressor via a linker symbol.
-LDFLAGS_vmlinux = --defsym _image_size=$(shell stat -c "%s" $(obj)/../Image)
 # Supply ZRELADDR to the decompressor via a linker symbol.
 ifneq ($(CONFIG_AUTO_ZRELADDR),y)
 LDFLAGS_vmlinux += --defsym zreladdr=$(ZRELADDR)
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index adf583c..c74f048 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -179,7 +179,7 @@ not_angel:
 		bl	cache_on
 
 restart:	adr	r0, LC0
-		ldmia	r0, {r1, r2, r3, r5, r6, r9, r11, r12}
+		ldmia	r0, {r1, r2, r3, r5, r6, r10, r11, r12}
 		ldr	sp, [r0, #32]
 
 		/*
@@ -189,7 +189,21 @@ restart:	adr	r0, LC0
 		sub	r0, r0, r1		@ calculate the delta offset
 		add	r5, r5, r0		@ _start
 		add	r6, r6, r0		@ _edata
+		add	r10, r10, r0		@ inflated kernel size location
 
+		/*
+		 * The kernel build system appends the size of the
+		 * decompressed kernel at the end of the compressed data
+		 * in little-endian form.
+		 */
+		ldrb	r9, [r10, #0]
+		ldrb	lr, [r10, #1]
+		orr	r9, r9, lr, lsl #8
+		ldrb	lr, [r10, #2]
+		ldrb	r10, [r10, #3]
+		orr	r9, r9, lr, lsl #16
+		orr	r9, r9, r10, lsl #24
+		
 #ifndef CONFIG_ZBOOT_ROM
 		/* malloc space is above the relocated stack (64k max) */
 		add	sp, sp, r0
@@ -335,7 +349,7 @@ LC0:		.word	LC0			@ r1
 		.word	_end			@ r3
 		.word	_start			@ r5
 		.word	_edata			@ r6
-		.word	_image_size		@ r9
+		.word	input_data_end - 4	@ r9 (inflated size location)
 		.word	_got_start		@ r11
 		.word	_got_end		@ ip
 		.word	user_stack_end		@ sp
-- 
1.7.4

  reply	other threads:[~2011-04-20  4:15 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-20  4:15 [PATCH 0/3] fix some issues with the kernel decompressor Nicolas Pitre
2011-04-20  4:15 ` Nicolas Pitre [this message]
2011-04-21 12:47   ` [PATCH 1/3] ARM: zImage: no need to get the decompressed size from the filesystem Tony Lindgren
2011-04-20  4:15 ` [PATCH 2/3] ARM: compressed/misc.c: simplify decompress_kernel() Nicolas Pitre
2011-04-21 12:49   ` Tony Lindgren
2011-04-27  8:53   ` Russell King - ARM Linux
2011-04-27 14:48     ` Nicolas Pitre
2011-04-28  8:12       ` Russell King - ARM Linux
2011-04-28  8:17       ` Tony Lindgren
2011-04-28 18:20         ` Nicolas Pitre
2011-04-29  7:17           ` Tony Lindgren
2011-04-20  4:15 ` [PATCH 3/3] ARM: zImage: fix issues with missing GOT entries for some global variables Nicolas Pitre
2011-04-20  8:42   ` Uwe Kleine-König
2011-04-20  9:19     ` Shawn Guo
2011-04-20 12:28     ` Nicolas Pitre
2011-04-20 12:36       ` Uwe Kleine-König
2011-04-20 12:47         ` Nicolas Pitre
2011-04-27  8:58           ` Russell King - ARM Linux
2011-04-27 15:00             ` Nicolas Pitre
2011-04-20 12:52       ` Shawn Guo
2011-04-20 13:03         ` Nicolas Pitre
2011-04-20 13:17           ` Nicolas Pitre
2011-04-21 12:50   ` Tony Lindgren
2011-04-27  8:55   ` Russell King - ARM Linux
2011-04-27 14:55     ` Nicolas Pitre
2011-04-20  7:21 ` [PATCH 0/3] fix some issues with the kernel decompressor Tony Lindgren
2011-04-20 13:00   ` Nicolas Pitre
2011-04-20 16:55     ` Tony Lindgren
2011-04-20 17:19       ` Nicolas Pitre
2011-04-21  5:59         ` Tony Lindgren
2011-04-21 10:49           ` [PATCH] ARM: Fix relocation if image end past uncompressed kernel end Tony Lindgren
2011-04-21 13:22             ` Nicolas Pitre
2011-04-21 21:26               ` Nicolas Pitre
2011-04-22  3:23                 ` Nicolas Pitre
2011-04-22  5:19                   ` Shawn Guo
2011-04-22  5:36                     ` Shawn Guo
2011-04-22  6:28                   ` Tony Lindgren
2011-04-22 14:12                     ` Nicolas Pitre
2011-04-26  8:57                       ` Tony Lindgren
2011-04-26 12:37                         ` [PATCH] ARM: Fix bad SP address after relocating kernel Tony Lindgren
2011-04-26 21:31                           ` Nicolas Pitre
2011-04-27  7:48                             ` Tony Lindgren
2011-04-22  6:09               ` [PATCH] ARM: Fix relocation if image end past uncompressed kernel end Tony Lindgren
2011-04-27 12:47               ` Tony Lindgren
2011-04-27 12:56                 ` Tony Lindgren
2011-04-27 22:16                   ` Nicolas Pitre
2011-04-28  6:38                     ` Tony Lindgren
2011-04-28  8:12                       ` Tony Lindgren
2011-04-20 11:16 ` [PATCH 0/3] fix some issues with the kernel decompressor Shawn Guo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1303272904-31392-2-git-send-email-nicolas.pitre@linaro.org \
    --to=nicolas.pitre@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).