parent
c3ee331456
commit
e0414ee861
@ -1,3 +1,3 @@
|
|||||||
SOURCES/eppic-e8844d3.tar.gz
|
SOURCES/eppic-e8844d3.tar.gz
|
||||||
SOURCES/kexec-tools-2.0.25.tar.xz
|
SOURCES/kexec-tools-2.0.26.tar.xz
|
||||||
SOURCES/makedumpfile-1.7.2.tar.gz
|
SOURCES/makedumpfile-1.7.3.tar.gz
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
80ac3f5e77d3c79883edadf14428734db4720009 SOURCES/eppic-e8844d3.tar.gz
|
80ac3f5e77d3c79883edadf14428734db4720009 SOURCES/eppic-e8844d3.tar.gz
|
||||||
78d5d4f7e9d358ca234db9c84a551d9d411eb0b5 SOURCES/kexec-tools-2.0.25.tar.xz
|
27cea5d032ec1e93506b8110222420abf754df2d SOURCES/kexec-tools-2.0.26.tar.xz
|
||||||
24bce02cd42cdbb960ada4d9e733355582e35784 SOURCES/makedumpfile-1.7.2.tar.gz
|
2815949d81c11cd2f97f184153448d6e8ddff256 SOURCES/makedumpfile-1.7.3.tar.gz
|
||||||
|
@ -1,72 +0,0 @@
|
|||||||
From 58553ad03187f0cf208d6c4a0dc026c6338e5edd Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Daisuke Hatayama (Fujitsu)" <d.hatayama@fujitsu.com>
|
|
||||||
Date: Wed, 29 Mar 2023 12:44:10 +0000
|
|
||||||
Subject: [PATCH] sadump: fix failure of reading memory when 5-level
|
|
||||||
paging is enabled
|
|
||||||
|
|
||||||
makedumpfile fails as follows for memory dumps collected by sadump
|
|
||||||
when 5-level paging is enabled on the corresponding systems:
|
|
||||||
|
|
||||||
# makedumpfile -l -d 31 -x ./vmlinux ./dump.sadump dump.sadump-ld31
|
|
||||||
__vtop4_x86_64: Can't get a valid pgd.
|
|
||||||
...snip...
|
|
||||||
__vtop4_x86_64: Can't get a valid pgd.
|
|
||||||
calc_kaslr_offset: failed to calculate kaslr_offset and phys_base; default to 0
|
|
||||||
__vtop4_x86_64: Can't get a valid pgd.
|
|
||||||
readmem: Can't convert a virtual address(ffffffff82fce960) to physical address.
|
|
||||||
readmem: type_addr: 0, addr:ffffffff82fce960, size:1024
|
|
||||||
cpu_online_mask_init: Can't read cpu_online_mask memory.
|
|
||||||
|
|
||||||
makedumpfile Failed.
|
|
||||||
|
|
||||||
This is because 5-level paging support has not been done yet for
|
|
||||||
sadump; the work of the 5-level paging support was done by the commit
|
|
||||||
30a3214a7193e94c551c0cebda5918a72a35c589 (PATCH 4/4 arch/x86_64: Add
|
|
||||||
5-level paging support) but that was focused on the core part only.
|
|
||||||
|
|
||||||
Having said that, most of things has already been finished in the
|
|
||||||
commit. What needs to be newly added for sadump is just how to check
|
|
||||||
if 5-level paging is enabled for a given memory dump.
|
|
||||||
|
|
||||||
For that purpose, let's refer to CR4.LA57, bit 12 of CR4, representing
|
|
||||||
whether 5-level paging is enabled or not. We can do this because
|
|
||||||
memory dumps collected by sadump have SMRAM as note information and
|
|
||||||
they include CR4 together with the other control registers.
|
|
||||||
|
|
||||||
Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
|
|
||||||
---
|
|
||||||
sadump_info.c | 4 ++++
|
|
||||||
1 file changed, 4 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/makedumpfile-1.7.2/sadump_info.c b/makedumpfile-1.7.2/sadump_info.c
|
|
||||||
index adfa8dc..2c44068 100644
|
|
||||||
--- a/makedumpfile-1.7.2/sadump_info.c
|
|
||||||
+++ b/makedumpfile-1.7.2/sadump_info.c
|
|
||||||
@@ -1362,6 +1362,7 @@ static int linux_banner_sanity_check(ulong cr3)
|
|
||||||
#define PTI_USER_PGTABLE_BIT (info->page_shift)
|
|
||||||
#define PTI_USER_PGTABLE_MASK (1 << PTI_USER_PGTABLE_BIT)
|
|
||||||
#define CR3_PCID_MASK 0xFFFull
|
|
||||||
+#define CR4_LA57 (1 << 12)
|
|
||||||
int
|
|
||||||
calc_kaslr_offset(void)
|
|
||||||
{
|
|
||||||
@@ -1397,6 +1398,8 @@ calc_kaslr_offset(void)
|
|
||||||
else
|
|
||||||
cr3 = smram.Cr3 & ~CR3_PCID_MASK;
|
|
||||||
|
|
||||||
+ NUMBER(pgtable_l5_enabled) = !!(smram.Cr4 & CR4_LA57);
|
|
||||||
+
|
|
||||||
/* Convert virtual address of IDT table to physical address */
|
|
||||||
idtr_paddr = vtop4_x86_64_pagetable(idtr, cr3);
|
|
||||||
if (idtr_paddr == NOT_PADDR) {
|
|
||||||
@@ -1417,6 +1420,7 @@ calc_kaslr_offset(void)
|
|
||||||
|
|
||||||
DEBUG_MSG("sadump: idtr=%" PRIx64 "\n", idtr);
|
|
||||||
DEBUG_MSG("sadump: cr3=%" PRIx64 "\n", cr3);
|
|
||||||
+ DEBUG_MSG("sadump: cr4=%" PRIx32 "\n", smram.Cr4);
|
|
||||||
DEBUG_MSG("sadump: idtr(phys)=%" PRIx64 "\n", idtr_paddr);
|
|
||||||
DEBUG_MSG("sadump: devide_error(vmlinux)=%lx\n",
|
|
||||||
divide_error_vmlinux);
|
|
||||||
--
|
|
||||||
2.33.1
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
|||||||
From 6b6187f546f0ddad8ea84d22c3f7ad72133dcfe3 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Sourabh Jain <sourabhjain@linux.ibm.com>
|
|
||||||
Date: Thu, 15 Sep 2022 14:12:40 +0530
|
|
||||||
Subject: [PATCH] ppc64: remove rma_top limit
|
|
||||||
|
|
||||||
Restricting kexec tool to allocate hole for kexec segments below 768MB
|
|
||||||
may not be relavent now since first memory block size can be 1024MB and
|
|
||||||
more.
|
|
||||||
|
|
||||||
Removing rma_top restriction will give more space to find holes for
|
|
||||||
kexec segments and existing in-place checks make sure that kexec segment
|
|
||||||
allocation doesn't cross the first memory block because every kexec segment
|
|
||||||
has to be within first memory block for kdump kernel to boot properly.
|
|
||||||
|
|
||||||
Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
|
|
||||||
Acked-by: Hari Bathini <hbathini@linux.ibm.com>
|
|
||||||
Signed-off-by: Simon Horman <horms@kernel.org>
|
|
||||||
---
|
|
||||||
kexec/arch/ppc64/kexec-ppc64.c | 2 --
|
|
||||||
1 file changed, 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/kexec/arch/ppc64/kexec-ppc64.c b/kexec/arch/ppc64/kexec-ppc64.c
|
|
||||||
index 5b17740..611809f 100644
|
|
||||||
--- a/kexec/arch/ppc64/kexec-ppc64.c
|
|
||||||
+++ b/kexec/arch/ppc64/kexec-ppc64.c
|
|
||||||
@@ -717,8 +717,6 @@ static int get_devtree_details(unsigned long kexec_flags)
|
|
||||||
if (base < rma_base) {
|
|
||||||
rma_base = base;
|
|
||||||
rma_top = base + be64_to_cpu(((uint64_t *)buf)[1]);
|
|
||||||
- if (rma_top > 0x30000000UL)
|
|
||||||
- rma_top = 0x30000000UL;
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(file);
|
|
||||||
--
|
|
||||||
2.38.1
|
|
||||||
|
|
@ -0,0 +1,147 @@
|
|||||||
|
From e63fefd4fc355f29d839ca47484b0f8070e38ccb Mon Sep 17 00:00:00 2001
|
||||||
|
From: Sourabh Jain <sourabhjain@linux.ibm.com>
|
||||||
|
Date: Wed, 1 Feb 2023 14:23:31 +0530
|
||||||
|
Subject: [PATCH 1/6] ppc64: add --reuse-cmdline parameter support
|
||||||
|
|
||||||
|
An option to copy the command line arguments from running kernel
|
||||||
|
to kexec'd kernel. This option works for both kexec and kdump.
|
||||||
|
|
||||||
|
In case --append=<args> or --command-line=<args> is provided along
|
||||||
|
with --reuse-cmdline parameter then args listed against append and
|
||||||
|
command-line parameter will be combined with command line argument
|
||||||
|
from running kernel.
|
||||||
|
|
||||||
|
Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@kernel.org>
|
||||||
|
---
|
||||||
|
kexec/arch/ppc64/include/arch/options.h | 4 +++-
|
||||||
|
kexec/arch/ppc64/kexec-elf-ppc64.c | 25 +++++++++++++++++++++++--
|
||||||
|
2 files changed, 26 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/ppc64/include/arch/options.h b/kexec/arch/ppc64/include/arch/options.h
|
||||||
|
index 71632ec..2bca96a 100644
|
||||||
|
--- a/kexec/arch/ppc64/include/arch/options.h
|
||||||
|
+++ b/kexec/arch/ppc64/include/arch/options.h
|
||||||
|
@@ -10,6 +10,7 @@
|
||||||
|
#define OPT_RAMDISK (OPT_ARCH_MAX+1)
|
||||||
|
#define OPT_DEVICETREEBLOB (OPT_ARCH_MAX+2)
|
||||||
|
#define OPT_ARGS_IGNORE (OPT_ARCH_MAX+3)
|
||||||
|
+#define OPT_REUSE_CMDLINE (OPT_ARCH_MAX+4)
|
||||||
|
|
||||||
|
/* Options relevant to the architecture (excluding loader-specific ones): */
|
||||||
|
#define KEXEC_ARCH_OPTIONS \
|
||||||
|
@@ -41,7 +42,8 @@
|
||||||
|
{ "initrd", 1, NULL, OPT_RAMDISK }, \
|
||||||
|
{ "devicetreeblob", 1, NULL, OPT_DEVICETREEBLOB }, \
|
||||||
|
{ "dtb", 1, NULL, OPT_DEVICETREEBLOB }, \
|
||||||
|
- { "args-linux", 0, NULL, OPT_ARGS_IGNORE },
|
||||||
|
+ { "args-linux", 0, NULL, OPT_ARGS_IGNORE }, \
|
||||||
|
+ { "reuse-cmdline", 0, NULL, OPT_REUSE_CMDLINE },
|
||||||
|
|
||||||
|
#define KEXEC_ALL_OPT_STR KEXEC_OPT_STR
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/ppc64/kexec-elf-ppc64.c b/kexec/arch/ppc64/kexec-elf-ppc64.c
|
||||||
|
index 695b8b0..01d045f 100644
|
||||||
|
--- a/kexec/arch/ppc64/kexec-elf-ppc64.c
|
||||||
|
+++ b/kexec/arch/ppc64/kexec-elf-ppc64.c
|
||||||
|
@@ -95,6 +95,8 @@ static int elf_ppc64_load_file(int argc, char **argv, struct kexec_info *info)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
char *cmdline, *dtb;
|
||||||
|
+ char *append_cmdline = NULL;
|
||||||
|
+ char *reuse_cmdline = NULL;
|
||||||
|
int opt, cmdline_len = 0;
|
||||||
|
|
||||||
|
/* See options.h -- add any more there, too. */
|
||||||
|
@@ -107,6 +109,7 @@ static int elf_ppc64_load_file(int argc, char **argv, struct kexec_info *info)
|
||||||
|
{ "devicetreeblob", 1, NULL, OPT_DEVICETREEBLOB },
|
||||||
|
{ "dtb", 1, NULL, OPT_DEVICETREEBLOB },
|
||||||
|
{ "args-linux", 0, NULL, OPT_ARGS_IGNORE },
|
||||||
|
+ { "reuse-cmdline", 0, NULL, OPT_REUSE_CMDLINE},
|
||||||
|
{ 0, 0, NULL, 0 },
|
||||||
|
};
|
||||||
|
|
||||||
|
@@ -125,7 +128,7 @@ static int elf_ppc64_load_file(int argc, char **argv, struct kexec_info *info)
|
||||||
|
if (opt < OPT_ARCH_MAX)
|
||||||
|
break;
|
||||||
|
case OPT_APPEND:
|
||||||
|
- cmdline = optarg;
|
||||||
|
+ append_cmdline = optarg;
|
||||||
|
break;
|
||||||
|
case OPT_RAMDISK:
|
||||||
|
ramdisk = optarg;
|
||||||
|
@@ -135,6 +138,9 @@ static int elf_ppc64_load_file(int argc, char **argv, struct kexec_info *info)
|
||||||
|
break;
|
||||||
|
case OPT_ARGS_IGNORE:
|
||||||
|
break;
|
||||||
|
+ case OPT_REUSE_CMDLINE:
|
||||||
|
+ reuse_cmdline = get_command_line();
|
||||||
|
+ break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -144,6 +150,10 @@ static int elf_ppc64_load_file(int argc, char **argv, struct kexec_info *info)
|
||||||
|
if (reuse_initrd)
|
||||||
|
die("--reuseinitrd not supported with --kexec-file-syscall.\n");
|
||||||
|
|
||||||
|
+ cmdline = concat_cmdline(reuse_cmdline, append_cmdline);
|
||||||
|
+ if (!reuse_cmdline)
|
||||||
|
+ free(reuse_cmdline);
|
||||||
|
+
|
||||||
|
if (cmdline) {
|
||||||
|
cmdline_len = strlen(cmdline) + 1;
|
||||||
|
} else {
|
||||||
|
@@ -175,6 +185,8 @@ int elf_ppc64_load(int argc, char **argv, const char *buf, off_t len,
|
||||||
|
{
|
||||||
|
struct mem_ehdr ehdr;
|
||||||
|
char *cmdline, *modified_cmdline = NULL;
|
||||||
|
+ char *reuse_cmdline = NULL;
|
||||||
|
+ char *append_cmdline = NULL;
|
||||||
|
const char *devicetreeblob;
|
||||||
|
uint64_t max_addr, hole_addr;
|
||||||
|
char *seg_buf = NULL;
|
||||||
|
@@ -204,6 +216,7 @@ int elf_ppc64_load(int argc, char **argv, const char *buf, off_t len,
|
||||||
|
{ "devicetreeblob", 1, NULL, OPT_DEVICETREEBLOB },
|
||||||
|
{ "dtb", 1, NULL, OPT_DEVICETREEBLOB },
|
||||||
|
{ "args-linux", 0, NULL, OPT_ARGS_IGNORE },
|
||||||
|
+ { "reuse-cmdline", 0, NULL, OPT_REUSE_CMDLINE},
|
||||||
|
{ 0, 0, NULL, 0 },
|
||||||
|
};
|
||||||
|
|
||||||
|
@@ -229,7 +242,7 @@ int elf_ppc64_load(int argc, char **argv, const char *buf, off_t len,
|
||||||
|
if (opt < OPT_ARCH_MAX)
|
||||||
|
break;
|
||||||
|
case OPT_APPEND:
|
||||||
|
- cmdline = optarg;
|
||||||
|
+ append_cmdline = optarg;
|
||||||
|
break;
|
||||||
|
case OPT_RAMDISK:
|
||||||
|
ramdisk = optarg;
|
||||||
|
@@ -239,9 +252,16 @@ int elf_ppc64_load(int argc, char **argv, const char *buf, off_t len,
|
||||||
|
break;
|
||||||
|
case OPT_ARGS_IGNORE:
|
||||||
|
break;
|
||||||
|
+ case OPT_REUSE_CMDLINE:
|
||||||
|
+ reuse_cmdline = get_command_line();
|
||||||
|
+ break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+ cmdline = concat_cmdline(reuse_cmdline, append_cmdline);
|
||||||
|
+ if (!reuse_cmdline)
|
||||||
|
+ free(reuse_cmdline);
|
||||||
|
+
|
||||||
|
if (!cmdline)
|
||||||
|
fprintf(stdout, "Warning: append= option is not passed. Using the first kernel root partition\n");
|
||||||
|
|
||||||
|
@@ -469,6 +489,7 @@ void elf_ppc64_usage(void)
|
||||||
|
fprintf(stderr, " --devicetreeblob=<filename> Specify device tree blob file.\n");
|
||||||
|
fprintf(stderr, " ");
|
||||||
|
fprintf(stderr, "Not applicable while using --kexec-file-syscall.\n");
|
||||||
|
+ fprintf(stderr, " --reuse-cmdline Use kernel command line from running system.\n");
|
||||||
|
fprintf(stderr, " --dtb=<filename> same as --devicetreeblob.\n");
|
||||||
|
|
||||||
|
fprintf(stderr, "elf support is still broken\n");
|
||||||
|
--
|
||||||
|
2.33.1
|
||||||
|
|
@ -0,0 +1,108 @@
|
|||||||
|
From 29fe5067ed07452bcbbbe5fcd0b4e4215f598014 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Ahelenia=20Ziemia=C5=84ska?=
|
||||||
|
<nabijaczleweli@nabijaczleweli.xyz>
|
||||||
|
Date: Fri, 3 Feb 2023 00:10:18 +0100
|
||||||
|
Subject: [PATCH 2/6] kexec: make -a the default
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
AFAICT, there's no downside to this, and running into this each time
|
||||||
|
I want to kexec (and, presumably, a significant chunk of the population,
|
||||||
|
since lockdown is quite popular) on some machines,
|
||||||
|
then going to the manual, then finding out I want the /auto/ flag(!)
|
||||||
|
is quite annoying:
|
||||||
|
# kexec -l /boot/vmlinuz-6.1.0-3-amd64 --initrd /boot/initrd.img-6.1.0-3-amd64 --reuse-cmdline
|
||||||
|
kexec_load failed: Operation not permitted
|
||||||
|
entry = 0x46eff7760 flags = 0x3e0000
|
||||||
|
nr_segments = 7
|
||||||
|
segment[0].buf = 0x557cd303efa0
|
||||||
|
segment[0].bufsz = 0x70
|
||||||
|
segment[0].mem = 0x100000
|
||||||
|
segment[0].memsz = 0x1000
|
||||||
|
segment[1].buf = 0x557cd3046fe0
|
||||||
|
segment[1].bufsz = 0x190
|
||||||
|
segment[1].mem = 0x101000
|
||||||
|
segment[1].memsz = 0x1000
|
||||||
|
segment[2].buf = 0x557cd303f6e0
|
||||||
|
segment[2].bufsz = 0x30
|
||||||
|
segment[2].mem = 0x102000
|
||||||
|
segment[2].memsz = 0x1000
|
||||||
|
segment[3].buf = 0x7f658fa37010
|
||||||
|
segment[3].bufsz = 0x12a51b5
|
||||||
|
segment[3].mem = 0x46a55a000
|
||||||
|
segment[3].memsz = 0x12a6000
|
||||||
|
segment[4].buf = 0x7f6590ce1210
|
||||||
|
segment[4].bufsz = 0x7e99e0
|
||||||
|
segment[4].mem = 0x46b800000
|
||||||
|
segment[4].memsz = 0x377c000
|
||||||
|
segment[5].buf = 0x557cd3039350
|
||||||
|
segment[5].bufsz = 0x42fa
|
||||||
|
segment[5].mem = 0x46eff2000
|
||||||
|
segment[5].memsz = 0x5000
|
||||||
|
segment[6].buf = 0x557cd3032000
|
||||||
|
segment[6].bufsz = 0x70e0
|
||||||
|
segment[6].mem = 0x46eff7000
|
||||||
|
segment[6].memsz = 0x9000
|
||||||
|
|
||||||
|
Closes: https://bugs.debian.org/1030248
|
||||||
|
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
|
||||||
|
Signed-off-by: Simon Horman <horms@kernel.org>
|
||||||
|
---
|
||||||
|
kexec/kexec.8 | 4 ++--
|
||||||
|
kexec/kexec.c | 8 ++++----
|
||||||
|
2 files changed, 6 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/kexec/kexec.8 b/kexec/kexec.8
|
||||||
|
index 3ebede6..66453b8 100644
|
||||||
|
--- a/kexec/kexec.8
|
||||||
|
+++ b/kexec/kexec.8
|
||||||
|
@@ -151,14 +151,14 @@ Specify that the new kernel is of this
|
||||||
|
Specify that the new KEXEC_FILE_LOAD syscall should be used exclusively.
|
||||||
|
.TP
|
||||||
|
.BI \-c\ (\-\-kexec-syscall)
|
||||||
|
-Specify that the old KEXEC_LOAD syscall should be used exclusively (the default).
|
||||||
|
+Specify that the old KEXEC_LOAD syscall should be used exclusively.
|
||||||
|
.TP
|
||||||
|
.BI \-a\ (\-\-kexec-syscall-auto)
|
||||||
|
Try the new KEXEC_FILE_LOAD syscall first and when it is not supported or the
|
||||||
|
kernel does not understand the supplied image fall back to the old KEXEC_LOAD
|
||||||
|
interface.
|
||||||
|
|
||||||
|
-There is no one single interface that always works.
|
||||||
|
+There is no one single interface that always works, so this is the default.
|
||||||
|
|
||||||
|
KEXEC_FILE_LOAD is required on systems that use locked-down secure boot to
|
||||||
|
verify the kernel signature. KEXEC_LOAD may be also disabled in the kernel
|
||||||
|
diff --git a/kexec/kexec.c b/kexec/kexec.c
|
||||||
|
index 0e92d96..36bb2ad 100644
|
||||||
|
--- a/kexec/kexec.c
|
||||||
|
+++ b/kexec/kexec.c
|
||||||
|
@@ -1049,11 +1049,11 @@ void usage(void)
|
||||||
|
" to original kernel.\n"
|
||||||
|
" -s, --kexec-file-syscall Use file based syscall for kexec operation\n"
|
||||||
|
" -c, --kexec-syscall Use the kexec_load syscall for for compatibility\n"
|
||||||
|
- " with systems that don't support -s (default)\n"
|
||||||
|
+ " with systems that don't support -s\n"
|
||||||
|
" -a, --kexec-syscall-auto Use file based syscall for kexec and fall\n"
|
||||||
|
" back to the compatibility syscall when file based\n"
|
||||||
|
" syscall is not supported or the kernel did not\n"
|
||||||
|
- " understand the image\n"
|
||||||
|
+ " understand the image (default)\n"
|
||||||
|
" -d, --debug Enable debugging to help spot a failure.\n"
|
||||||
|
" -S, --status Return 1 if the type (by default crash) is loaded,\n"
|
||||||
|
" 0 if not.\n"
|
||||||
|
@@ -1407,8 +1407,8 @@ int main(int argc, char *argv[])
|
||||||
|
int do_ifdown = 0, skip_ifdown = 0;
|
||||||
|
int do_unload = 0;
|
||||||
|
int do_reuse_initrd = 0;
|
||||||
|
- int do_kexec_file_syscall = 0;
|
||||||
|
- int do_kexec_fallback = 0;
|
||||||
|
+ int do_kexec_file_syscall = 1;
|
||||||
|
+ int do_kexec_fallback = 1;
|
||||||
|
int skip_checks = 0;
|
||||||
|
int do_status = 0;
|
||||||
|
void *entry = 0;
|
||||||
|
--
|
||||||
|
2.33.1
|
||||||
|
|
@ -0,0 +1,211 @@
|
|||||||
|
From 806711fca9e9d52a677bf090565c32c858f2b12e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Julian Winkler <julian.winkler1@web.de>
|
||||||
|
Date: Thu, 23 Feb 2023 07:01:07 +0100
|
||||||
|
Subject: [PATCH 3/6] x86: add devicetree support
|
||||||
|
|
||||||
|
Since linux kernel has dropped support for simple firmware interface
|
||||||
|
(SFI), the only way of boot newer versions on intel MID platform is
|
||||||
|
using devicetree
|
||||||
|
|
||||||
|
Signed-off-by: Julian Winkler <julian.winkler1@web.de>
|
||||||
|
Signed-off-by: Simon Horman <horms@kernel.org>
|
||||||
|
---
|
||||||
|
kexec/arch/i386/include/arch/options.h | 4 +++-
|
||||||
|
kexec/arch/i386/kexec-beoboot-x86.c | 2 +-
|
||||||
|
kexec/arch/i386/kexec-bzImage.c | 21 ++++++++++++++++++++-
|
||||||
|
kexec/arch/i386/kexec-x86.h | 1 +
|
||||||
|
kexec/arch/i386/x86-linux-setup.c | 15 +++++++++++++++
|
||||||
|
kexec/arch/i386/x86-linux-setup.h | 2 ++
|
||||||
|
kexec/arch/x86_64/kexec-bzImage64.c | 2 +-
|
||||||
|
7 files changed, 43 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/i386/include/arch/options.h b/kexec/arch/i386/include/arch/options.h
|
||||||
|
index 0e57951..89e0a95 100644
|
||||||
|
--- a/kexec/arch/i386/include/arch/options.h
|
||||||
|
+++ b/kexec/arch/i386/include/arch/options.h
|
||||||
|
@@ -33,6 +33,7 @@
|
||||||
|
#define OPT_PASS_MEMMAP_CMDLINE (OPT_ARCH_MAX+11)
|
||||||
|
#define OPT_NOEFI (OPT_ARCH_MAX+12)
|
||||||
|
#define OPT_REUSE_VIDEO_TYPE (OPT_ARCH_MAX+13)
|
||||||
|
+#define OPT_DTB (OPT_ARCH_MAX+14)
|
||||||
|
|
||||||
|
/* Options relevant to the architecture (excluding loader-specific ones): */
|
||||||
|
#define KEXEC_ARCH_OPTIONS \
|
||||||
|
@@ -76,7 +77,8 @@
|
||||||
|
{ "args-none", 0, NULL, OPT_ARGS_NONE }, \
|
||||||
|
{ "module", 1, 0, OPT_MOD }, \
|
||||||
|
{ "real-mode", 0, NULL, OPT_REAL_MODE }, \
|
||||||
|
- { "entry-32bit", 0, NULL, OPT_ENTRY_32BIT },
|
||||||
|
+ { "entry-32bit", 0, NULL, OPT_ENTRY_32BIT }, \
|
||||||
|
+ { "dtb", 1, NULL, OPT_DTB },
|
||||||
|
|
||||||
|
#define KEXEC_ALL_OPT_STR KEXEC_ARCH_OPT_STR
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/i386/kexec-beoboot-x86.c b/kexec/arch/i386/kexec-beoboot-x86.c
|
||||||
|
index b121834..d949ab8 100644
|
||||||
|
--- a/kexec/arch/i386/kexec-beoboot-x86.c
|
||||||
|
+++ b/kexec/arch/i386/kexec-beoboot-x86.c
|
||||||
|
@@ -125,7 +125,7 @@ int beoboot_load(int argc, char **argv, const char *buf, off_t UNUSED(len),
|
||||||
|
kernel, bb_header.kernel_size,
|
||||||
|
command_line, bb_header.cmdline_size,
|
||||||
|
initrd, bb_header.initrd_size,
|
||||||
|
- real_mode_entry);
|
||||||
|
+ 0, 0, real_mode_entry);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
diff --git a/kexec/arch/i386/kexec-bzImage.c b/kexec/arch/i386/kexec-bzImage.c
|
||||||
|
index df8985d..1b8f20c 100644
|
||||||
|
--- a/kexec/arch/i386/kexec-bzImage.c
|
||||||
|
+++ b/kexec/arch/i386/kexec-bzImage.c
|
||||||
|
@@ -95,6 +95,7 @@ void bzImage_usage(void)
|
||||||
|
" --reuse-cmdline Use kernel command line from running system.\n"
|
||||||
|
" --initrd=FILE Use FILE as the kernel's initial ramdisk.\n"
|
||||||
|
" --ramdisk=FILE Use FILE as the kernel's initial ramdisk.\n"
|
||||||
|
+ " --dtb=FILE Use FILE as devicetree.\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
@@ -103,6 +104,7 @@ int do_bzImage_load(struct kexec_info *info,
|
||||||
|
const char *kernel, off_t kernel_len,
|
||||||
|
const char *command_line, off_t command_line_len,
|
||||||
|
const char *initrd, off_t initrd_len,
|
||||||
|
+ const char *dtb, off_t dtb_len,
|
||||||
|
int real_mode_entry)
|
||||||
|
{
|
||||||
|
struct x86_linux_header setup_header;
|
||||||
|
@@ -373,6 +375,10 @@ int do_bzImage_load(struct kexec_info *info,
|
||||||
|
setup_linux_system_parameters(info, real_mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (dtb) {
|
||||||
|
+ setup_linux_dtb(info, real_mode, dtb, dtb_len);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -381,13 +387,15 @@ int bzImage_load(int argc, char **argv, const char *buf, off_t len,
|
||||||
|
{
|
||||||
|
char *command_line = NULL;
|
||||||
|
char *tmp_cmdline = NULL;
|
||||||
|
- const char *ramdisk, *append = NULL;
|
||||||
|
+ const char *ramdisk, *append = NULL, *dtb;
|
||||||
|
char *ramdisk_buf;
|
||||||
|
off_t ramdisk_length;
|
||||||
|
int command_line_len;
|
||||||
|
int real_mode_entry;
|
||||||
|
int opt;
|
||||||
|
int result;
|
||||||
|
+ char *dtb_buf;
|
||||||
|
+ off_t dtb_length;
|
||||||
|
|
||||||
|
/* See options.h -- add any more there, too. */
|
||||||
|
static const struct option options[] = {
|
||||||
|
@@ -398,6 +406,7 @@ int bzImage_load(int argc, char **argv, const char *buf, off_t len,
|
||||||
|
{ "initrd", 1, 0, OPT_RAMDISK },
|
||||||
|
{ "ramdisk", 1, 0, OPT_RAMDISK },
|
||||||
|
{ "real-mode", 0, 0, OPT_REAL_MODE },
|
||||||
|
+ { "dtb", 1, 0, OPT_DTB },
|
||||||
|
{ 0, 0, 0, 0 },
|
||||||
|
};
|
||||||
|
static const char short_options[] = KEXEC_ARCH_OPT_STR "d";
|
||||||
|
@@ -405,6 +414,8 @@ int bzImage_load(int argc, char **argv, const char *buf, off_t len,
|
||||||
|
real_mode_entry = 0;
|
||||||
|
ramdisk = 0;
|
||||||
|
ramdisk_length = 0;
|
||||||
|
+ dtb = 0;
|
||||||
|
+ dtb_length = 0;
|
||||||
|
while((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) {
|
||||||
|
switch(opt) {
|
||||||
|
default:
|
||||||
|
@@ -424,6 +435,9 @@ int bzImage_load(int argc, char **argv, const char *buf, off_t len,
|
||||||
|
case OPT_REAL_MODE:
|
||||||
|
real_mode_entry = 1;
|
||||||
|
break;
|
||||||
|
+ case OPT_DTB:
|
||||||
|
+ dtb = optarg;
|
||||||
|
+ break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
command_line = concat_cmdline(tmp_cmdline, append);
|
||||||
|
@@ -441,10 +455,15 @@ int bzImage_load(int argc, char **argv, const char *buf, off_t len,
|
||||||
|
if (ramdisk) {
|
||||||
|
ramdisk_buf = slurp_file(ramdisk, &ramdisk_length);
|
||||||
|
}
|
||||||
|
+ dtb_buf = 0;
|
||||||
|
+ if (dtb) {
|
||||||
|
+ dtb_buf = slurp_file(dtb, &dtb_length);
|
||||||
|
+ }
|
||||||
|
result = do_bzImage_load(info,
|
||||||
|
buf, len,
|
||||||
|
command_line, command_line_len,
|
||||||
|
ramdisk_buf, ramdisk_length,
|
||||||
|
+ dtb_buf, dtb_length,
|
||||||
|
real_mode_entry);
|
||||||
|
|
||||||
|
free(command_line);
|
||||||
|
diff --git a/kexec/arch/i386/kexec-x86.h b/kexec/arch/i386/kexec-x86.h
|
||||||
|
index 71e4329..46e2898 100644
|
||||||
|
--- a/kexec/arch/i386/kexec-x86.h
|
||||||
|
+++ b/kexec/arch/i386/kexec-x86.h
|
||||||
|
@@ -79,6 +79,7 @@ int do_bzImage_load(struct kexec_info *info,
|
||||||
|
const char *kernel, off_t kernel_len,
|
||||||
|
const char *command_line, off_t command_line_len,
|
||||||
|
const char *initrd, off_t initrd_len,
|
||||||
|
+ const char *dtb, off_t dtb_len,
|
||||||
|
int real_mode_entry);
|
||||||
|
|
||||||
|
int beoboot_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 14263b0..9a281dc 100644
|
||||||
|
--- a/kexec/arch/i386/x86-linux-setup.c
|
||||||
|
+++ b/kexec/arch/i386/x86-linux-setup.c
|
||||||
|
@@ -954,3 +954,18 @@ void setup_linux_system_parameters(struct kexec_info *info,
|
||||||
|
/* Always try to fill acpi_rsdp_addr */
|
||||||
|
real_mode->acpi_rsdp_addr = get_acpi_rsdp();
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+void setup_linux_dtb(struct kexec_info *info, struct x86_linux_param_header *real_mode,
|
||||||
|
+ const char *dtb_buf, int dtb_len)
|
||||||
|
+{
|
||||||
|
+ struct setup_data *sd;
|
||||||
|
+
|
||||||
|
+ sd = xmalloc(sizeof(struct setup_data) + dtb_len);
|
||||||
|
+ sd->next = 0;
|
||||||
|
+ sd->len = dtb_len;
|
||||||
|
+ sd->type = SETUP_DTB;
|
||||||
|
+ memcpy(sd->data, dtb_buf, dtb_len);
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+ add_setup_data(info, real_mode, sd);
|
||||||
|
+}
|
||||||
|
diff --git a/kexec/arch/i386/x86-linux-setup.h b/kexec/arch/i386/x86-linux-setup.h
|
||||||
|
index 0c651e5..b5e1ad5 100644
|
||||||
|
--- a/kexec/arch/i386/x86-linux-setup.h
|
||||||
|
+++ b/kexec/arch/i386/x86-linux-setup.h
|
||||||
|
@@ -21,6 +21,8 @@ static inline void setup_linux_bootloader_parameters(
|
||||||
|
}
|
||||||
|
void setup_linux_system_parameters(struct kexec_info *info,
|
||||||
|
struct x86_linux_param_header *real_mode);
|
||||||
|
+void setup_linux_dtb(struct kexec_info *info, struct x86_linux_param_header *real_mode,
|
||||||
|
+ const char *dtb_buf, int dtb_len);
|
||||||
|
int get_bootparam(void *buf, off_t offset, size_t size);
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/x86_64/kexec-bzImage64.c b/kexec/arch/x86_64/kexec-bzImage64.c
|
||||||
|
index ba8dc48..aba4e3b 100644
|
||||||
|
--- a/kexec/arch/x86_64/kexec-bzImage64.c
|
||||||
|
+++ b/kexec/arch/x86_64/kexec-bzImage64.c
|
||||||
|
@@ -386,7 +386,7 @@ int bzImage64_load(int argc, char **argv, const char *buf, off_t len,
|
||||||
|
if (entry_16bit || entry_32bit)
|
||||||
|
result = do_bzImage_load(info, buf, len, command_line,
|
||||||
|
command_line_len, ramdisk_buf,
|
||||||
|
- ramdisk_length, entry_16bit);
|
||||||
|
+ ramdisk_length, 0, 0, entry_16bit);
|
||||||
|
else
|
||||||
|
result = do_bzImage64_load(info, buf, len, command_line,
|
||||||
|
command_line_len, ramdisk_buf,
|
||||||
|
--
|
||||||
|
2.33.1
|
||||||
|
|
@ -0,0 +1,68 @@
|
|||||||
|
From 63e9a012112e418876413bf45440118d69d85189 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gautam Menghani <gautam@linux.vnet.ibm.com>
|
||||||
|
Date: Wed, 1 Mar 2023 03:58:19 -0500
|
||||||
|
Subject: [PATCH 4/6] ppc64: Add elf-ppc64 file types/options and an arch
|
||||||
|
specific flag to man page
|
||||||
|
|
||||||
|
Document the elf-ppc64 file options and the "--dt-no-old-root" arch
|
||||||
|
specific flag in the man page.
|
||||||
|
|
||||||
|
Signed-off-by: Gautam Menghani <gautam@linux.vnet.ibm.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@kernel.org>
|
||||||
|
---
|
||||||
|
kexec/kexec.8 | 35 +++++++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 35 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/kexec/kexec.8 b/kexec/kexec.8
|
||||||
|
index 66453b8..3a344c5 100644
|
||||||
|
--- a/kexec/kexec.8
|
||||||
|
+++ b/kexec/kexec.8
|
||||||
|
@@ -335,6 +335,37 @@ with command-line arguments
|
||||||
|
.I "arg1 arg2 ..."
|
||||||
|
This parameter can be specified multiple times.
|
||||||
|
.RE
|
||||||
|
+.PP
|
||||||
|
+.B elf-ppc64
|
||||||
|
+.RS
|
||||||
|
+.TP
|
||||||
|
+.BI \-\-reuse-cmdline
|
||||||
|
+Use the kernel command line from the running system.
|
||||||
|
+.TP
|
||||||
|
+.BI \-\-command\-line= string
|
||||||
|
+Set the kernel command line to
|
||||||
|
+.IR string.
|
||||||
|
+.TP
|
||||||
|
+.BI \-\-append= string
|
||||||
|
+Set the kernel command line to
|
||||||
|
+.IR string.
|
||||||
|
+.TP
|
||||||
|
+.BI \-\-ramdisk= file
|
||||||
|
+Use
|
||||||
|
+.IR file
|
||||||
|
+as the initial RAM disk.
|
||||||
|
+.TP
|
||||||
|
+.BI \-\-initrd= file
|
||||||
|
+Use
|
||||||
|
+.IR file
|
||||||
|
+as the initial RAM disk.
|
||||||
|
+.TP
|
||||||
|
+.BI \-\-devicetreeblob= file
|
||||||
|
+Specify device tree blob file. Not applicable while using --kexec-file-syscall.
|
||||||
|
+.TP
|
||||||
|
+.BI \-\-dtb= file
|
||||||
|
+Specify device tree blob file. Not applicable while using --kexec-file-syscall.
|
||||||
|
+.RE
|
||||||
|
|
||||||
|
.SH ARCHITECTURE OPTIONS
|
||||||
|
.TP
|
||||||
|
@@ -362,3 +393,7 @@ for debug output.
|
||||||
|
Specify the
|
||||||
|
.I baud rate
|
||||||
|
of the serial port.
|
||||||
|
+.TP
|
||||||
|
+.BI \-\-dt\-no\-old\-root
|
||||||
|
+Do not reuse old kernel root=<device>
|
||||||
|
+param while creating flatten device tree.
|
||||||
|
--
|
||||||
|
2.33.1
|
||||||
|
|
Loading…
Reference in new issue