All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] efi_loader: add Linux magic to RISC-V crt0
@ 2021-08-14  6:47 Heinrich Schuchardt
  0 siblings, 0 replies; only message in thread
From: Heinrich Schuchardt @ 2021-08-14  6:47 UTC (permalink / raw)
  To: u-boot; +Cc: Rick Chen, Leo, Atish Patra, Bin Meng, Heinrich Schuchardt

Add the Linux magic to the EFI file header to allow running our test
programs with GRUB's linux command.

MajorImageVersion = 1 indicates a kernel that can consume the
EFI_LOAD_FILE2_PROTOCOL. This allows to dump the GRUB provided intird with
our initrddump.efi tool.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 arch/riscv/lib/crt0_riscv_efi.S | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/riscv/lib/crt0_riscv_efi.S b/arch/riscv/lib/crt0_riscv_efi.S
index e7c4d99c21..b0a7a39a72 100644
--- a/arch/riscv/lib/crt0_riscv_efi.S
+++ b/arch/riscv/lib/crt0_riscv_efi.S
@@ -33,7 +33,10 @@
 	.globl	ImageBase
 ImageBase:
 	.short	IMAGE_DOS_SIGNATURE		/* 'MZ' */
-	.skip	58				/* 'MZ' + pad + offset == 64 */
+	.skip	46				/* 'MZ' + pad + offset == 64 */
+	.long	0x43534952			/* Linux magic "RISCV */
+	.long	0x00000056
+	.long	0x05435352			/* Linux magic2 "RSC\x05*/
 	.long	pe_header - ImageBase		/* Offset to the PE header */
 pe_header:
 	.long	IMAGE_NT_SIGNATURE		/* 'PE' */
@@ -72,7 +75,7 @@ extra_header_fields:
 	.long	0x8				/* FileAlignment */
 	.short	0				/* MajorOperatingSystemVersion */
 	.short	0				/* MinorOperatingSystemVersion */
-	.short	0				/* MajorImageVersion */
+	.short	1				/* MajorImageVersion */
 	.short	0				/* MinorImageVersion */
 	.short	0				/* MajorSubsystemVersion */
 	.short	0				/* MinorSubsystemVersion */
--
2.30.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-14  6:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-14  6:47 [PATCH 1/1] efi_loader: add Linux magic to RISC-V crt0 Heinrich Schuchardt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.