diff options
author | Maxim Uvarov <muvarov@gmail.com> | 2010-09-03 17:06:32 +0400 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2010-09-06 10:12:36 +0900 |
commit | f6d67ea658132150f6177edef354979857e0afab (patch) | |
tree | 5cc87b8298f2c01a531c7b0fceb400f0eaf1ccef /kexec/arch/mips | |
parent | 92a732d0032d83a6d00a041d51ee3ca638f96029 (diff) |
mips/crashdump put cmdline after the latest segment
Move cmdline from just after .bss segment to the just after
the latest segment to avoid segments overlap while loading
crashdump kernel. (new mips vmlinux has additional segments
after .bss).
Signed-off-by: Maxim Uvarov <muvarov@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec/arch/mips')
-rw-r--r-- | kexec/arch/mips/kexec-elf-mips.c | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/kexec/arch/mips/kexec-elf-mips.c b/kexec/arch/mips/kexec-elf-mips.c index a9c865e..3e19ca2 100644 --- a/kexec/arch/mips/kexec-elf-mips.c +++ b/kexec/arch/mips/kexec-elf-mips.c @@ -80,7 +80,6 @@ int elf_mips_load(int argc, char **argv, const char *buf, off_t len, int result; unsigned long cmdline_addr; size_t i; - unsigned long bss_start = 0, bss_size = 0; /* See options.h if adding any more options. */ static const struct option options[] = { @@ -133,22 +132,6 @@ int elf_mips_load(int argc, char **argv, const char *buf, off_t len, phdr->p_paddr = virt_to_phys(phdr->p_paddr); } - for (i = 0; i < ehdr.e_shnum; i++) { - struct mem_shdr *shdr; - unsigned char *strtab; - strtab = (unsigned char *)ehdr.e_shdr[ehdr.e_shstrndx].sh_data; - - shdr = &ehdr.e_shdr[i]; - if (shdr->sh_size && - strcmp((char *)&strtab[shdr->sh_name], - ".bss") == 0) { - bss_start = virt_to_phys(shdr->sh_addr); - bss_size = shdr->sh_size; - break; - } - - } - /* Load the Elf data */ result = elf_exec_load(&ehdr, info); if (result < 0) @@ -156,15 +139,6 @@ int elf_mips_load(int argc, char **argv, const char *buf, off_t len, info->entry = (void *)virt_to_phys(ehdr.e_entry); - /* Put cmdline right after bss for crash*/ - if (info->kexec_flags & KEXEC_ON_CRASH) - cmdline_addr = bss_start + bss_size; - else - cmdline_addr = 0; - - if (!bss_size) - die("No .bss segment present\n"); - if (command_line) command_line_len = strlen(command_line) + 1; @@ -183,6 +157,15 @@ int elf_mips_load(int argc, char **argv, const char *buf, off_t len, strncat(cmdline_buf, crash_cmdline, sizeof(crash_cmdline) - strlen(crash_cmdline) - 1); + + if (info->kexec_flags & KEXEC_ON_CRASH) + /* In case of crashdump segment[0] is kernel. + * Put cmdline just after it. */ + cmdline_addr = info->segment[0].mem + + info->segment[0].memsz; + else + cmdline_addr = 0; + add_buffer(info, cmdline_buf, sizeof(cmdline_buf), sizeof(cmdline_buf), sizeof(void *), cmdline_addr, 0x0fffffff, 1); |