Skip to contentSkip to conversation

kexec: put bzImage and ramdisk above 4G for x86 64bit

PATCH Superseded Yinghai Lu 2 participants 10 messages Nov 24, 2012 – Nov 25, 2012

Subsystems (2)

v4 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Yinghai Lu

author
#0 lore raw

v4 cover kexec: put bzImage and ramdisk above 4G for x86 64bit

Now we have limit kdump reserved under 896M, because kexec has the limitation. and also bzImage need to stay under 4g.

kernel parts changes could be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/yinghai/linux-yinghai.git for-x86-boot

here patches are for kexec tools to load bzImage and ramdisk high acccording to new added boot header fields.

-v3: address review from Eric to use locate_hole at first.
use xloadflags instead.
-v4: remove the restriction about bzImage not crossing GB boundary.
add real-mode fix for bzImage.
add --entry-32bit and --real-mode for skip bzImage64.

Yinghai Lu (6):
kexec, x86: clean boot_params area for entry-32bit path kexec, x86: Fix bzImage real-mode booting
kexec, x86: add boot header member for version 2.12 kexec, x86: put ramdisk high for 64bit bzImage kexec, x86: set ext_cmd_line_ptr when boot_param is above 4g kexec, x86_64: Load bzImage64 above 4G

 include/x86/x86-linux.h                |   32 +++-
 kexec/arch/i386/include/arch/options.h |    4 +-
 kexec/arch/i386/kexec-bzImage.c        |   80 +++++++--
 kexec/arch/i386/x86-linux-setup.c      |   25 ++-
 kexec/arch/x86_64/Makefile             |    1 +
 kexec/arch/x86_64/kexec-bzImage64.c    |  334 ++++++++++++++++++++++++++++++++
 kexec/arch/x86_64/kexec-x86_64.c       |    1 +
 kexec/arch/x86_64/kexec-x86_64.h       |    5 +
 8 files changed, 460 insertions(+), 22 deletions(-)
 create mode 100644 kexec/arch/x86_64/kexec-bzImage64.c
Signature · 7 lines
1.7.7


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
author
#1 lore raw

PATCH v4 1/6 kexec, x86: clean boot_params area for entry-32bit path

kexec bzImage path setup data is shared with real-mode path, and setup_header is copied together with setup_code.
Later 32bit just use whole area as boot_params for real_mode_data. but those area for boot_params around setup_header is not cleaned that will leave some field in boot_param as non-zero value.

So clean around setup_header area for non real-mode entry path.

---
 kexec/arch/i386/kexec-bzImage.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
kexec/arch/i386/kexec-bzImage.c +15 -0
index 6998587..80d09e7 100644
@@ -98,6 +98,19 @@ void bzImage_usage(void)
        
 }
 
+static void clean_boot_params(unsigned char *real_mode, unsigned long size)
+{
+	unsigned long end;
+
+	/* clear value before header */
+	memset(real_mode, 0, 0x1f1);
+	/* clear value after setup_header  */
+	end = *(real_mode + 0x201);
+	end += 0x202;
+	if (end < size)
+		memset(real_mode + end, 0, size - end);
+}
+
 int do_bzImage_load(struct kexec_info *info,
 	const char *kernel, off_t kernel_len,
 	const char *command_line, off_t command_line_len,
@@ -212,6 +225,8 @@ int do_bzImage_load(struct kexec_info *info,
 	setup_size = kern16_size + command_line_len + PURGATORY_CMDLINE_SIZE;
 	real_mode = xmalloc(setup_size);
 	memcpy(real_mode, kernel, kern16_size);
+	if (!real_mode_entry)
+		clean_boot_params((unsigned char *)real_mode, kern16_size);
 
 	if (info->kexec_flags & (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT)) {
 		/* If using bzImage for capture kernel, then we will not be
Signature · 7 lines
1.7.7


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
author
#2 lore raw

PATCH v4 2/6 kexec, x86: Fix bzImage real-mode booting

In reply to Yinghai Lu

We need to keep space for bss, heap/stack before command line. otherwise command_line will be cleared by kernel 16bit init code.

also need to set 32bit start in real_mode header, kernel 16bit code need to jump there.

Also don't touch regs16 if --real-mode is not specified.

---
 kexec/arch/i386/kexec-bzImage.c |   63 +++++++++++++++++++++++++++++++-------
 1 files changed, 51 insertions(+), 12 deletions(-)
kexec/arch/i386/kexec-bzImage.c +51 -12
index 80d09e7..d83f0a9 100644
@@ -130,6 +130,8 @@ int do_bzImage_load(struct kexec_info *info,
 	unsigned long kernel32_load_addr;
 	char *modified_cmdline;
 	unsigned long cmdline_end;
+	unsigned long kern16_size_needed;
+	unsigned long heap_size = 0;
 
 	/*
 	 * Find out about the file I am about to load.
@@ -221,9 +223,31 @@ int do_bzImage_load(struct kexec_info *info,
 		elf_rel_build_load(info, &info->rhdr, purgatory, purgatory_size,
 					0x3000, 640*1024, -1, 0);
 	dbgprintf("Loaded purgatory at addr 0x%lx\n", info->rhdr.rel_addr);
+
 	/* The argument/parameter segment */
-	setup_size = kern16_size + command_line_len + PURGATORY_CMDLINE_SIZE;
+	if (real_mode_entry) {
+		/* need to include size for bss and heap etc */
+		if (setup_header.protocol_version >= 0x0201)
+			kern16_size_needed = setup_header.heap_end_ptr;
+		else
+			kern16_size_needed = kern16_size + 8192; /* bss */
+		if (kern16_size_needed < kern16_size)
+			kern16_size_needed = kern16_size;
+		if (kern16_size_needed > 0xfffc)
+			die("kern16_size_needed is more then 64k\n");
+		heap_size = 0xfffc - kern16_size_needed; /* less 64k */
+		heap_size &= ~(0x200 - 1);
+		kern16_size_needed += heap_size;
+	} else {
+		kern16_size_needed = kern16_size;
+		/* need to bigger than size of struct bootparams */
+		if (kern16_size_needed < 4096)
+			kern16_size_needed = 4096;
+	}
+	setup_size = kern16_size_needed + command_line_len +
+			 PURGATORY_CMDLINE_SIZE;
 	real_mode = xmalloc(setup_size);
+	memset(real_mode, 0, setup_size);
 	memcpy(real_mode, kernel, kern16_size);
 	if (!real_mode_entry)
 		clean_boot_params((unsigned char *)real_mode, kern16_size);
@@ -280,11 +304,20 @@ int do_bzImage_load(struct kexec_info *info,
 
 	/* Tell the kernel what is going on */
 	setup_linux_bootloader_parameters(info, real_mode, setup_base,
-		kern16_size, command_line, command_line_len,
+		kern16_size_needed, command_line, command_line_len,
 		initrd, initrd_len);
 
+	if (real_mode_entry) {
+		/* restore can use heap and load high */
+		real_mode->loader_flags = 0x81;
+		if (real_mode->protocol_version >= 0x0201)
+			real_mode->heap_end_ptr += heap_size - 0x200; /*stack*/
+	}
+
 	/* Get the initial register values */
-	elf_rel_get_symbol(&info->rhdr, "entry16_regs", &regs16, sizeof(regs16));
+	if (real_mode_entry)
+		elf_rel_get_symbol(&info->rhdr, "entry16_regs",
+					 &regs16, sizeof(regs16));
 	elf_rel_get_symbol(&info->rhdr, "entry32_regs", &regs32, sizeof(regs32));
 	/*
 
@@ -303,16 +336,18 @@ int do_bzImage_load(struct kexec_info *info,
 	/*
 	 * Initialize the 16bit start information.
 	 */
-	regs16.ds = regs16.es = regs16.fs = regs16.gs = setup_base >> 4;
-	regs16.cs = regs16.ds + 0x20;
-	regs16.ip = 0;
-	/* XXX: Documentation/i386/boot.txt says 'ss' must equal 'ds' */
-	regs16.ss = (elf_rel_get_addr(&info->rhdr, "stack_end") - 64*1024) >> 4;
-	/* XXX: Documentation/i386/boot.txt says 'sp' must equal heap_end */
-	regs16.esp = 0xFFFC;
 	if (real_mode_entry) {
+		regs16.ds = regs16.es = regs16.fs = regs16.gs = setup_base >> 4;
+		regs16.cs = regs16.ds + 0x20;
+		regs16.ip = 0;
+		/* XXX: Documentation/i386/boot.txt says 'ss' must equal 'ds' */
+		regs16.ss = (elf_rel_get_addr(&info->rhdr, "stack_end") - 64*1024) >> 4;
+		/* XXX: Documentation/i386/boot.txt says 'sp' must equal heap_end */
+		regs16.esp = 0xFFFC;
+
 		printf("Starting the kernel in real mode\n");
 		regs32.eip = elf_rel_get_addr(&info->rhdr, "entry16");
+		real_mode->kernel_start = kernel32_load_addr;
 	}
 	if (real_mode_entry && kexec_debug) {
 		unsigned long entry16_debug, pre32, first32;
@@ -332,8 +367,12 @@ int do_bzImage_load(struct kexec_info *info,
 	
 		regs32.eip = entry16_debug;
 	}
-	elf_rel_set_symbol(&info->rhdr, "entry16_regs", &regs16, sizeof(regs16));
-	elf_rel_set_symbol(&info->rhdr, "entry16_debug_regs", &regs16, sizeof(regs16));
+	if (real_mode_entry) {
+		elf_rel_set_symbol(&info->rhdr, "entry16_regs",
+					 &regs16, sizeof(regs16));
+		elf_rel_set_symbol(&info->rhdr, "entry16_debug_regs",
+					 &regs16, sizeof(regs16));
+	}
 	elf_rel_set_symbol(&info->rhdr, "entry32_regs", &regs32, sizeof(regs32));
 	cmdline_end = setup_base + kern16_size + command_line_len - 1;
 	elf_rel_set_symbol(&info->rhdr, "cmdline_end", &cmdline_end,
Signature · 7 lines
1.7.7


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
author
#3 lore raw

PATCH v4 3/6 kexec, x86: add boot header member for version 2.12

In reply to Yinghai Lu

will use ext_ramdisk_image/size, and xloadflags to put ramdisk and bzImage high for 64bit.

---
 include/x86/x86-linux.h |   32 +++++++++++++++++++++++++++-----
 1 files changed, 27 insertions(+), 5 deletions(-)
include/x86/x86-linux.h +27 -5
index 27af02b..a2452f2 100644
@@ -32,7 +32,7 @@ struct drive_info_struct {
 };
 struct sys_desc_table {
 	uint16_t length;
-	uint8_t  table[318];
+	uint8_t  table[30];
 };
 
 struct apm_bios_info {
@@ -112,6 +112,10 @@ struct x86_linux_param_header {
 	struct apm_bios_info apm_bios_info;	/* 0x40 */
 	struct drive_info_struct drive_info;	/* 0x80 */
 	struct sys_desc_table sys_desc_table;	/* 0xa0 */
+	uint32_t ext_ramdisk_image;		/* 0xc0 */
+	uint32_t ext_ramdisk_size;		/* 0xc4 */
+	uint32_t ext_cmd_line_ptr;		/* 0xc8 */
+	uint8_t reserved4_1[0x1e0 - 0xcc];	/* 0xcc */
 	uint32_t alt_mem_k;			/* 0x1e0 */
 	uint8_t  reserved5[4];			/* 0x1e4 */
 	uint8_t  e820_map_nr;			/* 0x1e8 */
@@ -174,11 +178,18 @@ struct x86_linux_param_header {
 	/* 2.04+ */
 	uint32_t kernel_alignment;		/* 0x230 */
 	uint8_t  relocatable_kernel;		/* 0x234 */
-	uint8_t  reserved15[3];			/* 0x235 */
+	uint8_t  min_alignment;			/* 0x235 */
+	uint16_t xloadflags;			/* 0x236 */
 	uint32_t cmdline_size;			/* 0x238 */
 	uint32_t hardware_subarch;		/* 0x23C */
 	uint64_t hardware_subarch_data;		/* 0x240 */
-	uint8_t  reserved16[0x290 - 0x248];	/* 0x248 */
+	uint32_t payload_offset;		/* 0x248 */
+	uint32_t payload_length;		/* 0x24C */
+	uint64_t setup_data;			/* 0x250 */
+	uint64_t pref_address;			/* 0x258 */
+	uint32_t init_size;			/* 0x260 */
+	uint32_t handover_offset;		/* 0x264 */
+	uint8_t  reserved16[0x290 - 0x268];	/* 0x268 */
 	uint32_t edd_mbr_sig_buffer[EDD_MBR_SIG_MAX];	/* 0x290 */
 #endif
 	struct 	e820entry e820_map[E820MAX];	/* 0x2d0 */
@@ -195,7 +206,11 @@ struct x86_linux_faked_param_header {
 };
 
 struct x86_linux_header {
-	uint8_t  reserved1[0x1f1];		/* 0x000 */
+	uint8_t  reserved1[0xc0];		/* 0x000 */
+	uint32_t ext_ramdisk_image;		/* 0x0c0 */
+	uint32_t ext_ramdisk_size;		/* 0x0c4 */
+	uint32_t ext_cmd_line_ptr;		/* 0x0c8 */
+	uint8_t  reserved1_1[0x1f1-0xcc];	/* 0x0cc */
 	uint8_t  setup_sects;			/* 0x1f1 */
 	uint16_t root_flags;			/* 0x1f2 */
 	uint16_t syssize;			/* 0x1f4 */
@@ -241,10 +256,17 @@ struct x86_linux_header {
 #else
 	uint32_t kernel_alignment;		/* 0x230 */
 	uint8_t  relocatable_kernel;		/* 0x234 */
-	uint8_t  reserved6[3];			/* 0x235 */
+	uint8_t  min_alignment;			/* 0x235 */
+	uint16_t xloadflags;			/* 0x236 */
 	uint32_t cmdline_size;                  /* 0x238 */
 	uint32_t hardware_subarch;              /* 0x23C */
 	uint64_t hardware_subarch_data;         /* 0x240 */
+	uint32_t payload_offset;		/* 0x248 */
+	uint32_t payload_length;		/* 0x24C */
+	uint64_t setup_data;			/* 0x250 */
+	uint64_t pref_address;			/* 0x258 */
+	uint32_t init_size;			/* 0x260 */
+	uint32_t handover_offset;		/* 0x264 */
 #endif
 } PACKED;
 
Signature · 7 lines
1.7.7


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
author
#4 lore raw

PATCH v4 4/6 kexec, x86: put ramdisk high for 64bit bzImage

In reply to Yinghai Lu

We could put ramdisk high for bzImage on 64bit for protocol 2.12.

-v2: change ext_... handling to way that eric like.

---
 kexec/arch/i386/kexec-bzImage.c   |    2 ++
 kexec/arch/i386/x86-linux-setup.c |   18 +++++++++++++++---
 2 files changed, 17 insertions(+), 3 deletions(-)
kexec/arch/i386/kexec-bzImage.c +2 -0
index d83f0a9..30c38e2 100644
@@ -251,6 +251,8 @@ int do_bzImage_load(struct kexec_info *info,
 	memcpy(real_mode, kernel, kern16_size);
 	if (!real_mode_entry)
 		clean_boot_params((unsigned char *)real_mode, kern16_size);
+	/* disable loading above 4g */
+	real_mode->xloadflags &= ~1;
 
 	if (info->kexec_flags & (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT)) {
 		/* If using bzImage for capture kernel, then we will not be
kexec/arch/i386/x86-linux-setup.c +15 -3
index b7ab8ea..3c31f64 100644
@@ -64,7 +64,11 @@ void setup_linux_bootloader_parameters(
 	/* Find the maximum initial ramdisk address */
 	initrd_addr_max = DEFAULT_INITRD_ADDR_MAX;
 	if (real_mode->protocol_version >= 0x0203) {
-		initrd_addr_max = real_mode->initrd_addr_max;
+		if (real_mode->protocol_version >= 0x020c &&
+		    real_mode->xloadflags & 1)
+			initrd_addr_max = ULONG_MAX;
+		else
+			initrd_addr_max = real_mode->initrd_addr_max;
 		dbgprintf("initrd_addr_max is 0x%lx\n", initrd_addr_max);
 	}
 
@@ -81,8 +85,16 @@ void setup_linux_bootloader_parameters(
 	}
 
 	/* Ramdisk address and size */
-	real_mode->initrd_start = initrd_base;
-	real_mode->initrd_size  = initrd_size;
+	real_mode->initrd_start = initrd_base & 0xffffffffUL;
+	real_mode->initrd_size  = initrd_size & 0xffffffffUL;
+
+	if (real_mode->protocol_version >= 0x020c &&
+	    (initrd_base & 0xffffffffUL) != initrd_base)
+		real_mode->ext_ramdisk_image = initrd_base >> 32;
+
+	if (real_mode->protocol_version >= 0x020c &&
+	    (initrd_size & 0xffffffffUL) != initrd_size)
+		real_mode->ext_ramdisk_size = initrd_size >> 32;
 
 	/* The location of the command line */
 	/* if (real_mode_base == 0x90000) { */
Signature · 7 lines
1.7.7


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
author
#5 lore raw

Re: [PATCH v4 4/6] kexec, x86: put ramdisk high for 64bit bzImage

Quoted 3 lines · Yinghai Lu

We could put ramdisk high for bzImage on 64bit for protocol 2.12.

-v2: change ext_... handling to way that eric like.

-v5 attached

Subject: [PATCH v5 4/6] kexec, x86: put ramdisk high for 64bit bzImage

We could put ramdisk high for bzImage on 64bit for protocol 2.12.

-v2: change ext_... handling to way that eric like.

---
 kexec/arch/i386/x86-linux-setup.c |   18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
kexec/arch/i386/x86-linux-setup.c +15 -3
Index: kexec-tools/kexec/arch/i386/x86-linux-setup.c
===================================================================
@@ -64,7 +64,11 @@ void setup_linux_bootloader_parameters(
 	/* Find the maximum initial ramdisk address */
 	initrd_addr_max = DEFAULT_INITRD_ADDR_MAX;
 	if (real_mode->protocol_version >= 0x0203) {
-		initrd_addr_max = real_mode->initrd_addr_max;
+		if (real_mode->protocol_version >= 0x020c &&
+		    real_mode->xloadflags & (1<<15)) /* USE_EXT_BOOT_PARAMS */
+			initrd_addr_max = ULONG_MAX;
+		else
+			initrd_addr_max = real_mode->initrd_addr_max;
 		dbgprintf("initrd_addr_max is 0x%lx\n", initrd_addr_max);
 	}
 
@@ -81,8 +85,16 @@ void setup_linux_bootloader_parameters(
 	}
 
 	/* Ramdisk address and size */
-	real_mode->initrd_start = initrd_base;
-	real_mode->initrd_size  = initrd_size;
+	real_mode->initrd_start = initrd_base & 0xffffffffUL;
+	real_mode->initrd_size  = initrd_size & 0xffffffffUL;
+
+	if (real_mode->protocol_version >= 0x020c &&
+	    (initrd_base & 0xffffffffUL) != initrd_base)
+		real_mode->ext_ramdisk_image = initrd_base >> 32;
+
+	if (real_mode->protocol_version >= 0x020c &&
+	    (initrd_size & 0xffffffffUL) != initrd_size)
+		real_mode->ext_ramdisk_size = initrd_size >> 32;
 
 	/* The location of the command line */
 	/* if (real_mode_base == 0x90000) { */

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

author
#6 lore raw

PATCH v4 5/6 kexec, x86: set ext_cmd_line_ptr when boot_param is above 4g

In reply to Yinghai Lu

update ext_cmd_line_ptr for bzImage from protocal 2.12 that could have command line above 4g.

-v2: update ext_... handling to the way that Eric likes.

---
 kexec/arch/i386/x86-linux-setup.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
kexec/arch/i386/x86-linux-setup.c +6 -1
index 3c31f64..d12dab1 100644
@@ -103,7 +103,12 @@ void setup_linux_bootloader_parameters(
 		/* setup_move_size */
 	/* } */
 	if (real_mode->protocol_version >= 0x0202) {
-		real_mode->cmd_line_ptr = real_mode_base + cmdline_offset;
+		unsigned long cmd_line_ptr = real_mode_base + cmdline_offset;
+
+		real_mode->cmd_line_ptr = cmd_line_ptr & 0xffffffffUL;
+		if ((real_mode->protocol_version >= 0x020c) &&
+		    ((cmd_line_ptr & 0xffffffffUL) != cmd_line_ptr))
+			real_mode->ext_cmd_line_ptr = cmd_line_ptr >> 32;
 	}
 
 	/* Fill in the command line */
Signature · 7 lines
1.7.7


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
author
#7 lore raw

PATCH v4 6/6 kexec, x86_64: Load bzImage64 above 4G

In reply to Yinghai Lu

need to check xloadflags to see the bzImage is for 64bit relocatable.

-v2: add kexec-bzImage64.c according to Eric.
-v3: don't need to purgatory under 2g after Eric's change to purgatory code. -v4: use locate_hole find position first then add_buffer... suggested by Eric
add buffer for kernel image at last to make kexec-load faster. use xloadflags in setup_header to tell if is bzImage64. remove not cross GB boundary searching.
add --entry-32bit and --real-mode for skipping bzImage64.

---
 kexec/arch/i386/include/arch/options.h |    4 +-
 kexec/arch/x86_64/Makefile             |    1 +
 kexec/arch/x86_64/kexec-bzImage64.c    |  334 ++++++++++++++++++++++++++++++++
 kexec/arch/x86_64/kexec-x86_64.c       |    1 +
 kexec/arch/x86_64/kexec-x86_64.h       |    5 +
 5 files changed, 344 insertions(+), 1 deletions(-)
 create mode 100644 kexec/arch/x86_64/kexec-bzImage64.c
kexec/arch/i386/include/arch/options.h +3 -1
index 89dbd26..aaac731 100644
@@ -29,6 +29,7 @@
 #define OPT_MOD 		(OPT_ARCH_MAX+7)
 #define OPT_VGA 		(OPT_ARCH_MAX+8)
 #define OPT_REAL_MODE		(OPT_ARCH_MAX+9)
+#define OPT_ENTRY_32BIT		(OPT_ARCH_MAX+10)
 
 /* Options relevant to the architecture (excluding loader-specific ones): */
 #define KEXEC_ARCH_OPTIONS \
@@ -68,7 +69,8 @@
 	{ "args-linux",		0, NULL, OPT_ARGS_LINUX },	\
 	{ "args-none",		0, NULL, OPT_ARGS_NONE },	\
 	{ "module",		1, 0, OPT_MOD },		\
-	{ "real-mode",		0, NULL, OPT_REAL_MODE },
+	{ "real-mode",		0, NULL, OPT_REAL_MODE },	\
+	{ "entry-32bit",	0, NULL, OPT_ENTRY_32BIT },
 
 #define KEXEC_ALL_OPT_STR KEXEC_ARCH_OPT_STR
 
kexec/arch/x86_64/Makefile +1 -0
index 405bdf5..1cf10f9 100644
@@ -13,6 +13,7 @@ x86_64_KEXEC_SRCS += kexec/arch/i386/crashdump-x86.c
 x86_64_KEXEC_SRCS_native =  kexec/arch/x86_64/kexec-x86_64.c
 x86_64_KEXEC_SRCS_native += kexec/arch/x86_64/kexec-elf-x86_64.c
 x86_64_KEXEC_SRCS_native += kexec/arch/x86_64/kexec-elf-rel-x86_64.c
+x86_64_KEXEC_SRCS_native += kexec/arch/x86_64/kexec-bzImage64.c
 
 x86_64_KEXEC_SRCS += $(x86_64_KEXEC_SRCS_native)
 
kexec/arch/x86_64/kexec-bzImage64.c new file +334 -0

334 lines not on this page · raw message

kexec/arch/x86_64/kexec-x86_64.c +1 -0
index 6c42c32..5c23e01 100644
@@ -37,6 +37,7 @@ struct file_type file_type[] = {
 	{ "multiboot-x86", multiboot_x86_probe, multiboot_x86_load,
 	  multiboot_x86_usage },
 	{ "elf-x86", elf_x86_probe, elf_x86_load, elf_x86_usage },
+	{ "bzImage64", bzImage64_probe, bzImage64_load, bzImage64_usage },
 	{ "bzImage", bzImage_probe, bzImage_load, bzImage_usage },
 	{ "beoboot-x86", beoboot_probe, beoboot_load, beoboot_usage },
 	{ "nbi-x86", nbi_probe, nbi_load, nbi_usage },
kexec/arch/x86_64/kexec-x86_64.h +5 -0
index a97cd71..4cdeffb 100644
@@ -28,4 +28,9 @@ int elf_x86_64_load(int argc, char **argv, const char *buf, off_t len,
 	struct kexec_info *info);
 void elf_x86_64_usage(void);
 
+int bzImage64_probe(const char *buf, off_t len);
+int bzImage64_load(int argc, char **argv, const char *buf, off_t len,
+			struct kexec_info *info);
+void bzImage64_usage(void);
+
 #endif /* KEXEC_X86_64_H */
Signature · 7 lines
1.7.7


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
author
#8 lore raw

Re: [PATCH v4 6/6] kexec, x86_64: Load bzImage64 above 4G

Review

Quoted 9 lines · Yinghai Lu

need to check xloadflags to see the bzImage is for 64bit relocatable.

(quoted diff) +0 -3
-v2: add kexec-bzImage64.c according to Eric.
-v3: don't need to purgatory under 2g after Eric's change to purgatory code.
-v4: use locate_hole find position first then add_buffer... suggested by Eric
     add buffer for kernel image at last to make kexec-load faster.
     use xloadflags in setup_header to tell if is bzImage64.
     remove not cross GB boundary searching.
     add --entry-32bit and --real-mode for skipping bzImage64.

-v5: attached. that is using USE_EXT_BOOT_PARAMS bit in xloadflags

Subject: [PATCH v5 6/6] kexec, x86_64: Load bzImage64 above 4G

need to check xloadflags to see the bzImage is for 64bit relocatable.

-v2: add kexec-bzImage64.c according to Eric.
-v3: don't need to purgatory under 2g after Eric's change to purgatory code. -v4: use locate_hole find position first then add_buffer... suggested by Eric
add buffer for kernel image at last to make kexec-load faster. use xloadflags in setup_header to tell if is bzImage64. remove not cross GB boundary searching.
add --entry-32bit and --real-mode for skipping bzImage64.

---
 kexec/arch/i386/include/arch/options.h |    4 
 kexec/arch/x86_64/Makefile             |    1 
 kexec/arch/x86_64/kexec-bzImage64.c    |  335 +++++++++++++++++++++++++++++++++
 kexec/arch/x86_64/kexec-x86_64.c       |    1 
 kexec/arch/x86_64/kexec-x86_64.h       |    5 
 5 files changed, 345 insertions(+), 1 deletion(-)
kexec/arch/x86_64/Makefile +1 -0
Index: kexec-tools/kexec/arch/x86_64/Makefile
===================================================================
@@ -13,6 +13,7 @@ x86_64_KEXEC_SRCS += kexec/arch/i386/cra
 x86_64_KEXEC_SRCS_native =  kexec/arch/x86_64/kexec-x86_64.c
 x86_64_KEXEC_SRCS_native += kexec/arch/x86_64/kexec-elf-x86_64.c
 x86_64_KEXEC_SRCS_native += kexec/arch/x86_64/kexec-elf-rel-x86_64.c
+x86_64_KEXEC_SRCS_native += kexec/arch/x86_64/kexec-bzImage64.c
 
 x86_64_KEXEC_SRCS += $(x86_64_KEXEC_SRCS_native)
 
kexec/arch/x86_64/kexec-bzImage64.c new file +335 -0

335 lines not on this page · raw message

kexec/arch/x86_64/kexec-x86_64.c +1 -0
Index: kexec-tools/kexec/arch/x86_64/kexec-x86_64.c
===================================================================
@@ -37,6 +37,7 @@ struct file_type file_type[] = {
 	{ "multiboot-x86", multiboot_x86_probe, multiboot_x86_load,
 	  multiboot_x86_usage },
 	{ "elf-x86", elf_x86_probe, elf_x86_load, elf_x86_usage },
+	{ "bzImage64", bzImage64_probe, bzImage64_load, bzImage64_usage },
 	{ "bzImage", bzImage_probe, bzImage_load, bzImage_usage },
 	{ "beoboot-x86", beoboot_probe, beoboot_load, beoboot_usage },
 	{ "nbi-x86", nbi_probe, nbi_load, nbi_usage },
kexec/arch/x86_64/kexec-x86_64.h +5 -0
Index: kexec-tools/kexec/arch/x86_64/kexec-x86_64.h
===================================================================
@@ -28,4 +28,9 @@ int elf_x86_64_load(int argc, char **arg
 	struct kexec_info *info);
 void elf_x86_64_usage(void);
 
+int bzImage64_probe(const char *buf, off_t len);
+int bzImage64_load(int argc, char **argv, const char *buf, off_t len,
+			struct kexec_info *info);
+void bzImage64_usage(void);
+
 #endif /* KEXEC_X86_64_H */
kexec/arch/i386/include/arch/options.h +3 -1
Index: kexec-tools/kexec/arch/i386/include/arch/options.h
===================================================================
@@ -29,6 +29,7 @@
 #define OPT_MOD 		(OPT_ARCH_MAX+7)
 #define OPT_VGA 		(OPT_ARCH_MAX+8)
 #define OPT_REAL_MODE		(OPT_ARCH_MAX+9)
+#define OPT_ENTRY_32BIT		(OPT_ARCH_MAX+10)
 
 /* Options relevant to the architecture (excluding loader-specific ones): */
 #define KEXEC_ARCH_OPTIONS \
@@ -68,7 +69,8 @@
 	{ "args-linux",		0, NULL, OPT_ARGS_LINUX },	\
 	{ "args-none",		0, NULL, OPT_ARGS_NONE },	\
 	{ "module",		1, 0, OPT_MOD },		\
-	{ "real-mode",		0, NULL, OPT_REAL_MODE },
+	{ "real-mode",		0, NULL, OPT_REAL_MODE },	\
+	{ "entry-32bit",	0, NULL, OPT_ENTRY_32BIT },
 
 #define KEXEC_ALL_OPT_STR KEXEC_ARCH_OPT_STR
 

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#9 lore raw

Re: [PATCH v4 6/6] kexec, x86_64: Load bzImage64 above 4G

Quoted 13 lines · Yinghai Lu

Review

Quoted 9 lines · Yinghai Lu

need to check xloadflags to see the bzImage is for 64bit relocatable.

(quoted diff) +0 -3
-v2: add kexec-bzImage64.c according to Eric.
-v3: don't need to purgatory under 2g after Eric's change to purgatory code.
-v4: use locate_hole find position first then add_buffer... suggested by Eric
      add buffer for kernel image at last to make kexec-load faster.
      use xloadflags in setup_header to tell if is bzImage64.
      remove not cross GB boundary searching.
      add --entry-32bit and --real-mode for skipping bzImage64.

-v5: attached. that is using USE_EXT_BOOT_PARAMS bit in xloadflags

Yinghai, revving the patch is pointless until we agree on the proper architectural direction.

-hpa

Signature · 8 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec