summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Young <dyoung@redhat.com>2014-05-27 13:52:08 +0800
committerSimon Horman <horms@verge.net.au>2014-05-28 08:44:30 +0900
commit6f333539533523add760b2512787b06c79e82c13 (patch)
tree9d093f8238c8240e5827cc4bed1cacd5da82970f
parentc96b723e17eb4af689de494b636d8bded4b98c88 (diff)
downloadkexec-tools-6f333539533523add760b2512787b06c79e82c13.tar.gz
kexec-tools: add noefi arch cmdline option
For kernel boot with efi=old_map or some quirked machines like SGI UV they use old ioremap instead of 1:1 mapping. But kexec efi support depends on the 1:1 mapping thus we need to switch to use the old way There's a kernel patch for exporting the efi flags so we can check the memory mapping method. But user may want to explictly disable efi boot for unknown reasons. So here add a new arch option '--noefi' for this case. Signed-off-by: Dave Young <dyoung@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--kexec/arch/i386/crashdump-x86.c2
-rw-r--r--kexec/arch/i386/include/arch/options.h2
-rw-r--r--kexec/arch/i386/kexec-x86.c6
-rw-r--r--kexec/arch/i386/kexec-x86.h1
-rw-r--r--kexec/arch/i386/x86-linux-setup.c2
-rw-r--r--kexec/arch/x86_64/kexec-x86_64.c5
6 files changed, 16 insertions, 2 deletions
diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
index 2168854..8ef0c8b 100644
--- a/kexec/arch/i386/crashdump-x86.c
+++ b/kexec/arch/i386/crashdump-x86.c
@@ -974,7 +974,7 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
dbgprintf("Created elf header segment at 0x%lx\n", elfcorehdr);
if (delete_memmap(memmap_p, &nr_memmap, elfcorehdr, memsz) < 0)
return -1;
- if (!bzImage_support_efi_boot)
+ if (!bzImage_support_efi_boot || arch_options.noefi)
cmdline_add_efi(mod_cmdline);
cmdline_add_elfcorehdr(mod_cmdline, elfcorehdr);
diff --git a/kexec/arch/i386/include/arch/options.h b/kexec/arch/i386/include/arch/options.h
index e5300b5..c113a83 100644
--- a/kexec/arch/i386/include/arch/options.h
+++ b/kexec/arch/i386/include/arch/options.h
@@ -31,6 +31,7 @@
#define OPT_REAL_MODE (OPT_ARCH_MAX+9)
#define OPT_ENTRY_32BIT (OPT_ARCH_MAX+10)
#define OPT_PASS_MEMMAP_CMDLINE (OPT_ARCH_MAX+11)
+#define OPT_NOEFI (OPT_ARCH_MAX+12)
/* Options relevant to the architecture (excluding loader-specific ones): */
#define KEXEC_ARCH_OPTIONS \
@@ -43,6 +44,7 @@
{ "elf32-core-headers", 0, 0, OPT_ELF32_CORE }, \
{ "elf64-core-headers", 0, 0, OPT_ELF64_CORE }, \
{ "pass-memmap-cmdline", 0, 0, OPT_PASS_MEMMAP_CMDLINE }, \
+ { "noefi", 0, 0, OPT_NOEFI}, \
#define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR ""
diff --git a/kexec/arch/i386/kexec-x86.c b/kexec/arch/i386/kexec-x86.c
index 0b58dff..0f23eb9 100644
--- a/kexec/arch/i386/kexec-x86.c
+++ b/kexec/arch/i386/kexec-x86.c
@@ -55,6 +55,7 @@ void arch_usage(void)
" --elf32-core-headers Prepare core headers in ELF32 format\n"
" --elf64-core-headers Prepare core headers in ELF64 format\n"
" --pass--memmap-cmdline Pass memory map via command line in kexec on panic case\n"
+ " --noefi Disable efi support\n"
);
}
@@ -66,6 +67,7 @@ struct arch_options_t arch_options = {
.console_serial = 0,
.core_header_type = CORE_TYPE_UNDEF,
.pass_memmap_cmdline = 0,
+ .noefi = 0,
};
int arch_process_options(int argc, char **argv)
@@ -137,6 +139,10 @@ int arch_process_options(int argc, char **argv)
break;
case OPT_PASS_MEMMAP_CMDLINE:
arch_options.pass_memmap_cmdline = 1;
+ break;
+ case OPT_NOEFI:
+ arch_options.noefi = 1;
+ break;
}
}
/* Reset getopt for the next pass; called in other source modules */
diff --git a/kexec/arch/i386/kexec-x86.h b/kexec/arch/i386/kexec-x86.h
index e8c9188..33df352 100644
--- a/kexec/arch/i386/kexec-x86.h
+++ b/kexec/arch/i386/kexec-x86.h
@@ -51,6 +51,7 @@ struct arch_options_t {
uint8_t console_serial;
enum coretype core_header_type;
uint8_t pass_memmap_cmdline;
+ uint8_t noefi;
};
int multiboot_x86_probe(const char *buf, off_t len);
diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
index 4437ed7..9271c6c 100644
--- a/kexec/arch/i386/x86-linux-setup.c
+++ b/kexec/arch/i386/x86-linux-setup.c
@@ -822,7 +822,7 @@ void setup_linux_system_parameters(struct kexec_info *info,
{
/* get subarch from running kernel */
setup_subarch(real_mode);
- if (bzImage_support_efi_boot)
+ if (bzImage_support_efi_boot && !arch_options.noefi)
setup_efi_info(info, real_mode);
/* Default screen size */
diff --git a/kexec/arch/x86_64/kexec-x86_64.c b/kexec/arch/x86_64/kexec-x86_64.c
index f70851d..041b007 100644
--- a/kexec/arch/x86_64/kexec-x86_64.c
+++ b/kexec/arch/x86_64/kexec-x86_64.c
@@ -54,6 +54,7 @@ void arch_usage(void)
" --console-vga Enable the vga console\n"
" --console-serial Enable the serial console\n"
" --pass-memmap-cmdline Pass memory map via command line in kexec on panic case\n"
+ " --noefi Disable efi support\n"
);
}
@@ -65,6 +66,7 @@ struct arch_options_t arch_options = {
.console_serial = 0,
.core_header_type = CORE_TYPE_ELF64,
.pass_memmap_cmdline = 0,
+ .noefi = 0,
};
int arch_process_options(int argc, char **argv)
@@ -131,6 +133,9 @@ int arch_process_options(int argc, char **argv)
case OPT_PASS_MEMMAP_CMDLINE:
arch_options.pass_memmap_cmdline = 1;
break;
+ case OPT_NOEFI:
+ arch_options.noefi = 1;
+ break;
}
}
/* Reset getopt for the next pass; called in other source modules */