Add support for the 32 bit boot protocol to the x86 zboot command.
cover Add support for the 32 bit boot protocol to the x86 zboot command.
These two patches add support for the 32 bit Linux boot protocol to the zboot command.
Gabe Black (2):
x86: Clean up the x86 zimage code in preparation to extend it
x86: Add support for booting Linux using the 32 bit boot protocol
arch/x86/include/asm/zimage.h | 25 +-------- arch/x86/lib/bootm.c | 6 +- arch/x86/lib/zimage.c | 125 ++++++++++++++++++++++++++--------------- 3 files changed, 86 insertions(+), 70 deletions(-)
Signature · 1 line
1.7.3.1
PATCH 1/2 x86: Clean up the x86 zimage code in preparation to extend it
This change cleans up some formatting issues in the zimage handling code, and converts it from using offsets added to a base pointer to using the available structure definitions which were already being included.
--- arch/x86/include/asm/zimage.h | 21 ---------- arch/x86/lib/zimage.c | 82 ++++++++++++++++++++++------------------ 2 files changed, 45 insertions(+), 58 deletions(-)
arch/x86/include/asm/zimage.h +0 -21
@@ -27,27 +27,6 @@/* linux i386 zImage/bzImage header. Offsets relative to * the start of the image */ -#define CMD_LINE_MAGIC_OFF 0x020/* Magic 0xa33f if the offset below is valid */ -#define CMD_LINE_OFFSET_OFF 0x022/* Offset to comandline */ -#define SETUP_SECTS_OFF 0x1F1/* The size of the setup in sectors */ -#define ROOT_FLAGS_OFF 0x1F2/* If set, the root is mounted readonly */ -#define VID_MODE_OFF 0x1FA/* Video mode control */ -#define ROOT_DEV_OFF 0x1FC/* Default root device number */ -#define BOOT_FLAG_OFF 0x1FE/* 0xAA55 magic number */ -#define HEADER_OFF 0x202/* Magic signature "HdrS" */ -#define VERSION_OFF 0x206/* Boot protocol version supported */ -#define REALMODE_SWTCH_OFF 0x208/* Boot loader hook (see below) */ -#define START_SYS_OFF 0x20C/* Points to kernel version string */ -#define TYPE_OF_LOADER_OFF 0x210/* Boot loader identifier */ -#define LOADFLAGS_OFF 0x211/* Boot protocol option flags */ -#define SETUP_MOVE_SIZE_OFF 0x212/* Move to high memory size (used with hooks) */ -#define CODE32_START_OFF 0x214/* Boot loader hook (see below) */ -#define RAMDISK_IMAGE_OFF 0x218/* initrd load address (set by boot loader) */ -#define RAMDISK_SIZE_OFF 0x21C/* initrd size (set by boot loader) */ -#define HEAP_END_PTR_OFF 0x224/* Free memory after setup end */ -#define CMD_LINE_PTR_OFF 0x228/* 32-bit pointer to the kernel command line */ - -#define HEAP_FLAG 0x80#define BIG_KERNEL_FLAG 0x01
arch/x86/lib/zimage.c +45 -37
182 lines not on this page · raw message
Signature · 1 line
1.7.3.1
PATCH 2/2 x86: Add support for booting Linux using the 32 bit boot protocol
In reply to Gabe BlackThis change conditionally modifies the zboot command so that it can use the 32 bit boot protocol. This is necessary because the 16 bit realmode entry point assumes that it can call BIOS services which neither coreboot nor u-boot provide.
--- arch/x86/include/asm/zimage.h | 4 +- arch/x86/lib/bootm.c | 6 +++- arch/x86/lib/zimage.c | 49 +++++++++++++++++++++++++++++++--------- 3 files changed, 44 insertions(+), 15 deletions(-)
arch/x86/include/asm/zimage.h +2 -2
@@ -46,8 +46,8 @@void *load_zimage (char *image,unsigned long kernel_size,unsigned long initrd_addr,unsigned long initrd_size, -int auto_boot); +int auto_boot,void **load_address); -void boot_zimage (void *setup_base); +void boot_zimage (void *setup_base,void *load_address);#endif
arch/x86/lib/bootm.c +4 -2
@@ -38,6 +38,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[],void *base_ptr =NULL ;ulong os_data, os_len;image_header_t *hdr; +void *load_address;#if defined(CONFIG_FIT )const void *data;
@@ -75,7 +76,8 @@ int do_bootm_linux(int flag, int argc, char * const argv[],#ifdef CONFIG_CMD_ZBOOT base_ptr =load_zimage ((void *)os_data, os_len, - images->rd_start, images->rd_end - images->rd_start,0 ); + images->rd_start, images->rd_end - images->rd_start, +0 , &load_address);#endif if (NULL == base_ptr) {
@@ -92,7 +94,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[],/* we assume that the kernel is in place */ printf ("\nStarting kernel ...\n\n" ); -boot_zimage (base_ptr); +boot_zimage (base_ptr, load_address);/* does not return */ error:
arch/x86/lib/zimage.c +38 -11
115 lines not on this page · raw message
Signature · 1 line
1.7.3.1
PATCH 2/2 x86: Add support for booting Linux using the 32 bit boot protocol
Hi Gabe,
Thanks, I've been itching for this :)
Quoted 86 lines · Gabe Black
This change conditionally modifies the zboot command so that it can use the 32 bit boot protocol. This is necessary because the 16 bit realmode entry point assumes that it can call BIOS services which neither coreboot nor u-boot provide.
Signed-off-by Gabe Black <[email protected]>---
?arch/x86/include/asm/zimage.h | ? ?4 +- ?arch/x86/lib/bootm.c ? ? ? ? ?| ? ?6 +++- ?arch/x86/lib/zimage.c ? ? ? ? | ? 49 +++++++++++++++++++++++++++++++---------?3 files changed, 44 insertions(+), 15 deletions(-)
arch/x86/include/asm/zimage.h +2
-2@@ -46,8 +46,8 @@ ?void *load_zimage(char *image, unsigned long kernel_size, ? ? ? ? ? ? ? ? ?unsigned long initrd_addr, unsigned long initrd_size, - ? ? ? ? ? ? ? ? int auto_boot); + ? ? ? ? ? ? ? ? int auto_boot, void **load_address); -void boot_zimage (void *setup_base); +void boot_zimage (void *setup_base,void *load_address);?#endif
arch/x86/lib/bootm.c +1
-0@@ -38,6 +38,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], ? ? ? ?void ? ? ? ? ? ?*base_ptr = NULL; ? ? ? ?ulong ? ? ? ? ? os_data, os_len; ? ? ? ?image_header_t ?*hdr; + ? ? ? void ? ? ? ? ? ?*load_address; ?#if defined(CONFIG_FIT) ? ? ? ?const void ? ? ?*data;@@ -75,7 +76,8 @@ int do_bootm_linux(int flag, int argc, char * const argv[],?#ifdef
CONFIG_CMD_ZBOOT
? ? ? ?base_ptr = load_zimage((void *)os_data,os_len,
- ? ? ? ? ? ? ? ? ? ? ?images->rd_start,images->rd_end-images->rd_start, 0);
+ ? ? ? ? ? ? ? ? ? ? ?images->rd_start,images->rd_end-images->rd_start,
+ ? ? ? ? ? ? ? ? ? ? ? 0,&load_address);
?#endif? ? ? ?if (NULL ==
base_ptr) {arch/x86/lib/bootm.c +0
-0@@ -92,7 +94,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[],? ? ? ?/* we assume that the kernel is in place */ ? ? ? ?printf("\nStarting kernel ...\n\n");
- ? ? ?
boot_zimage(base_ptr);
+ ? ? ?boot_zimage(base_ptr, load_address);
? ? ? ?/* does not return */?error:
arch/x86/lib/zimage.c +1
-2@@ -83,13 +83,12 @@ static void build_command_line(char *command_line, int auto_boot) ?void *load_zimage(char *image, unsigned long kernel_size, ? ? ? ? ? ? ? ? ?unsigned long initrd_addr, unsigned long initrd_size, - ? ? ? ? ? ? ? ? int auto_boot) + ? ? ? ? ? ? ? ? int auto_boot, void **load_address) ?{ ? ? ? ?struct boot_params *setup_base; ? ? ? ?int setup_size; ? ? ? ?int bootproto; ? ? ? ?int big_image; - ? ? ? void *load_address; ? ? ? ?struct boot_params *params = (struct boot_params *)image; ? ? ? ?struct setup_header *hdr = ¶ms->hdr;@@ -136,14 +135,23 @@ void *load_zimage(char *image, unsigned long kernel_size,? ? ? ?/* Determine load address */
? ? ? ?if (big_image)
- ? ? ? ? ? ? ?load_address= (void *)BZIMAGE_LOAD_ADDR;
+ ? ? ? ? ? ? ?*load_address= (void *)BZIMAGE_LOAD_ADDR; ? ? ? ?else
- ? ? ? ? ? ? ?load_address= (void *)ZIMAGE_LOAD_ADDR;
+ ? ? ? ? ? ? ?*load_address= (void *)ZIMAGE_LOAD_ADDR;
arch/x86/lib/zimage.c
Quoted 8 lines
arch/x86/lib/zimage.c +7
-0+ +#if definedCONFIG_ZBOOT_32 + ? ? ? printf("Building boot_params at 0x%8.8lx\n", (ulong)setup_base); + ? ? ? memset(setup_base, 0, sizeof(*setup_base)); + ? ? ? setup_base->hdr = params->hdr; + ? ? ? setup_base->e820_entries = install_e820_map( + ? ? ? ? ? ? ? ARRAY_SIZE(setup_base->e820_map), setup_base->e820_map);
Where is install_e820_map() defined?
Quoted 85 lines
+#else
? ? ? ?/* load setup */
? ? ? ?printf("Moving Real-Mode Code to 0x%8.8lx (%d bytes)\n", ? ? ? ? ? ? ? (ulong)setup_base,setup_size);
? ? ? ?memmove(setup_base, image,setup_size); +#endif? ? ? ?printf("Using boot protocol version %x.%02x\n", ? ? ? ? ? ? ? (bootproto &
0xff00) >> 8, bootproto &0xff);arch/x86/lib/zimage.c +1
-1@@ -182,7 +190,7 @@ void *load_zimage(char *image, unsigned long kernel_size, ? ? ? ? ? ? ? ?if (hdr->setup_sects >= 15) { ? ? ? ? ? ? ? ? ? ? ? ?printf("Linux kernel version %s\n", - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(char *)setup_base + + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(char *)params + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? hdr->kernel_version + 0x200); ? ? ? ? ? ? ? ?} else {? ? ? ? ? ? ? ? ? ? ? ?printf("Setup Sectors < 15 - "
arch/x86/lib/zimage.c +2
-3@@ -237,17 +245,33 @@ void *load_zimage(char *image, unsigned long kernel_size, ? ? ? ?build_command_line((char *)setup_base + COMMAND_LINE_OFFSET, auto_boot); ? ? ? ?printf("Loading %czImage at address 0x%08x (%ld bytes)\n", - ? ? ? ? ? ? ?big_image ? 'b' : ' ', (u32)load_address, kernel_size); + ? ? ? ? ? ? ?big_image ? 'b' : ' ', (u32)*load_address, kernel_size); - - ? ? ? memmove(load_address, image + setup_size, kernel_size); + ? ? ? memmove(*load_address, image + setup_size, kernel_size);? ? ? ?/* ready for booting */
? ? ? ?returnsetup_base;
?}arch/x86/lib/zimage.c +1
-1-void boot_zimage (void *setup_base) +void boot_zimage (void *setup_base,void *load_address)?{
arch/x86/lib/zimage.c +17
-0+#if definedCONFIG_ZBOOT_32 + ? ? ? /* + ? ? ? ?* Set %ebx, %ebp, and %edi to 0, %esi to point to the boot_params + ? ? ? ?* structure, and then jump to the kernel. We assume that %cs is + ? ? ? ?* 0x10, 4GB flat, and read/execute, and the data segments are 0x18, + ? ? ? ?* 4GB flat, and read/write. U-boot is setting them up that way for + ? ? ? ?* itself in arch/i386/cpu/cpu.c. + ? ? ? ?*/ + ? ? ? __asm__ __volatile__ ( + ? ? ? "movl $0, %%ebp ? ? ? ? \n" + ? ? ? "cli ? ? ? ? ? ? ? ? ? ?\n" + ? ? ? "jmp %[kernel_entry] ? ?\n" + ? ? ? :: [kernel_entry]"r"(load_address), + ? ? ? ? ?[boot_params] "S"(setup_base), + ? ? ? ? ?"b"(0), "D"(0) + ? ? ? ); +#else ? ? ? ?struct
pt_regsregs;? ? ? ?memset(®s, 0,
sizeof(struct pt_regs));arch/x86/lib/zimage.c +2
-0@@ -258,12 +282,14 @@ void boot_zimage(void *setup_base) ? ? ? ?regs.eflags = 0; ? ? ? ?enter_realmode(((u32)setup_base + SETUP_START_OFFSET) >> 4, 0, ? ? ? ? ? ? ? ? ? ? ? ®s, ®s); +#endif ?} ?int do_zboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) ?{ ? ? ? ?void *base_ptr; ? ? ? ?void *bzImage_addr = NULL; + ? ? ? void *load_address; ? ? ? ?char *s; ? ? ? ?ulong bzImage_size = 0;@@ -287,7 +313,8 @@ int do_zboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) ? ? ? ? ? ? ? ?bzImage_size = simple_strtoul(argv[2], NULL, 16);? ? ? ?/* Lets look for */
- ? ? ?base_ptr=load_zimage(bzImage_addr, bzImage_size, 0, 0, 0);
+ ? ? ?base_ptr= load_zimage(bzImage_addr,bzImage_size, 0, 0, 0,
+ ? ? ? ? ? ? ?&load_address);? ? ? ?if (!base_ptr) {
? ? ? ? ? ? ? ?printf("## Kernel loading failed ...\n");arch/x86/lib/zimage.c +0
-0@@ -299,7 +326,7 @@ int do_zboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])? ? ? ? ? ? ? ?/* we assume that the kernel is in place */ ? ? ? ? ? ? ? ?printf("\nStarting kernel ...\n\n");
Quoted 8 lines
- ? ? ? ? ? ? ?
boot_zimage(base_ptr);
+ ? ? ? ? ? ? ?boot_zimage(base_ptr, load_address); ? ? ? ? ? ? ? ?/* does not return */
? ? ? ?}--
1.7.3.1
Regards,
Graeme
PATCH 2/2 x86: Add support for booting Linux using the 32 bit boot protocol
Hmm, that's in an intervening patch. I didn't think that one was necessary but apparently it is. I'll add that to the series and send this out again.
Gabe
Quoted 219 lines · Graeme Russ
Hi Gabe,
Thanks, I've been itching for this :)
Quoted 1 line · Gabe Black
This change conditionally modifies the zboot command so that it can use
the
Quoted 9 lines
32 bit boot protocol. This is necessary because the 16 bit realmode entry point assumes that it can call BIOS services which neither coreboot nor u-boot provide.
Signed-off-by Gabe Black <[email protected]>--- arch/x86/include/asm/zimage.h | 4 +- arch/x86/lib/bootm.c | 6 +++- arch/x86/lib/zimage.c | 49+++++++++++++++++++++++++++++++---------
Review
Quoted 3 lines
3 files changed, 44 insertions(+), 15 deletions(-)(quoted diff) +0
-0
b/arch/x86/include/asm/zimage.harch/x86/lib/bootm.c int do_bootm_linux(int flag, int argc, char * const
Quoted 19 lines
index 1a77e00..8ee6a74 100644
arch/x86/include/asm/zimage.h +2
-2@@ -46,8 +46,8 @@void *load_zimage (char *image,unsigned long kernel_size,unsigned long initrd_addr,unsigned long initrd_size, -int auto_boot); +int auto_boot,void **load_address); -void boot_zimage (void *setup_base); +void boot_zimage (void *setup_base,void *load_address);#endif arch/x86/lib/bootm.c +0
-0@@ -38,6 +38,7 @@ int do_bootm_linux(int flag, int argc, char * constargv[],
arch/x86/lib/bootm.c int do_bootm_linux(int flag, int argc, char * const
Quoted 8 lines
arch/x86/lib/bootm.c +1
-0void *base_ptr =NULL ;ulong os_data, os_len;image_header_t *hdr; +void *load_address;#if defined(CONFIG_FIT )const void *data;@@ -75,7 +76,8 @@ int do_bootm_linux(int flag, int argc, char * constargv[],
arch/x86/lib/bootm.c int do_bootm_linux(int flag, int argc, char * const argv[],
Quoted 4 lines
arch/x86/lib/bootm.c +0
-1#ifdef CONFIG_CMD_ZBOOT base_ptr = load_zimage((void *)os_data, os_len, - images->rd_start, images->rd_end -
images->rd_start, 0);arch/x86/lib/bootm.c int do_bootm_linux(int flag, int argc, char * const · line 78
Quoted 1 line
arch/x86/lib/bootm.c +1
-0+ images->rd_start, images->rd_end -
images->rd_start,arch/x86/lib/bootm.c int do_bootm_linux(int flag, int argc, char * const
Quoted 5 lines
arch/x86/lib/bootm.c +1
-0+ 0, &load_address);#endif if (NULL == base_ptr) {@@ -92,7 +94,7 @@ int do_bootm_linux(int flag, int argc, char * constargv[],
arch/x86/lib/zimage.c static void build_command_line(char *command_line,
Quoted 13 lines
arch/x86/lib/bootm.c +1
-1/* we assume that the kernel is in place */ printf ("\nStarting kernel ...\n\n" ); -boot_zimage (base_ptr); +boot_zimage (base_ptr, load_address);/* does not return */ error:arch/x86/lib/zimage.c +0
-0@@ -83,13 +83,12 @@ static void build_command_line(char *command_line,int
auto_boot)arch/x86/lib/zimage.c void *load_zimage(char *image, unsigned long
Quoted 15 lines
arch/x86/lib/zimage.c +1
-2void *load_zimage (char *image,unsigned long kernel_size,unsigned long initrd_addr,unsigned long initrd_size, -int auto_boot) +int auto_boot,void **load_address) {struct boot_params *setup_base;int setup_size;int bootproto;int big_image; -void *load_address;struct boot_params *params = (struct boot_params *)image;struct setup_header *hdr = ¶ms->hdr;@@ -136,14 +135,23 @@ void *load_zimage(char *image, unsigned long
kernel_size,Quoted 6 lines
arch/x86/lib/zimage.c +1
-1/* Determine load address */ if (big_image) - load_address = (void *)BZIMAGE_LOAD_ADDR ; + *load_address = (void *)BZIMAGE_LOAD_ADDR ;else arch/x86/lib/zimage.c void *load_zimage(char *image, unsigned long kernel_size, · line 148
Quoted 10 lines
arch/x86/lib/zimage.c +8
-1- load_address = (void *)ZIMAGE_LOAD_ADDR ; + *load_address = (void *)ZIMAGE_LOAD_ADDR ; + +#if definedCONFIG_ZBOOT_32 +printf ("Building boot_params at 0x%8.8lx\n" , (ulong )setup_base); +memset (setup_base,0 ,sizeof (*setup_base)); + setup_base->hdr = params->hdr; + setup_base->e820_entries =install_e820_map ( +ARRAY_SIZE (setup_base->e820_map), setup_base->e820_map);Where is
install_e820_map()defined?arch/x86/lib/zimage.c void *load_zimage(char *image, unsigned long
Quoted 10 lines
arch/x86/lib/zimage.c +2
-0+#else /* load setup */ printf ("Moving Real-Mode Code to 0x%8.8lx (%d bytes)\n" , (ulong )setup_base, setup_size);memmove (setup_base, image, setup_size); +#endif printf ("Using boot protocol version %x.%02x\n" , (bootproto &0xff00 ) >>8 , bootproto &0xff );@@ -182,7 +190,7 @@ void *load_zimage(char *image, unsigned long
kernel_size,arch/x86/lib/zimage.c void *load_zimage(char *image, unsigned long
Quoted 9 lines
arch/x86/lib/zimage.c +1
-1if (hdr->setup_sects >=15 ) {printf ("Linux kernel version %s\n" , - (char *)setup_base + + (char *)params + hdr->kernel_version +0x200 ); }else { printf("Setup Sectors < 15 - "@@ -237,17 +245,33 @@ void *load_zimage(char *image, unsigned long
kernel_size,arch/x86/lib/zimage.c void *load_zimage(char *image, unsigned long · line 245
Quoted 1 line
arch/x86/lib/zimage.c +0
-0build_command_line((char *)setup_base + COMMAND_LINE_OFFSET,
auto_boot);Quoted 9 lines
arch/x86/lib/zimage.c +2
-3printf ("Loading %czImage at address 0x%08x (%ld bytes)\n" , - big_image ?'b' :' ' , (u32 )load_address, kernel_size); + big_image ?'b' :' ' , (u32)*load_address, kernel_size); - -memmove (load_address, image + setup_size, kernel_size); +memmove (*load_address, image + setup_size, kernel_size);arch/x86/lib/zimage.c void *load_zimage(char *image, unsigned long kernel_size,
Quoted 10 lines
arch/x86/lib/zimage.c +4
-1/* ready for booting */ return setup_base; } -void boot_zimage (void *setup_base) +void boot_zimage (void *setup_base,void *load_address) { +#if definedCONFIG_ZBOOT_32 +/* +* Set %ebx, %ebp, and %edi to 0, %esi to point to the
boot_paramsarch/x86/lib/zimage.c void *load_zimage(char *image, unsigned long · line 261
Quoted 2 lines
arch/x86/lib/zimage.c +2
-0+* structure, and then jump to the kernel. We assume that %cs is +* 0x10, 4GB flat, and read/execute, and the data segments are
0x18,arch/x86/lib/zimage.c void *load_zimage(char *image, unsigned long · line 262
Quoted 1 line
arch/x86/lib/zimage.c +1
-0+* 4GB flat, and read/write. U-boot is setting them up that way for
arch/x86/lib/zimage.c int do_zboot(cmd_tbl_t *cmdtp, int flag, int argc,
Quoted 30 lines
arch/x86/lib/zimage.c +13
-0+* itself in arch/i386/cpu/cpu.c. +*/ + __asm__ __volatile__ ( +"movl $0, %%ebp \n" +"cli \n" +"jmp %[kernel_entry] \n" + :: [kernel_entry]"r" (load_address), + [boot_params]"S" (setup_base), +"b" (0 ),"D" (0 ) + ); +#else struct pt_regs regs;memset (®s,0 ,sizeof (struct pt_regs ));@@ -258,12 +282,14 @@ void boot_zimage(void *setup_base) regs.eflags =0 ;enter_realmode (((u32 )setup_base +SETUP_START_OFFSET ) >>4 ,0 , ®s, ®s); +#endif }int do_zboot (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) {void *base_ptr;void *bzImage_addr =NULL ; +void *load_address;char *s;ulong bzImage_size =0 ;@@ -287,7 +313,8 @@ int do_zboot(cmd_tbl_t *cmdtp, int flag, int argc,char *const argv[])
arch/x86/lib/zimage.c int do_zboot(cmd_tbl_t *cmdtp, int flag, int argc,
Quoted 10 lines
arch/x86/lib/zimage.c +2
-1bzImage_size =simple_strtoul (argv[2 ],NULL ,16 );/* Lets look for */ - base_ptr =load_zimage (bzImage_addr, bzImage_size,0 ,0 ,0 ); + base_ptr =load_zimage (bzImage_addr, bzImage_size,0 ,0 ,0 , + &load_address);if (!base_ptr) {printf ("## Kernel loading failed ...\n" );@@ -299,7 +326,7 @@ int do_zboot(cmd_tbl_t *cmdtp, int flag, int argc,char *const argv[])
Quoted 11 lines
arch/x86/lib/zimage.c +1
-2/* we assume that the kernel is in place */ printf ("\nStarting kernel ...\n\n" ); -boot_zimage (base_ptr); +boot_zimage (base_ptr, load_address);/* does not return */ } --1.7.3.1
Regards,
Graeme
PATCH 2/2 x86: Add support for booting Linux using the 32 bit boot protocol
Hi Gabe,
Quoted 2 lines · Gabe Black
Hmm, that's in an intervening patch. I didn't think that one was necessary but apparently it is. I'll add that to the series and send this out again.
That would be nice ;)
P.S. Please stop top-quoting...
Regards,
Graeme
PATCH 2/2 x86: Add support for booting Linux using the 32 bit boot protocol
Quoted 9 lines · Graeme Russ
Hi Gabe,
Quoted 1 line · Gabe Black
Hmm, that's in an intervening patch. I didn't think that one was
necessary
Quoted 1 line
but apparently it is. I'll add that to the series and send this out
again.
Quoted 8 lines
That would be nice ;)
P.S. Please stop top-quoting...Regards,
Graeme
Actually that patch depends on another one too. Since those don't really go with these, I'll just send them out separately and they'll need to be applied first.
Gabe
PATCH 2/2 x86: Add support for booting Linux using the 32 bit boot protocol
Hi Gabe,
Quoted 17 lines · Gabe Black
Quoted 14 lines · Graeme Russ
Hi Gabe,
Quoted 4 lines · Gabe Black
Hmm, that's in an intervening patch. I didn't think that one was necessary
but apparently it is. I'll add that to the series and send this out again.That would be nice ;)
P.S. Please stop top-quoting...
Quoted 8 lines
Quoted 3 lines
Regards,
Graeme
Actually that patch depends on another one too. Since those don't really go with these, I'll just send them out separately and they'll need to be applied first.
Sounds good me
Regards,
Graeme
PATCH 2/2 x86: Add support for booting Linux using the 32 bit boot protocol
Quoted 28 lines · Graeme Russ
Hi Gabe,
Quoted 3 lines · Gabe Black
On Tue, Nov 29, 2011 at 7:39 PM, Graeme Russ <[email protected]>
Quoted 12 lines · wrote:
Quoted 12 lines
Hi Gabe,
Quoted 4 lines · Gabe Black
Hmm, that's in an intervening patch. I didn't think that one was necessary
but apparently it is. I'll add that to the series and send this out again.That would be nice ;)
Quoted 8 lines
Quoted 5 lines
P.S. Please stop top-quoting...Regards,
Graeme
Actually that patch depends on another one too. Since those don't really
go
Quoted 9 lines
Quoted 2 lines
with these, I'll just send them out separately and they'll need to be applied first.
Sounds good me
Regards,
Graeme
Since this series has to be applied after the other anyway, I think I will send it out again with another patch or two I was holding back.
Gabe
cover Add support for the 32 bit boot protocol to the x86 zboot command.
In reply to Gabe BlackHi Gabe,
Quoted 2 lines · Gabe Black
These two patches add support for the 32 bit Linux boot protocol to the zboot command.
Going by our previous offline correspondence, I assume this approach still uses the bzImage's decompression stub?
Also, as I discussion offline previously, I'm going through the boot_params with a fine-tooth comb to get a complete picture of what the Linux kernel actually requires to be filled out in the boot_params structure - I expect this will result in a 'built_boot_params()' function which is called by zboot and bootm - possibly with some weak stubs to helper functions
Regards,
Graeme
cover Add support for the 32 bit boot protocol to the x86 zboot command.
Quoted 16 lines · Graeme Russ
Hi Gabe,
Quoted 2 lines · Gabe Black
These two patches add support for the 32 bit Linux boot protocol to the zboot command.
Going by our previous offline correspondence, I assume this approach still uses the bzImage's decompression stub?
Also, as I discussion offline previously, I'm going through the
boot_paramswith a fine-tooth comb to get a complete picture of what the Linux kernel actually requires to be filled out in theboot_paramsstructure - I expect this will result in a 'built_boot_params()' function which is called by zboot and bootm - possibly with some weak stubs to helper functions
Quoted 4 lines
Regards,
Graeme
Yes, this supports the 32 bit protocol which includes the decompression stub. I don't think a build_boot_params function which actually builds the bootstub would work for a number of reasons. First, that's not how the boot protocol works. The kernel provides information there that u-boot needs to read, and u-boot shouldn't just make it up. An example of this is what boot protocol is expected. Second, you might find all the things a particular version of the kernel wants right now, but that could easy change at any time and break booting. Third, the boot_params structure isn't compressed (because otherwise the bootloader couldn't fill it out) and building our own wouldn't serve any purpose.
If you mean consolidating the existing boot_params code so that both zboot and bootm can use it, that seems reasonable. I'd point out, though, that filling out the table takes a trivial amount of time, so trying to cut corners and not fill it out completely would not only be dangerous, it would very likely not be worth the effort.
Gabe
cover Add support for the 32 bit boot protocol to the x86 zboot command.
Quoted 23 lines · Gabe Black
Quoted 20 lines · Graeme Russ
Hi Gabe,
Quoted 2 lines · Gabe Black
These two patches add support for the 32 bit Linux boot protocol to the zboot command.
Going by our previous offline correspondence, I assume this approach still uses the bzImage's decompression stub?
Also, as I discussion offline previously, I'm going through the
boot_params
with a fine-tooth comb to get a complete picture of what the Linux kernel actually requires to be filled out in theboot_paramsstructure - I expect this will result in a 'built_boot_params()' function which is called by zboot and bootm - possibly with some weak stubs to helper functionsRegards,
Quoted 7 lines
Quoted 1 line
Graeme
Yes, this supports the 32 bit protocol which includes the decompression stub. I don't think a
build_boot_paramsfunction which actually builds the bootstub would work for a number of reasons. First, that's not how the boot protocol works. The kernel provides information there that u-boot needs to
Well actually, the kernel does not provide that information - That information is generated during the compilation of the kernel
Quoted 2 lines
read, and u-boot shouldn't just make it up. An example of this is what boot protocol is expected. Second, you might find all the things a particular
Correct - The kernel build process files in a few important pieces of information for the bootloader - Particularly, this information lets the bootloader know where it can physically place the kernel, if the kernel is relocatable, what the minimum and optimum alignments of a relocatable kernel are, where the command line arguments can be stored, how big the command line can be, etc, etc,
Quoted 2 lines
version of the kernel wants right now, but that could easy change at any time and break booting. Third, the
boot_paramsstructure isn't compressed
But once a location in the boot_params structure has been given a defined purpose, it is never re-allocated (only deprecated) so using the latest version of boot_params guarantees that we will have all the fields for all kernels. The 'Protocol Version' field tells us what fields are required
Quoted 2 lines
(because otherwise the bootloader couldn't fill it out) and building our own wouldn't serve any purpose.
Correct. What I'm suggesting is that we take the boot_params structure created during the kernel build process and include it in the uImage so we would have a uImage containing (vmlinux + boot_params + initrd). We extract the boot_params, use the info contained within to load the kernel into the correct location in memory, fill out the bits of boot_params that the kernel needs from us (command line and e820 map mostly, but I think there may be one or two others) and jump into the kernel.
Quoted 5 lines
If you mean consolidating the existing
boot_paramscode so that both zboot and bootm can use it, that seems reasonable. I'd point out, though, that filling out the table takes a trivial amount of time, so trying to cut corners and not fill it out completely would not only be dangerous, it would very likely not be worth the effort.
I'm not suggesting cutting corners - If we have a centralised function which gets passed a boot_params and it fills out all the required info, then we only have one code location that needs updating for any new Linux kernel. This is essentially all that the 16-bit 'setup.bin' which sits at the start of bzImage does.
Regards,
Graeme
cover Add support for the 32 bit boot protocol to the x86 zboot command.
In reply to Gabe BlackHi Gabe,
Quoted 37 lines · Gabe Black
On Tue, Nov 29, 2011 at 7:48 PM, Graeme Russ <[email protected] <mailto:[email protected]>> wrote:
Hi Gabe,
On Wed, Nov 30, 2011 at 2:11 PM, Gabe Black <[email protected] <mailto:[email protected]>> wrote:
> These two patches add support for the 32 bit Linux boot protocol to the > zboot command.Going by our previous offline correspondence, I assume this approach still uses the bzImage's decompression stub?
Also, as I discussion offline previously, I'm going through the
boot_paramswith a fine-tooth comb to get a complete picture of what the Linux kernel actually requires to be filled out in theboot_paramsstructure - I expect this will result in a 'built_boot_params()' function which is called by zboot and bootm - possibly with some weak stubs to helper functionsRegards,
Graeme
Yes, this supports the 32 bit protocol which includes the decompression stub. I don't think a
build_boot_paramsfunction which actually builds the bootstub would work for a number of reasons. First, that's not how the boot protocol works. The kernel provides information there that u-boot needs to read, and u-boot shouldn't just make it up. An example of this is what boot protocol is expected. Second, you might find all the things a particular version of the kernel wants right now, but that could easy change at any time and break booting. Third, theboot_paramsstructure isn't compressed (because otherwise the bootloader couldn't fill it out) and building our own wouldn't serve any purpose.
Quoted 5 lines
If you mean consolidating the existing
boot_paramscode so that both zboot and bootm can use it, that seems reasonable. I'd point out, though, that filling out the table takes a trivial amount of time, so trying to cut corners and not fill it out completely would not only be dangerous, it would very likely not be worth the effort.
I've been playing around tonight and have managed to embed a gzip'd vmlinux and raw header (stripped from the associated bzImage) into my U-Boot image but I end up getting the same results - No RAM :(
So proof of concept is good
Regards
Graeme
cover Add support for the 32 bit boot protocol to the x86 zboot command.
Quoted 61 lines · Graeme Russ
Hi Gabe,
Quoted 10 lines · Gabe Black
On Tue, Nov 29, 2011 at 7:48 PM, Graeme Russ <[email protected] <mailto:[email protected]>> wrote:
Hi Gabe,
On Wed, Nov 30, 2011 at 2:11 PM, Gabe Black <[email protected] <mailto:[email protected]>> wrote:
> These two patches add support for the 32 bit Linux boot protocolto the
Quoted 3 lines
Quoted 1 line
zboot command.
Going by our previous offline correspondence, I assume this approach
still
Quoted 3 lines
uses the bzImage's decompression stub?
Also, as I discussion offline previously, I'm going through the
boot_paramsQuoted 1 line
with a fine-tooth comb to get a complete picture of what the Linux
kernel
Quoted 1 line
actually requires to be filled out in the
boot_paramsstructure - Iexpect
Quoted 1 line
this will result in a '
built_boot_params()' function which is calledby
Quoted 9 lines
zboot and bootm - possibly with some weak stubs to helper functions
Regards,
Graeme
Yes, this supports the 32 bit protocol which includes the decompression stub. I don't think a
build_boot_paramsfunction which actually buildsthe
Quoted 1 line
bootstub would work for a number of reasons. First, that's not how the
boot
Quoted 1 line
protocol works. The kernel provides information there that u-boot needs
to
Quoted 1 line
read, and u-boot shouldn't just make it up. An example of this is what
boot
Quoted 7 lines
protocol is expected. Second, you might find all the things a particular version of the kernel wants right now, but that could easy change at any time and break booting. Third, the
boot_paramsstructure isn't compressed (because otherwise the bootloader couldn't fill it out) and building our own wouldn't serve any purpose.If you mean consolidating the existing
boot_paramscode so that bothzboot
Quoted 4 lines
and bootm can use it, that seems reasonable. I'd point out, though, that filling out the table takes a trivial amount of time, so trying to cut corners and not fill it out completely would not only be dangerous, it would very likely not be worth the effort.
I've been playing around tonight and have managed to embed a gzip'd vmlinux and raw header (stripped from the associated bzImage) into my U-Boot image but I end up getting the same results - No RAM :(
Quoted 6 lines
So proof of concept is good
Regards
Graeme
You have to make sure you're using the 32 bit protocol. The 16 bit protocol should still work and is the default, but then the kernel tries to use other means to figure out what memory looks like. To use the 32 bit protocol, you need to define CONFIG_ZBOOT_32.
Gabe
cover Add support for the 32 bit boot protocol to the x86 zboot command.
Hi Gabe,
Quoted 71 lines · Gabe Black
Quoted 68 lines · Graeme Russ
Hi Gabe,
Quoted 48 lines · Gabe Black
On Tue, Nov 29, 2011 at 7:48 PM, Graeme Russ <[email protected] <mailto:[email protected]>> wrote:
? ? Hi Gabe,
? ? On Wed, Nov 30, 2011 at 2:11 PM, Gabe Black <[email protected] ? ? <mailto:[email protected]>> wrote:
? ? > These two patches add support for the 32 bit Linux boot protocol to the
? ? > zboot command.? ? Going by our previous offline correspondence, I assume this approach still
? ? uses the bzImage's decompression stub?? ? Also, as I discussion offline previously, I'm going through the
boot_params
? ? with a fine-tooth comb to get a complete picture of what the Linux kernel
? ? actually requires to be filled out in theboot_paramsstructure - I expect
? ? this will result in a 'built_boot_params()' function which is called by
? ? zboot and bootm - possibly with some weak stubs to helper functions? ? Regards,
? ? Graeme
Yes, this supports the 32 bit protocol which includes the decompression stub. I don't think a
build_boot_paramsfunction which actually builds the
bootstub would work for a number of reasons. First, that's not how the boot
protocol works. The kernel provides information there that u-boot needs to
read, and u-boot shouldn't just make it up. An example of this is what boot
protocol is expected. Second, you might find all the things a particular version of the kernel wants right now, but that could easy change at any time and break booting. Third, theboot_paramsstructure isn't compressed
(because otherwise the bootloader couldn't fill it out) and building our own wouldn't serve any purpose.Quoted 6 lines
If you mean consolidating the existing
boot_paramscode so that both zboot
and bootm can use it, that seems reasonable. I'd point out, though, that filling out the table takes a trivial amount of time, so trying to cut corners and not fill it out completely would not only be dangerous, it would very likely not be worth the effort.I've been playing around tonight and have managed to embed a gzip'd vmlinux
and raw header (stripped from the associated bzImage) into my U-Boot image but I end up getting the same results - No RAM :(So proof of concept is good
Regards
Quoted 8 lines
Quoted 1 line
Graeme
You have to make sure you're using the 32 bit protocol. The 16 bit protocol should still work and is the default, but then the kernel tries to use other means to figure out what memory looks like. To use the 32 bit protocol, you need to define?CONFIG_ZBOOT_32.
Yep, done that - And when you boot a raw vmlinux, there is no 16-bit protocol as there is no 'setup.bin' stub
There is something else going on with the e820 - Any chance you could provide a dump of a typical e820 array passed into the kernel by your coreboot patches?
Regards,
Graeme