summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kexec/arch/x86_64/crashdump-x86_64.c125
-rw-r--r--kexec/arch/x86_64/include/arch/options.h6
-rw-r--r--kexec/arch/x86_64/kexec-x86_64.c8
3 files changed, 6 insertions, 133 deletions
diff --git a/kexec/arch/x86_64/crashdump-x86_64.c b/kexec/arch/x86_64/crashdump-x86_64.c
index ff1930a..e9af1f5 100644
--- a/kexec/arch/x86_64/crashdump-x86_64.c
+++ b/kexec/arch/x86_64/crashdump-x86_64.c
@@ -578,111 +578,6 @@ static int prepare_crash_memory_elf64_headers(struct kexec_info *info,
return 0;
}
-/* Prepares the crash memory elf32 headers and stores in supplied buffer. */
-static int prepare_crash_memory_elf32_headers(struct kexec_info *info,
- void *buf, unsigned long size)
-{
- Elf32_Ehdr *elf;
- Elf32_Phdr *phdr;
- int i;
- char *bufp;
- long int nr_cpus = 0;
- uint64_t notes_addr;
-
- bufp = (char*) buf;
-
- /* Setup ELF Header*/
- elf = (Elf32_Ehdr *) bufp;
- bufp += sizeof(Elf32_Ehdr);
- memcpy(elf->e_ident, ELFMAG, SELFMAG);
- elf->e_ident[EI_CLASS] = ELFCLASS32;
- elf->e_ident[EI_DATA] = ELFDATA2LSB;
- elf->e_ident[EI_VERSION]= EV_CURRENT;
- elf->e_ident[EI_OSABI] = ELFOSABI_NONE;
- memset(elf->e_ident+EI_PAD, 0, EI_NIDENT-EI_PAD);
- elf->e_type = ET_CORE;
- elf->e_machine = EM_X86_64;
- elf->e_version = EV_CURRENT;
- elf->e_entry = 0;
- elf->e_phoff = sizeof(Elf32_Ehdr);
- elf->e_shoff = 0;
- elf->e_flags = 0;
- elf->e_ehsize = sizeof(Elf32_Ehdr);
- elf->e_phentsize= sizeof(Elf32_Phdr);
- elf->e_phnum = 0;
- elf->e_shentsize= 0;
- elf->e_shnum = 0;
- elf->e_shstrndx = 0;
-
- /* PT_NOTE program headers. One per cpu*/
- nr_cpus = sysconf(_SC_NPROCESSORS_CONF);
- if (nr_cpus < 0) {
- return -1;
- }
-
- /* Need to find a better way to determine per cpu notes section size. */
-#define MAX_NOTE_BYTES 1024
- for (i = 0; i < nr_cpus; i++) {
- if (get_crash_notes_per_cpu(i, &notes_addr) < 0) {
- /* This cpu is not present. Skip it. */
- return -1;
- }
- phdr = (Elf32_Phdr *) bufp;
- bufp += sizeof(Elf32_Phdr);
- phdr->p_type = PT_NOTE;
- phdr->p_flags = 0;
- phdr->p_offset = phdr->p_paddr = notes_addr;
- phdr->p_vaddr = 0;
- phdr->p_filesz = phdr->p_memsz = MAX_NOTE_BYTES;
- /* Do we need any alignment of segments? */
- phdr->p_align = 0;
-
- /* Increment number of program headers. */
- (elf->e_phnum)++;
- }
-
- /* Setup PT_LOAD type program header for every system RAM chunk.
- * A seprate program header for Backup Region*/
- for (i = 0; i < CRASH_MAX_MEMORY_RANGES; i++) {
- unsigned long long mstart, mend;
- mstart = crash_memory_range[i].start;
- mend = crash_memory_range[i].end;
- if (!mstart && !mend)
- break;
- if (crash_memory_range[i].type != RANGE_RAM)
- break;
- phdr = (Elf32_Phdr *) bufp;
- bufp += sizeof(Elf32_Phdr);
- phdr->p_type = PT_LOAD;
- phdr->p_flags = PF_R|PF_W|PF_X;
- if (mstart == BACKUP_START && mend == BACKUP_END)
- phdr->p_offset = info->backup_start;
- else
- phdr->p_offset = mstart;
- /* Handle linearly mapped region.*/
-
- /* Filling the vaddr conditionally as we have two linearly
- * mapped regions here. One is __START_KERNEL_map 0 to 40 MB
- * other one is PAGE_OFFSET */
-
- if (mend <= (MAXMEM - 1) && mstart < KERNEL_TEXT_SIZE)
- phdr->p_vaddr = mstart + __START_KERNEL_map;
- else {
- if (mend <= (MAXMEM - 1))
- phdr->p_vaddr = mstart + PAGE_OFFSET;
- else
- phdr->p_vaddr = UINT_MAX;
- }
- phdr->p_paddr = mstart;
- phdr->p_filesz = phdr->p_memsz = mend - mstart + 1;
- /* Do we need any alignment of segments? */
- phdr->p_align = 0;
- /* Increment number of program headers. */
- (elf->e_phnum)++;
- }
- return 0;
-}
-
/* Loads additional segments in case of a panic kernel is being loaded.
* One segment for backup region, another segment for storing elf headers
* for crash memory image.
@@ -723,25 +618,15 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
" failed: %s\n", strerror(errno));
return -1;
}
- if (arch_options.core_header_type == CORE_TYPE_ELF64) {
- sz = sizeof(Elf64_Ehdr) +
- nr_cpus * sizeof(Elf64_Phdr) +
+ sz = sizeof(Elf64_Ehdr) + nr_cpus * sizeof(Elf64_Phdr) +
nr_ranges * sizeof(Elf64_Phdr);
- } else {
- sz = sizeof(Elf32_Ehdr) +
- nr_cpus * sizeof(Elf32_Phdr) +
- nr_ranges * sizeof(Elf32_Phdr);
- }
sz = (sz + align - 1) & ~(align -1);
tmp = xmalloc(sz);
memset(tmp, 0, sz);
- if (arch_options.core_header_type == CORE_TYPE_ELF64) {
- if (prepare_crash_memory_elf64_headers(info, tmp, sz) < 0)
- return -1;
- } else {
- if (prepare_crash_memory_elf32_headers(info, tmp, sz) < 0)
- return -1;
- }
+
+ /* Prepare ELF64 core heaers. */
+ if (prepare_crash_memory_elf64_headers(info, tmp, sz) < 0)
+ return -1;
/* Hack: With some ld versions (GNU ld version 2.14.90.0.4 20030523),
* vmlinux program headers show a gap of two pages between bss segment
diff --git a/kexec/arch/x86_64/include/arch/options.h b/kexec/arch/x86_64/include/arch/options.h
index 189ef46..75065b9 100644
--- a/kexec/arch/x86_64/include/arch/options.h
+++ b/kexec/arch/x86_64/include/arch/options.h
@@ -6,9 +6,7 @@
#define OPT_SERIAL_BAUD (OPT_MAX+2)
#define OPT_CONSOLE_VGA (OPT_MAX+3)
#define OPT_CONSOLE_SERIAL (OPT_MAX+4)
-#define OPT_ELF32_CORE (OPT_MAX+5)
-#define OPT_ELF64_CORE (OPT_MAX+6)
-#define OPT_ARCH_MAX (OPT_MAX+7)
+#define OPT_ARCH_MAX (OPT_MAX+5)
#define KEXEC_ARCH_OPTIONS \
KEXEC_OPTIONS \
@@ -17,8 +15,6 @@
{ "serial-baud", 1, 0, OPT_SERIAL_BAUD }, \
{ "console-vga", 0, 0, OPT_CONSOLE_VGA }, \
{ "console-serial", 0, 0, OPT_CONSOLE_SERIAL }, \
- { "elf32-core-headers", 0, 0, OPT_ELF32_CORE }, \
- { "elf64-core-headers", 0, 0, OPT_ELF64_CORE }, \
#define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR ""
diff --git a/kexec/arch/x86_64/kexec-x86_64.c b/kexec/arch/x86_64/kexec-x86_64.c
index e11e85a..fbef9e7 100644
--- a/kexec/arch/x86_64/kexec-x86_64.c
+++ b/kexec/arch/x86_64/kexec-x86_64.c
@@ -136,8 +136,6 @@ void arch_usage(void)
" --serial-baud=<buad_rate> Specify the serial port baud rate\n"
" --console-vga Enable the vga console\n"
" --console-serial Enable the serial console\n"
- " --elf32-core-headers Prepare core headers in ELF32 format\n"
- " --elf64-core-headers Prepare core headers in ELF64 format\n"
);
}
@@ -218,12 +216,6 @@ int arch_process_options(int argc, char **argv)
}
arch_options.serial_baud = value;
break;
- case OPT_ELF32_CORE:
- arch_options.core_header_type = CORE_TYPE_ELF32;
- break;
- case OPT_ELF64_CORE:
- arch_options.core_header_type = CORE_TYPE_ELF64;
- break;
}
}
/* Reset getopt for the next pass; called in other source modules */