mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

Apart from some sanity checks on the size of setup.bin, the only
remaining task carried out by the arch/x86/boot/tools/build.c build tool
is generating the CRC-32 checksum of the bzImage. This feature was added
in commit
7d6e737c8d
("x86: add a crc32 checksum to the kernel image.")
without any motivation (or any commit log text, for that matter). This
checksum is not verified by any known bootloader, and given that
a) the checksum of the entire bzImage is reported by most tools (zlib,
rhash) as 0xffffffff and not 0x0 as documented,
b) the checksum is corrupted when the image is signed for secure boot,
which means that no distro ships x86 images with valid CRCs,
it seems quite unlikely that this checksum is being used, so let's just
drop it, along with the tool that generates it.
Instead, use simple file concatenation and truncation to combine the two
pieces into bzImage, and replace the checks on the size of the setup
block with a couple of ASSERT()s in the linker script.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ian Campbell <ijc@hellion.org.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/20250307164801.885261-2-ardb+git@google.com
74 lines
1.4 KiB
Text
74 lines
1.4 KiB
Text
/*
|
|
* setup.ld
|
|
*
|
|
* Linker script for the i386 setup code
|
|
*/
|
|
OUTPUT_FORMAT("elf32-i386")
|
|
OUTPUT_ARCH(i386)
|
|
ENTRY(_start)
|
|
|
|
SECTIONS
|
|
{
|
|
. = 0;
|
|
.bstext : {
|
|
*(.bstext)
|
|
. = 495;
|
|
} =0xffffffff
|
|
|
|
.header : { *(.header) }
|
|
.entrytext : { *(.entrytext) }
|
|
.inittext : { *(.inittext) }
|
|
.initdata : { *(.initdata) }
|
|
__end_init = .;
|
|
|
|
.text : { *(.text .text.*) }
|
|
.text32 : { *(.text32) }
|
|
|
|
.pecompat : { *(.pecompat) }
|
|
PROVIDE(pecompat_fsize = setup_size - pecompat_fstart);
|
|
|
|
. = ALIGN(16);
|
|
.rodata : { *(.rodata*) }
|
|
|
|
.videocards : {
|
|
video_cards = .;
|
|
*(.videocards)
|
|
video_cards_end = .;
|
|
}
|
|
|
|
. = ALIGN(16);
|
|
.data : { *(.data*) }
|
|
|
|
.signature : {
|
|
setup_sig = .;
|
|
LONG(0x5a5aaa55)
|
|
|
|
setup_size = ALIGN(ABSOLUTE(.), 4096);
|
|
setup_sects = ABSOLUTE(setup_size / 512);
|
|
ASSERT(setup_sects >= 5, "The setup must be at least 5 sectors in size");
|
|
ASSERT(setup_sects <= 64, "The setup must be at most 64 sectors in size");
|
|
}
|
|
|
|
. = ALIGN(16);
|
|
.bss :
|
|
{
|
|
__bss_start = .;
|
|
*(.bss)
|
|
__bss_end = .;
|
|
}
|
|
. = ALIGN(16);
|
|
_end = .;
|
|
|
|
/DISCARD/ : {
|
|
*(.note*)
|
|
}
|
|
|
|
/*
|
|
* The ASSERT() sink to . is intentional, for binutils 2.14 compatibility:
|
|
*/
|
|
. = ASSERT(_end <= 0x8000, "Setup too big!");
|
|
. = ASSERT(hdr == 0x1f1, "The setup header has the wrong offset!");
|
|
/* Necessary for the very-old-loader check to work... */
|
|
. = ASSERT(__end_init <= 5*512, "init sections too big!");
|
|
|
|
}
|