[PATCH 05/06] sh: Use dynamic zImage load address

Magnus Damm magnus.damm at gmail.com
Tue Aug 26 07:12:25 EDT 2008


From: Magnus Damm <damm at igel.co.jp>

Dynamically calculate SuperH zImage load address instead of hardcoding.

Signed-off-by: Magnus Damm <damm at igel.co.jp>
---

 kexec/arch/sh/kexec-zImage-sh.c |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

--- 0005/kexec/arch/sh/kexec-zImage-sh.c
+++ work/kexec/arch/sh/kexec-zImage-sh.c	2008-08-22 13:04:13.000000000 +0900
@@ -79,7 +79,8 @@ int zImage_sh_load(int argc, char **argv
 {
         char *command_line;
 	int opt, k;
-	unsigned long empty_zero, area, zero_page_base, zero_page_size;
+	unsigned long empty_zero, zero_page_base, zero_page_size;
+	unsigned long image_base;
 	char *param;
 
 	static const struct option options[] = {
@@ -137,8 +138,12 @@ int zImage_sh_load(int argc, char **argv
 	add_segment(info, param, zero_page_size,
 		    0x80000000 | zero_page_base, zero_page_size);
 
-	area = empty_zero & 0x1c000000;
-	add_segment(info, buf,   len,  (area | 0x80210000), len);
-	info->entry = (void *)(0x80210000 | area);
+	/* load image a bit above the zero page, round up to 64k
+	 * the zImage will relocate itself, but only up seems supported.
+	 */
+
+	image_base = (empty_zero + (0x10000 - 1)) & ~(0x10000 - 1);
+	add_segment(info, buf, len, image_base, len);
+	info->entry = (void *)image_base;
 	return 0;
 }



More information about the kexec mailing list