efi_loader: add Linux magic to RISC-V crt0
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Fri, 28 May 2021 20:24:37 +0000 (22:24 +0200)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Sat, 14 Aug 2021 18:54:41 +0000 (20:54 +0200)
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

index e7c4d99..b0a7a39 100644 (file)
        .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 */