diff options
author | Milton Miller <miltonm@bga.com> | 2009-01-02 15:04:42 -0600 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2009-01-16 09:41:05 +1100 |
commit | 79c650e757561b03163da73dfc367f702248ef98 (patch) | |
tree | 0ec07bffcd15fc82242ff9bc553ebcb023999ec2 /kexec | |
parent | e8f2de09b52c3f4e23f907a6f6bf837b1f45af50 (diff) |
ppc64: update kdump for 2.6.28 relocatable kernel
The kernel updated its ABI to tell the relocatable kernel to run
where it was loaded.
We now need to set a flag in the kernel image. Since we only have
the kernel image avialable as const data to kexec-tools c code, set
the flag in the copy we put in purgatory, and have it set the flag
in the kernel (after purgatory has run its checksum). To simplfy
the purgatory code we can always copy the flag word back to the
kernel as the c code made a copy of the original flag value.
Signed-off-by: Milton Miller <miltonm@bga.com>
Tested-by: M. Mohan Kumar <mohan@in.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec')
-rw-r--r-- | kexec/arch/ppc64/crashdump-ppc64.h | 2 | ||||
-rw-r--r-- | kexec/arch/ppc64/kexec-elf-ppc64.c | 17 |
2 files changed, 19 insertions, 0 deletions
diff --git a/kexec/arch/ppc64/crashdump-ppc64.h b/kexec/arch/ppc64/crashdump-ppc64.h index 9608782..be02213 100644 --- a/kexec/arch/ppc64/crashdump-ppc64.h +++ b/kexec/arch/ppc64/crashdump-ppc64.h @@ -23,6 +23,8 @@ void add_usable_mem_rgns(unsigned long long base, unsigned long long size); #define _ALIGN_UP(addr,size) (((addr)+((size)-1))&(~((size)-1))) #define _ALIGN_DOWN(addr,size) ((addr)&(~((size)-1))) +#define KERNEL_RUN_AT_ZERO_MAGIC 0x72756e30 /* "run0" */ + extern uint64_t crash_base; extern uint64_t crash_size; extern unsigned int rtas_base; diff --git a/kexec/arch/ppc64/kexec-elf-ppc64.c b/kexec/arch/ppc64/kexec-elf-ppc64.c index d72550d..32d68e0 100644 --- a/kexec/arch/ppc64/kexec-elf-ppc64.c +++ b/kexec/arch/ppc64/kexec-elf-ppc64.c @@ -92,6 +92,7 @@ int elf_ppc64_load(int argc, char **argv, const char *buf, off_t len, unsigned int my_panic_kernel; uint64_t my_stack, my_backup_start; uint64_t toc_addr; + uint32_t my_run_at_load; unsigned int slave_code[256/sizeof (unsigned int)], master_entry; #define OPT_APPEND (OPT_ARCH_MAX+0) @@ -307,6 +308,18 @@ int elf_ppc64_load(int argc, char **argv, const char *buf, off_t len, my_backup_start = info->backup_start; elf_rel_set_symbol(&info->rhdr, "backup_start", &my_backup_start, sizeof(my_backup_start)); + + /* Tell relocatable kernel to run at load address + * via word before slave code in purgatory + */ + + elf_rel_get_symbol(&info->rhdr, "run_at_load", &my_run_at_load, + sizeof(my_run_at_load)); + if (my_run_at_load == KERNEL_RUN_AT_ZERO_MAGIC) + my_run_at_load = 1; + /* else it should be a fixed offset image */ + elf_rel_set_symbol(&info->rhdr, "run_at_load", &my_run_at_load, + sizeof(my_run_at_load)); } /* Set stack address */ @@ -325,10 +338,13 @@ int elf_ppc64_load(int argc, char **argv, const char *buf, off_t len, my_backup_start = 0; my_stack = 0; toc_addr = 0; + my_run_at_load = 0; elf_rel_get_symbol(&info->rhdr, "kernel", &my_kernel, sizeof(my_kernel)); elf_rel_get_symbol(&info->rhdr, "dt_offset", &my_dt_offset, sizeof(my_dt_offset)); + elf_rel_get_symbol(&info->rhdr, "run_at_load", &my_run_at_load, + sizeof(my_run_at_load)); elf_rel_get_symbol(&info->rhdr, "panic_kernel", &my_panic_kernel, sizeof(my_panic_kernel)); elf_rel_get_symbol(&info->rhdr, "backup_start", &my_backup_start, @@ -341,6 +357,7 @@ int elf_ppc64_load(int argc, char **argv, const char *buf, off_t len, fprintf(stderr, "kernel is %llx\n", (unsigned long long)my_kernel); fprintf(stderr, "dt_offset is %llx\n", (unsigned long long)my_dt_offset); + fprintf(stderr, "run_at_load flag is %x\n", my_run_at_load); fprintf(stderr, "panic_kernel is %x\n", my_panic_kernel); fprintf(stderr, "backup_start is %llx\n", (unsigned long long)my_backup_start); |