Skip to content

Commit

Permalink
x86/boot: Grab kernel_info offset from zoffset header directly
Browse files Browse the repository at this point in the history
Instead of parsing zoffset.h and poking the kernel_info offset value
into the header from the build tool, just grab the value directly in the
asm file that describes this header.

This change has no impact on the resulting bzImage binary.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20230915171623.655440-11-ardb@google.com
  • Loading branch information
ardbiesheuvel authored and Ingo Molnar committed Sep 17, 2023
1 parent b618d31 commit 2e765c0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 1 addition & 1 deletion arch/x86/boot/header.S
Expand Up @@ -526,7 +526,7 @@ pref_address: .quad LOAD_PHYSICAL_ADDR # preferred load addr

init_size: .long INIT_SIZE # kernel initialization size
handover_offset: .long 0 # Filled in by build.c
kernel_info_offset: .long 0 # Filled in by build.c
kernel_info_offset: .long ZO_kernel_info

# End of setup header #####################################################

Expand Down
4 changes: 0 additions & 4 deletions arch/x86/boot/tools/build.c
Expand Up @@ -59,7 +59,6 @@ static unsigned long efi32_stub_entry;
static unsigned long efi64_stub_entry;
static unsigned long efi_pe_entry;
static unsigned long efi32_pe_entry;
static unsigned long kernel_info;
static unsigned long _end;

/*----------------------------------------------------------------------*/
Expand Down Expand Up @@ -337,7 +336,6 @@ static void parse_zoffset(char *fname)
PARSE_ZOFS(p, efi64_stub_entry);
PARSE_ZOFS(p, efi_pe_entry);
PARSE_ZOFS(p, efi32_pe_entry);
PARSE_ZOFS(p, kernel_info);
PARSE_ZOFS(p, _end);

p = strchr(p, '\n');
Expand Down Expand Up @@ -419,8 +417,6 @@ int main(int argc, char ** argv)
update_pecoff_text(setup_sectors * 512, i + (sys_size * 16));

efi_stub_entry_update();
/* Update kernel_info offset. */
put_unaligned_le32(kernel_info, &buf[0x268]);

crc = partial_crc32(buf, i, crc);
if (fwrite(buf, 1, i, dest) != i)
Expand Down

0 comments on commit 2e765c0

Please sign in to comment.