Skip to content

Commit 768171d

Browse files
ardbiesheuvelIngo Molnar
authored andcommitted
x86/boot: Remove the 'bugger off' message
Ancient (pre-2003) x86 kernels could boot from a floppy disk straight from the BIOS, using a small real mode boot stub at the start of the image where the BIOS would expect the boot record (or boot block) to appear. Due to its limitations (kernel size < 1 MiB, no support for IDE, USB or El Torito floppy emulation), this support was dropped, and a Linux aware bootloader is now always required to boot the kernel from a legacy BIOS. To smoothen this transition, the boot stub was not removed entirely, but replaced with one that just prints an error message telling the user to install a bootloader. As it is unlikely that anyone doing direct floppy boot with such an ancient kernel is going to upgrade to v6.5+ and expect that this boot method still works, printing this message is kind of pointless, and so it should be possible to remove the logic that emits it. Let's free up this space so it can be used to expand the PE header in a subsequent patch. Signed-off-by: Ard Biesheuvel <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Acked-by: H. Peter Anvin (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent bfab35f commit 768171d

File tree

2 files changed

+4
-52
lines changed

2 files changed

+4
-52
lines changed

arch/x86/boot/header.S

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -38,64 +38,15 @@ SYSSEG = 0x1000 /* historical load address >> 4 */
3838

3939
.code16
4040
.section ".bstext", "ax"
41-
42-
.global bootsect_start
43-
bootsect_start:
4441
#ifdef CONFIG_EFI_STUB
4542
# "MZ", MS-DOS header
4643
.word MZ_MAGIC
47-
#endif
48-
49-
# Normalize the start address
50-
ljmp $BOOTSEG, $start2
51-
52-
start2:
53-
movw %cs, %ax
54-
movw %ax, %ds
55-
movw %ax, %es
56-
movw %ax, %ss
57-
xorw %sp, %sp
58-
sti
59-
cld
60-
61-
movw $bugger_off_msg, %si
62-
63-
msg_loop:
64-
lodsb
65-
andb %al, %al
66-
jz bs_die
67-
movb $0xe, %ah
68-
movw $7, %bx
69-
int $0x10
70-
jmp msg_loop
71-
72-
bs_die:
73-
# Allow the user to press a key, then reboot
74-
xorw %ax, %ax
75-
int $0x16
76-
int $0x19
77-
78-
# int 0x19 should never return. In case it does anyway,
79-
# invoke the BIOS reset code...
80-
ljmp $0xf000,$0xfff0
81-
82-
#ifdef CONFIG_EFI_STUB
8344
.org 0x38
8445
#
8546
# Offset to the PE header.
8647
#
8748
.long LINUX_PE_MAGIC
8849
.long pe_header
89-
#endif /* CONFIG_EFI_STUB */
90-
91-
.section ".bsdata", "a"
92-
bugger_off_msg:
93-
.ascii "Use a boot loader.\r\n"
94-
.ascii "\n"
95-
.ascii "Remove disk and press any key to reboot...\r\n"
96-
.byte 0
97-
98-
#ifdef CONFIG_EFI_STUB
9950
pe_header:
10051
.long PE_MAGIC
10152

arch/x86/boot/setup.ld

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ ENTRY(_start)
1010
SECTIONS
1111
{
1212
. = 0;
13-
.bstext : { *(.bstext) }
14-
.bsdata : { *(.bsdata) }
13+
.bstext : {
14+
*(.bstext)
15+
. = 495;
16+
} =0xffffffff
1517

16-
. = 495;
1718
.header : { *(.header) }
1819
.entrytext : { *(.entrytext) }
1920
.inittext : { *(.inittext) }

0 commit comments

Comments
 (0)