x86: boot protocol updates.
Subsystems (3)
v2 cover x86: boot protocol updates.
Updates since last time:
- Fixed ELF payload patch to work with non-default CONFIG_PHYSICAL_START.
- Grammar fix from Randy Dunlap.
PATCH v2 1/3 x86: use ELF format in compressed images.
This allows other boot loaders such as the Xen domain builder the opportunity to extract the ELF file.
--- Documentation/i386/boot.txt | 18 ++++++++++++ arch/x86/boot/Makefile | 14 +++++++++ arch/x86/boot/compressed/Makefile | 2 +- arch/x86/boot/compressed/misc.c | 56 +++++++++++++++++++++++++++++++++++++ arch/x86/boot/header.S | 6 ++++ 5 files changed, 95 insertions(+), 1 deletions(-)
Documentation/i386/boot.txt +18 -0
@@ -170,6 +170,8 @@ Offset Proto Name Meaning 0238/4 2.06+ cmdline_size Maximum size of the kernel command line 023C/4 2.07+ hardware_subarch Hardware subarchitecture 0240/8 2.07+ hardware_subarch_data Subarchitecture-specific data +0248/4 2.08+ compressed_payload_offset +024C/4 2.08+ compressed_payload_length (1) For backwards compatibility, if the setup_sects field contains 0, the real value is 4.
@@ -512,6 +514,22 @@ Protocol: 2.07+ A pointer to data that is specific to hardware subarch +Field name: compressed_payload_offset +Type: read +Offset/size: 0x248/4 +Protocol: 2.08+ + + If non-zero then this field contains the offset from the end of the + real-mode code to the compressed payload. The compression format + should be determined using the standard magic number, currently only + gzip is used. + +Field name: compressed_payload_length +Type: read +Offset/size: 0x24c/4 +Protocol: 2.08+ + + The length of the compressed payload. **** THE KERNEL COMMAND LINE
arch/x86/boot/Makefile +14 -0
@@ -94,6 +94,20 @@ $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE SETUP_OBJS = $(addprefix $(obj)/,$(setup-y)) +sed-offsets := -e 's/^00*/0/' \ + -e 's/^\([0-9a-fA-F]*\) . \(input_data\|input_data_end\)$$/\#define \2 0x\1/p' + +quiet_cmd_offsets = OFFSETS $@ + cmd_offsets = $(NM) $< | sed -n $(sed-offsets) > $@ + +$(obj)/offsets.h: $(obj)/compressed/vmlinux FORCE + $(call if_changed,offsets) + +targets += offsets.h + +AFLAGS_header.o += -I$(obj) +$(obj)/header.o: $(obj)/offsets.h + LDFLAGS_setup.elf := -T $(obj)/setup.elf: $(src)/setup.ld $(SETUP_OBJS) FORCE $(call if_changed,ld)
arch/x86/boot/compressed/Makefile +1 -1
@@ -22,7 +22,7 @@ $(obj)/vmlinux: $(src)/vmlinux_$(BITS).lds $(obj)/head_$(BITS).o $(obj)/misc.o $ $(call if_changed,ld) @: -OBJCOPYFLAGS_vmlinux.bin := -O binary -R .note -R .comment -S +OBJCOPYFLAGS_vmlinux.bin := -R .comment -S $(obj)/vmlinux.bin: vmlinux FORCE $(call if_changed,objcopy)
arch/x86/boot/compressed/misc.c +56 -0
80 lines not on this page · raw message
arch/x86/boot/header.S +6 -0
@@ -22,6 +22,7 @@ #include <asm/page.h> #include <asm/setup.h> #include "boot.h" +#include "offsets.h" SETUPSECTS = 4 /* default nr of setup-sectors */ BOOTSEG = 0x07C0 /* original address of boot-sector */
@@ -223,6 +224,11 @@ hardware_subarch: .long 0 # subarchitecture, added with 2.07 hardware_subarch_data: .quad 0 +compressed_payload_offset: + .long input_data +compressed_payload_length: + .long input_data_end-input_data + # End of setup header ##################################################### .section ".inittext", "ax"
Signature · 1 line
1.5.4
PATCH v2 1/3 x86: use ELF format in compressed images.
In reply to Ian CampbellThis allows other boot loaders such as the Xen domain builder the opportunity to extract the ELF file.
--- Documentation/i386/boot.txt | 18 ++++++++++++ arch/x86/boot/Makefile | 14 +++++++++ arch/x86/boot/compressed/Makefile | 2 +- arch/x86/boot/compressed/misc.c | 56 +++++++++++++++++++++++++++++++++++++ arch/x86/boot/header.S | 6 ++++ 5 files changed, 95 insertions(+), 1 deletions(-)
Documentation/i386/boot.txt +18 -0
@@ -170,6 +170,8 @@ Offset Proto Name Meaning 0238/4 2.06+ cmdline_size Maximum size of the kernel command line 023C/4 2.07+ hardware_subarch Hardware subarchitecture 0240/8 2.07+ hardware_subarch_data Subarchitecture-specific data +0248/4 2.08+ compressed_payload_offset +024C/4 2.08+ compressed_payload_length (1) For backwards compatibility, if the setup_sects field contains 0, the real value is 4.
@@ -512,6 +514,22 @@ Protocol: 2.07+ A pointer to data that is specific to hardware subarch +Field name: compressed_payload_offset +Type: read +Offset/size: 0x248/4 +Protocol: 2.08+ + + If non-zero then this field contains the offset from the end of the + real-mode code to the compressed payload. The compression format + should be determined using the standard magic number, currently only + gzip is used. + +Field name: compressed_payload_length +Type: read +Offset/size: 0x24c/4 +Protocol: 2.08+ + + The length of the compressed payload. **** THE KERNEL COMMAND LINE
arch/x86/boot/Makefile +14 -0
@@ -94,6 +94,20 @@ $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE SETUP_OBJS = $(addprefix $(obj)/,$(setup-y)) +sed-offsets := -e 's/^00*/0/' \ + -e 's/^\([0-9a-fA-F]*\) . \(input_data\|input_data_end\)$$/\#define \2 0x\1/p' + +quiet_cmd_offsets = OFFSETS $@ + cmd_offsets = $(NM) $< | sed -n $(sed-offsets) > $@ + +$(obj)/offsets.h: $(obj)/compressed/vmlinux FORCE + $(call if_changed,offsets) + +targets += offsets.h + +AFLAGS_header.o += -I$(obj) +$(obj)/header.o: $(obj)/offsets.h + LDFLAGS_setup.elf := -T $(obj)/setup.elf: $(src)/setup.ld $(SETUP_OBJS) FORCE $(call if_changed,ld)
arch/x86/boot/compressed/Makefile +1 -1
@@ -22,7 +22,7 @@ $(obj)/vmlinux: $(src)/vmlinux_$(BITS).lds $(obj)/head_$(BITS).o $(obj)/misc.o $ $(call if_changed,ld) @: -OBJCOPYFLAGS_vmlinux.bin := -O binary -R .note -R .comment -S +OBJCOPYFLAGS_vmlinux.bin := -R .comment -S $(obj)/vmlinux.bin: vmlinux FORCE $(call if_changed,objcopy)
arch/x86/boot/compressed/misc.c +56 -0
80 lines not on this page · raw message
arch/x86/boot/header.S +6 -0
@@ -22,6 +22,7 @@ #include <asm/page.h> #include <asm/setup.h> #include "boot.h" +#include "offsets.h" SETUPSECTS = 4 /* default nr of setup-sectors */ BOOTSEG = 0x07C0 /* original address of boot-sector */
@@ -223,6 +224,11 @@ hardware_subarch: .long 0 # subarchitecture, added with 2.07 hardware_subarch_data: .quad 0 +compressed_payload_offset: + .long input_data +compressed_payload_length: + .long input_data_end-input_data + # End of setup header ##################################################### .section ".inittext", "ax"
Signature · 1 line
1.5.4
PATCH v2 2/3 x86: add a crc32 checksum to the kernel image.
--- Documentation/i386/boot.txt | 7 +++ arch/x86/boot/tools/build.c | 88 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 94 insertions(+), 1 deletions(-)
Documentation/i386/boot.txt +7 -0
@@ -531,6 +531,13 @@ Protocol: 2.08+ The length of the compressed payload. +**** THE IMAGE CHECKSUM + +The CRC-32 is calculated over the entire file using an initial +remainder of 0xffffffff. The checksum is appended to the file; +therefore the CRC of the file up to the limit specified in the syssize +field of the header is always 0. + **** THE KERNEL COMMAND LINE The kernel command line has become an important way for the boot
arch/x86/boot/tools/build.c +87 -1
118 lines not on this page · raw message
Signature · 1 line
1.5.4
PATCH v2 3/3 x86: bump image header to version 2.08.
--- arch/x86/boot/header.S | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/boot/header.S +1 -1
@@ -120,7 +120,7 @@ _start: # Part 2 of the header, from the old setup.S .ascii "HdrS" # header signature - .word 0x0207 # header version number (>= 0x0105) + .word 0x0208 # header version number (>= 0x0105) # or else old loadlin-1.5 will fail) .globl realmode_swtch realmode_swtch: .word 0, 0 # default_switch, SETUPSEG
Signature · 1 line
1.5.4
H. Peter Anvin
reviewerRe: [PATCHv2 2/3] x86: add a crc32 checksum to the kernel image.
In reply to Ian CampbellQuoted 14 lines · Ian Campbell
Signed-off-by Ian Campbell <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>Cc H. Peter Anvin <[email protected]>--- Documentation/i386/boot.txt | 7 +++ arch/x86/boot/tools/build.c | 88 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 94 insertions(+), 1 deletions(-)Documentation/i386/boot.txt +0
-0
Documentation/i386/boot.txt Protocol: 2.08+ · line 540
Quoted 10 lines
Documentation/i386/boot.txt +7
-0@@ -531,6 +531,13 @@ Protocol: 2.08+ The length of the compressed payload. +**** THE IMAGE CHECKSUM + +The CRC-32 is calculated over the entire file using an initial +remainder of 0xffffffff. The checksum is appended to the file; +therefore the CRC of the file up to the limit specified in the syssize +field of the header is always 0. +
This doesn't specify that the image checksum is present only for boot protocol 2.08 or later, nor does it specify the characteristic polynomial (for CRC32 in particular, I realize the Autodin II polynomial is pretty close to universal, but it should at least state that it is used.)
Quoted 8 lines
Documentation/i386/boot.txt +0
-0**** THE KERNEL COMMAND LINE The kernel command line has become an important way for the bootarch/x86/boot/tools/build.c +0
-0
arch/x86/boot/tools/build.c typedef unsigned long u32; · line 55
Quoted 6 lines
arch/x86/boot/tools/build.c +3
-0@@ -50,6 +50,75 @@ typedef unsigned long u32;u8 buf[SETUP_SECT_MAX *512 ];int is_big_kernel; +/*----------------------------------------------------------------------*/ + +static const unsigned int crctab32[] = {
Really should be "u32" rather than "unsigned int".
arch/x86/boot/tools/build.c typedef unsigned long u32; · line 56
Quoted 1 line
arch/x86/boot/tools/build.c +1
-0+ 0x00000000U, 0x77073096U, 0xee0e612cU, 0x990951baU, 0x076dc419U,
The "U"s are redundant.
-hpa
Re: [PATCHv2 2/3] x86: add a crc32 checksum to the kernel image.
On Wed, 2008-02-06 at 13:06 -0800, H. Peter Anvin wrote:
[...some comments...]
I fixed all of those up.
Thanks,
Ian.
---
x86: add a crc32 checksum to the kernel image.
--- Documentation/i386/boot.txt | 8 ++++ arch/x86/boot/tools/build.c | 88 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 95 insertions(+), 1 deletions(-)
Documentation/i386/boot.txt +8 -0
@@ -531,6 +531,14 @@ Protocol: 2.08+ The length of the compressed payload. +**** THE IMAGE CHECKSUM + +From boot protocol version 2.08 onwards the CRC-32 is calculated over +the entire file using the characteristic polynomial 0x04C11DB7 and an +initial remainder of 0xffffffff. The checksum is appended to the +file; therefore the CRC of the file up to the limit specified in the +syssize field of the header is always 0. + **** THE KERNEL COMMAND LINE The kernel command line has become an important way for the boot
arch/x86/boot/tools/build.c +87 -1
118 lines not on this page · raw message
Signature · 8 lines
1.5.4 -- Ian Campbell Hempstone's Question: If you have to travel on the Titanic, why not go first class?