r3193 - branches/src/target/kernel/2.6.23.x/patches
shoragan at sita.openmoko.org
shoragan at sita.openmoko.org
Tue Oct 16 17:43:35 CEST 2007
Author: shoragan
Date: 2007-10-16 17:43:33 +0200 (Tue, 16 Oct 2007)
New Revision: 3193
Added:
branches/src/target/kernel/2.6.23.x/patches/arm-atag-kexec.patch
Modified:
branches/src/target/kernel/2.6.23.x/patches/series
Log:
Follow change in 2.6.22:
(orig r3169): laforge | 2007-10-15 11:07:35 +0200
Add patch to fix kexec() on ARM machines that need the ATAG structure to be
passed from the bootloader in order to properly boot. (Closes:
http://bugzilla.openmoko.org/cgi-bin/bugzilla/show_bug.cgi?id=930)
Added: branches/src/target/kernel/2.6.23.x/patches/arm-atag-kexec.patch
===================================================================
--- branches/src/target/kernel/2.6.23.x/patches/arm-atag-kexec.patch 2007-10-16 15:27:57 UTC (rev 3192)
+++ branches/src/target/kernel/2.6.23.x/patches/arm-atag-kexec.patch 2007-10-16 15:43:33 UTC (rev 3193)
@@ -0,0 +1,145 @@
+This patch resolves a kexec boot failure that can occur because
+no ATAGs are passed in to the kexec'd kernel. Currently the
+newly-kexec'd kernel may fail if it requires specific ATAGs, or
+it may fail because the fixed memory location at which it expects
+to find the ATAGs may contain random data instead of ATAGs.
+
+The patch ensures that any ATAGs passed to the current kernel
+at boot time are copied to a static buffer, and are copied back
+when kexec copies the new kernel into place. Thus the new
+kernel sees the same ATAGs from kexec and the boot loader.
+
+The boot parameters are copied without regard to type, content,
+or length -- this patch's scope is limited soley to saving and
+restoring a fixed-size block of memory containing the kernel's
+boot parameters. Additional functionality to examine, alter, or
+replace the ATAGs (using kexec, for example) can be implemented
+by manipulating the static buffer containing the preserved ATAGs.
+
+Note: the size of the buffer (1.5KB) is selected to comfortably
+hold one of each ATAG type, including a maximum-length command
+line and the maximum number of ATAG_MEM structures currently
+supported by the kernel. Should an ATAG list exceed that limit,
+the list will be silently truncated to that limit (to do other-
+wise at that point in the boot process would make a simple
+problem exceedingly complicated).
+
+Kernel version 2.6.22.5
+
+Signed-off-by: Mike Westerhof <mwester at dls.net>
+---
+
+diff -uprN linux-2.6.22.5.orig/arch/arm/kernel/relocate_kernel.S linux-2.6.22.5/arch/arm/kernel/relocate_kernel.S
+--- linux-2.6.22.5.orig/arch/arm/kernel/relocate_kernel.S 2007-08-22 18:23:54.000000000 -0500
++++ linux-2.6.22.5/arch/arm/kernel/relocate_kernel.S 2007-08-27 20:31:32.000000000 -0500
+@@ -7,6 +7,23 @@
+ .globl relocate_new_kernel
+ relocate_new_kernel:
+
++ /* Move boot params back to where the kernel expects them */
++
++ ldr r0,kexec_boot_params_address
++ teq r0,#0
++ beq 8f
++
++ ldr r1,kexec_boot_params_copy
++ mov r6,#KEXEC_BOOT_PARAMS_SIZE/4
++7:
++ ldr r5,[r1],#4
++ str r5,[r0],#4
++ subs r6,r6,#1
++ bne 7b
++
++8:
++ /* Boot params moved, now go on with the kernel */
++
+ ldr r0,kexec_indirection_page
+ ldr r1,kexec_start_address
+
+@@ -50,7 +67,7 @@ relocate_new_kernel:
+ mov lr,r1
+ mov r0,#0
+ ldr r1,kexec_mach_type
+- mov r2,#0
++ ldr r2,kexec_boot_params_address
+ mov pc,lr
+
+ .globl kexec_start_address
+@@ -65,6 +82,16 @@ kexec_indirection_page:
+ kexec_mach_type:
+ .long 0x0
+
++ /* phy addr where new kernel will expect to find boot params */
++ .globl kexec_boot_params_address
++kexec_boot_params_address:
++ .long 0x0
++
++ /* phy addr where old kernel put a copy of orig boot params */
++ .globl kexec_boot_params_copy
++kexec_boot_params_copy:
++ .long 0x0
++
+ relocate_new_kernel_end:
+
+ .globl relocate_new_kernel_size
+diff -uprN linux-2.6.22.5.orig/arch/arm/kernel/setup.c linux-2.6.22.5/arch/arm/kernel/setup.c
+--- linux-2.6.22.5.orig/arch/arm/kernel/setup.c 2007-08-22 18:23:54.000000000 -0500
++++ linux-2.6.22.5/arch/arm/kernel/setup.c 2007-08-27 20:31:32.000000000 -0500
+@@ -23,6 +23,7 @@
+ #include <linux/cpu.h>
+ #include <linux/interrupt.h>
+ #include <linux/smp.h>
++#include <linux/kexec.h>
+
+ #include <asm/cpu.h>
+ #include <asm/elf.h>
+@@ -767,6 +768,23 @@ static int __init customize_machine(void
+ }
+ arch_initcall(customize_machine);
+
++#ifdef CONFIG_KEXEC
++
++/* Physical addr of where the boot params should be for this machine */
++extern unsigned long kexec_boot_params_address;
++
++/* Physical addr of the buffer into which the boot params are copied */
++extern unsigned long kexec_boot_params_copy;
++
++/* Pointer to the boot params buffer, for manipulation and display */
++unsigned long kexec_boot_params;
++EXPORT_SYMBOL(kexec_boot_params);
++
++/* The buffer itself - make sure it is sized correctly */
++static unsigned long kexec_boot_params_buf[(KEXEC_BOOT_PARAMS_SIZE + 3) / 4];
++
++#endif
++
+ void __init setup_arch(char **cmdline_p)
+ {
+ struct tag *tags = (struct tag *)&init_tags;
+@@ -783,6 +801,13 @@ void __init setup_arch(char **cmdline_p)
+ if (mdesc->boot_params)
+ tags = phys_to_virt(mdesc->boot_params);
+
++#ifdef CONFIG_KEXEC
++ kexec_boot_params_address = mdesc->boot_params;
++ kexec_boot_params_copy = virt_to_phys(kexec_boot_params_buf);
++ kexec_boot_params = (unsigned long)kexec_boot_params_buf;
++ if (mdesc->boot_params)
++ memcpy((void *)kexec_boot_params, tags, KEXEC_BOOT_PARAMS_SIZE);
++#endif
+ /*
+ * If we have the old style parameters, convert them to
+ * a tag list.
+diff -uprN linux-2.6.22.5.orig/include/asm-arm/kexec.h linux-2.6.22.5/include/asm-arm/kexec.h
+--- linux-2.6.22.5.orig/include/asm-arm/kexec.h 2007-08-22 18:23:54.000000000 -0500
++++ linux-2.6.22.5/include/asm-arm/kexec.h 2007-08-27 20:31:32.000000000 -0500
+@@ -14,6 +14,8 @@
+
+ #define KEXEC_ARCH KEXEC_ARCH_ARM
+
++#define KEXEC_BOOT_PARAMS_SIZE 1536
++
+ #ifndef __ASSEMBLY__
+
+ struct kimage;
Modified: branches/src/target/kernel/2.6.23.x/patches/series
===================================================================
--- branches/src/target/kernel/2.6.23.x/patches/series 2007-10-16 15:27:57 UTC (rev 3192)
+++ branches/src/target/kernel/2.6.23.x/patches/series 2007-10-16 15:43:33 UTC (rev 3193)
@@ -1,3 +1,4 @@
+arm-atag-kexec.patch
asoc-platform-hw_init-pcm_emulation-fix.patch
asoc-kconfig-fix.patch
asoc-neo1973_wm8753-power.patch
More information about the commitlog
mailing list