sys-kernel/coreos-sources: Restore the section for the dm-verity hash

This reverts the commit that removes the section where Flatcar has the
dm-verity hash for /usr stored.
In the future we might store it in the initrd or at the end of the
bzImage.
This commit is contained in:
Kai Lueke 2024-03-15 11:52:37 +01:00
parent 8830c57dc6
commit 7c23b298db
2 changed files with 104 additions and 0 deletions

View File

@ -37,4 +37,5 @@ IUSE=""
UNIPATCH_LIST="
${PATCH_DIR}/z0001-kbuild-derive-relative-path-for-srctree-from-CURDIR.patch \
${PATCH_DIR}/z0002-revert-pahole-flags.patch \
${PATCH_DIR}/z0003-Revert-x86-boot-Remove-the-bugger-off-message.patch \
"

View File

@ -0,0 +1,103 @@
From 9f34a9ffe5b94aee93baa5762719546e0bebc28d Mon Sep 17 00:00:00 2001
From: Kai Lueke <kailuke@microsoft.com>
Date: Fri, 15 Mar 2024 11:49:50 +0100
Subject: [PATCH] Revert "x86/boot: Remove the 'bugger off' message"
This reverts commit 768171d7ebbce005210e1cf8456f043304805c15 because for
now this is still needed to store the dm-verity hash.
---
arch/x86/boot/header.S | 49 ++++++++++++++++++++++++++++++++++++++++++
arch/x86/boot/setup.ld | 7 +++---
2 files changed, 52 insertions(+), 4 deletions(-)
diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
index a1bbedd989e4..c7624caf6840 100644
--- a/arch/x86/boot/header.S
+++ b/arch/x86/boot/header.S
@@ -41,15 +41,64 @@ SYSSEG = 0x1000 /* historical load address >> 4 */
.code16
.section ".bstext", "ax"
+
+ .global bootsect_start
+bootsect_start:
#ifdef CONFIG_EFI_STUB
# "MZ", MS-DOS header
.word MZ_MAGIC
+#endif
+
+ # Normalize the start address
+ ljmp $BOOTSEG, $start2
+
+start2:
+ movw %cs, %ax
+ movw %ax, %ds
+ movw %ax, %es
+ movw %ax, %ss
+ xorw %sp, %sp
+ sti
+ cld
+
+ movw $bugger_off_msg, %si
+
+msg_loop:
+ lodsb
+ andb %al, %al
+ jz bs_die
+ movb $0xe, %ah
+ movw $7, %bx
+ int $0x10
+ jmp msg_loop
+
+bs_die:
+ # Allow the user to press a key, then reboot
+ xorw %ax, %ax
+ int $0x16
+ int $0x19
+
+ # int 0x19 should never return. In case it does anyway,
+ # invoke the BIOS reset code...
+ ljmp $0xf000,$0xfff0
+
+#ifdef CONFIG_EFI_STUB
.org 0x38
#
# Offset to the PE header.
#
.long LINUX_PE_MAGIC
.long pe_header
+#endif /* CONFIG_EFI_STUB */
+
+ .section ".bsdata", "a"
+bugger_off_msg:
+ .ascii "Use a boot loader.\r\n"
+ .ascii "\n"
+ .ascii "Remove disk and press any key to reboot...\r\n"
+ .byte 0
+
+#ifdef CONFIG_EFI_STUB
pe_header:
.long PE_MAGIC
diff --git a/arch/x86/boot/setup.ld b/arch/x86/boot/setup.ld
index 3a2d1360abb0..c3e354d312d0 100644
--- a/arch/x86/boot/setup.ld
+++ b/arch/x86/boot/setup.ld
@@ -10,11 +10,10 @@ ENTRY(_start)
SECTIONS
{
. = 0;
- .bstext : {
- *(.bstext)
- . = 495;
- } =0xffffffff
+ .bstext : { *(.bstext) }
+ .bsdata : { *(.bsdata) }
+ . = 495;
.header : { *(.header) }
.entrytext : { *(.entrytext) }
.inittext : { *(.inittext) }
--
2.44.0