[kexec-tools/f18] Pull two patches from upstream
Dave Young
yangrr at fedoraproject.org
Thu Oct 25 09:38:52 UTC 2012
commit 1cbfc5626e5371d3fa9bc7f02f443b5344b6bbb3
Author: Dave Young <dyoung at redhat.com>
Date: Thu Oct 25 17:07:19 2012 +0800
Pull two patches from upstream
bz865162
Someone need this for kexec to load memdisk which is smaller then 32k.
kexec-tools-2.0.3-Load-bzImages-smaller-than-32-KiB.patch
bz849650, for efi booting system we need this acpi_rsdp kernel argument
after vivek's secure boot work we maybe need drop this one.
kexec-tools-2.0.3-kdump-pass-acpi_rsdp-to-2nd-kernel-for-efi-booting.patch
...s-2.0.3-Load-bzImages-smaller-than-32-KiB.patch | 73 +++++++++++++++++
...s-acpi_rsdp-to-2nd-kernel-for-efi-booting.patch | 82 ++++++++++++++++++++
kexec-tools.spec | 4 +
3 files changed, 159 insertions(+), 0 deletions(-)
---
diff --git a/kexec-tools-2.0.3-Load-bzImages-smaller-than-32-KiB.patch b/kexec-tools-2.0.3-Load-bzImages-smaller-than-32-KiB.patch
new file mode 100644
index 0000000..42f169f
--- /dev/null
+++ b/kexec-tools-2.0.3-Load-bzImages-smaller-than-32-KiB.patch
@@ -0,0 +1,73 @@
+From 0e4946bc3009e7b9ce6f9d792077eddd7e40cc14 Mon Sep 17 00:00:00 2001
+From: Eric Biggers <ebiggers3 at gmail.com>
+Date: Tue, 5 Jun 2012 19:46:07 -0400
+Subject: [PATCH] Load bzImages smaller than 32 KiB
+
+Allow bzImages smaller than 32KiB to be kexec'ed.
+
+The current code will fail to load a bzImage smaller than 32768 bytes (sizeof
+struct x86_linux_header), but the 'memdisk' program that comes with syslinux is
+only about 26 KiB. This patch changes the minimum size to 1024 bytes (2
+sectors), which appears to be the limit that syslinux enforces.
+
+Removed the "tail" field of struct x86_linux_header because it doesn't seem to
+actually be used (is there a reason for it?).
+
+Also, note that bzImage_probe() was incorrectly using `sizeof (header)', even
+though header is a pointer.
+
+Signed-off-by: Eric Biggers <ebiggers3 at gmail.com>
+Signed-off-by: Simon Horman <horms at verge.net.au>
+---
+ include/x86/x86-linux.h | 2 --
+ kexec/arch/i386/kexec-bzImage.c | 7 +++++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/include/x86/x86-linux.h b/include/x86/x86-linux.h
+index 59d35c9..2ebcc3a 100644
+--- a/include/x86/x86-linux.h
++++ b/include/x86/x86-linux.h
+@@ -233,7 +233,6 @@ struct x86_linux_header {
+ uint32_t high_base; /* 0x24C */
+ uint32_t high_memsz; /* 0x250 */
+ uint32_t high_filesz; /* 0x254 */
+- uint32_t tail[32*1024 - 0x258]; /* 0x258 */
+ #else
+ uint32_t kernel_alignment; /* 0x230 */
+ uint8_t relocatable_kernel; /* 0x234 */
+@@ -241,7 +240,6 @@ struct x86_linux_header {
+ uint32_t cmdline_size; /* 0x238 */
+ uint32_t hardware_subarch; /* 0x23C */
+ uint64_t hardware_subarch_data; /* 0x240 */
+- uint8_t tail[32*1024 - 0x248]; /* 0x248 */
+ #endif
+ } PACKED;
+
+diff --git a/kexec/arch/i386/kexec-bzImage.c b/kexec/arch/i386/kexec-bzImage.c
+index 54c4427..6998587 100644
+--- a/kexec/arch/i386/kexec-bzImage.c
++++ b/kexec/arch/i386/kexec-bzImage.c
+@@ -44,7 +44,10 @@ static const int probe_debug = 0;
+ int bzImage_probe(const char *buf, off_t len)
+ {
+ const struct x86_linux_header *header;
+- if ((uintmax_t)len < (uintmax_t)sizeof(header)) {
++ if ((uintmax_t)len < (uintmax_t)(2 * 512)) {
++ if (probe_debug) {
++ fprintf(stderr, "File is too short to be a bzImage!\n");
++ }
+ return -1;
+ }
+ header = (const struct x86_linux_header *)buf;
+@@ -118,7 +121,7 @@ int do_bzImage_load(struct kexec_info *info,
+ /*
+ * Find out about the file I am about to load.
+ */
+- if ((uintmax_t)kernel_len < (uintmax_t)sizeof(setup_header)) {
++ if ((uintmax_t)kernel_len < (uintmax_t)(2 * 512)) {
+ return -1;
+ }
+ memcpy(&setup_header, kernel, sizeof(setup_header));
+--
+1.7.1
+
diff --git a/kexec-tools-2.0.3-kdump-pass-acpi_rsdp-to-2nd-kernel-for-efi-booting.patch b/kexec-tools-2.0.3-kdump-pass-acpi_rsdp-to-2nd-kernel-for-efi-booting.patch
new file mode 100644
index 0000000..78e8eff
--- /dev/null
+++ b/kexec-tools-2.0.3-kdump-pass-acpi_rsdp-to-2nd-kernel-for-efi-booting.patch
@@ -0,0 +1,82 @@
+From 75d1a16f0b4e5b33e91a51d93014f1fd8303f36e Mon Sep 17 00:00:00 2001
+From: Dave Young <dyoung at redhat.com>
+Date: Thu, 18 Oct 2012 11:16:08 +0800
+Subject: [PATCH] kdump: pass acpi_rsdp= to 2nd kernel for efi booting
+
+In case efi booting, kdump need kernel parameter acpi_rsdp= to retrieve
+the acpi root table physical address.
+
+Add a function cmdline_add_efi to get the address from /sys/firmware/efi/systab
+If there's no such file or read fail the function will just do nothing.
+
+Tested efi boot Fedora 17 on thinkpad T420.
+
+Some background info for this issue:
+http://lists.infradead.org/pipermail/kexec/2010-March/003889.html
+
+[v1 -> v2]:
+Address comments from Khalid and Simon
+use fgets instead of read(2) to iterate the file
+do not add 'noefi' because kexec does not construct EFI signature
+in bootloader signature in boot_params, so kexec'd kernel will
+disable EFI automatically even without noefi.
+
+Signed-off-by: Dave Young <dyoung at redhat.com>
+Reviewed-by: Khalid Aziz <khalid at gonehiking.org>
+Acked-by: "Eric W. Biederman" <ebiederm at xmission.com>
+Signed-off-by: Simon Horman <horms at verge.net.au>
+---
+ kexec/arch/i386/crashdump-x86.c | 35 +++++++++++++++++++++++++++++++++++
+ 1 file changed, 35 insertions(+)
+
+--- kexec-tools-2.0.3.orig/kexec/arch/i386/crashdump-x86.c
++++ kexec-tools-2.0.3/kexec/arch/i386/crashdump-x86.c
+@@ -665,6 +665,40 @@ static int cmdline_add_memmap_acpi(char
+ return 0;
+ }
+
++/* Appends 'acpi_rsdp=' commandline for efi boot crash dump */
++static void cmdline_add_efi(char *cmdline)
++{
++ FILE *fp;
++ int cmdlen, len;
++ char line[MAX_LINE], *s;
++ const char *acpis = " acpi_rsdp=";
++
++ fp = fopen("/sys/firmware/efi/systab", "r");
++ if (!fp)
++ return;
++
++ while(fgets(line, sizeof(line), fp) != 0) {
++ /* ACPI20= always goes before ACPI= */
++ if ((strstr(line, "ACPI20=")) || (strstr(line, "ACPI="))) {
++ line[strlen(line) - 1] = '\0';
++ s = strchr(line, '=');
++ s += 1;
++ len = strlen(s) + strlen(acpis);
++ cmdlen = strlen(cmdline) + len;
++ if (cmdlen > (COMMAND_LINE_SIZE - 1))
++ die("Command line overflow\n");
++ strcat(cmdline, acpis);
++ strcat(cmdline, s);
++ dbgprintf("Command line after adding efi\n");
++ dbgprintf("%s\n", cmdline);
++
++ break;
++ }
++ }
++
++ fclose(fp);
++}
++
+ static void get_backup_area(unsigned long *start, unsigned long *end)
+ {
+ const char *iomem = proc_iomem();
+@@ -838,6 +872,7 @@ int load_crashdump_segments(struct kexec
+ if (delete_memmap(memmap_p, elfcorehdr, memsz) < 0)
+ return -1;
+ cmdline_add_memmap(mod_cmdline, memmap_p);
++ cmdline_add_efi(mod_cmdline);
+ cmdline_add_elfcorehdr(mod_cmdline, elfcorehdr);
+
+ /* Inform second kernel about the presence of ACPI tables. */
diff --git a/kexec-tools.spec b/kexec-tools.spec
index 6a8a00e..bd53df0 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -50,6 +50,8 @@ Obsoletes: diskdumputils netdump
#
# Patches 0 through 100 are meant for x86 kexec-tools enablement
#
+Patch001: kexec-tools-2.0.3-Load-bzImages-smaller-than-32-KiB.patch
+Patch002: kexec-tools-2.0.3-kdump-pass-acpi_rsdp-to-2nd-kernel-for-efi-booting.patch
#
# Patches 101 through 200 are meant for x86_64 kexec-tools enablement
@@ -92,6 +94,8 @@ mkdir -p -m755 kcp
tar -z -x -v -f %{SOURCE9}
+%patch001 -p1
+%patch002 -p1
%patch301 -p1
%patch601 -p1
%patch602 -p1
More information about the scm-commits
mailing list