mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-02-18 22:32:28 +01:00
The RISC-V implementation on grub upstream has the Linux loader stubbed out and is largely non-functional. This incorporates the latest version of a patchset from the grub mailing list which fleshes out the Linux loader for RISC-V. With these changes, grub is able to boot Alpine Linux via UEFI on RISC-V.
88 lines
3.3 KiB
Diff
88 lines
3.3 KiB
Diff
From a4c8b60312216e3a6d72e903f9829eafd50d9142 Mon Sep 17 00:00:00 2001
|
|
From: Atish Patra <atish.patra@wdc.com>
|
|
Date: Thu, 3 Jun 2021 00:12:34 +0300
|
|
Subject: [PATCH 6/7] RISC-V: Update image header
|
|
|
|
Update the RISC-V Linux kernel image headers as per the current header.
|
|
|
|
Reference:
|
|
<Linux kernel source>/Documentation/riscv/boot-image-header.rst
|
|
|
|
Signed-off-by: Atish Patra <atish.patra@wdc.com>
|
|
---
|
|
include/grub/riscv32/linux.h | 15 ++++++++-------
|
|
include/grub/riscv64/linux.h | 15 ++++++++-------
|
|
2 files changed, 16 insertions(+), 14 deletions(-)
|
|
|
|
diff --git a/include/grub/riscv32/linux.h b/include/grub/riscv32/linux.h
|
|
index 512b777c8..de0dbdcd1 100644
|
|
--- a/include/grub/riscv32/linux.h
|
|
+++ b/include/grub/riscv32/linux.h
|
|
@@ -19,20 +19,21 @@
|
|
#ifndef GRUB_RISCV32_LINUX_HEADER
|
|
#define GRUB_RISCV32_LINUX_HEADER 1
|
|
|
|
-#define GRUB_LINUX_RISCV_MAGIC_SIGNATURE 0x52534356 /* 'RSCV' */
|
|
+#define GRUB_LINUX_RISCV_MAGIC_SIGNATURE 0x05435352 /* 'RSC\0x5' */
|
|
|
|
-/* From linux/Documentation/riscv/booting.txt */
|
|
+/* From linux/Documentation/riscv/boot-image-header.rst */
|
|
struct linux_riscv_kernel_header
|
|
{
|
|
grub_uint32_t code0; /* Executable code */
|
|
grub_uint32_t code1; /* Executable code */
|
|
- grub_uint64_t text_offset; /* Image load offset */
|
|
- grub_uint64_t res0; /* reserved */
|
|
- grub_uint64_t res1; /* reserved */
|
|
+ grub_uint64_t text_offset; /* Image load offset, little endian */
|
|
+ grub_uint64_t image_size; /* Effective Image size, little endian */
|
|
+ grub_uint64_t flags; /* kernel flags, little endian */
|
|
+ grub_uint32_t version; /* Version of this header */
|
|
+ grub_uint32_t res1; /* reserved */
|
|
grub_uint64_t res2; /* reserved */
|
|
grub_uint64_t res3; /* reserved */
|
|
- grub_uint64_t res4; /* reserved */
|
|
- grub_uint32_t magic; /* Magic number, little endian, "RSCV" */
|
|
+ grub_uint32_t magic; /* Magic number, little endian, "RSC\x05" */
|
|
grub_uint32_t hdr_offset; /* Offset of PE/COFF header */
|
|
};
|
|
|
|
diff --git a/include/grub/riscv64/linux.h b/include/grub/riscv64/linux.h
|
|
index 3630c30fb..7c28bc922 100644
|
|
--- a/include/grub/riscv64/linux.h
|
|
+++ b/include/grub/riscv64/linux.h
|
|
@@ -19,22 +19,23 @@
|
|
#ifndef GRUB_RISCV64_LINUX_HEADER
|
|
#define GRUB_RISCV64_LINUX_HEADER 1
|
|
|
|
-#define GRUB_LINUX_RISCV_MAGIC_SIGNATURE 0x52534356 /* 'RSCV' */
|
|
+#define GRUB_LINUX_RISCV_MAGIC_SIGNATURE 0x05435352 /* 'RSC\0x5' */
|
|
|
|
#define GRUB_EFI_PE_MAGIC 0x5A4D
|
|
|
|
-/* From linux/Documentation/riscv/booting.txt */
|
|
+/* From linux/Documentation/riscv/boot-image-header.rst */
|
|
struct linux_riscv_kernel_header
|
|
{
|
|
grub_uint32_t code0; /* Executable code */
|
|
grub_uint32_t code1; /* Executable code */
|
|
- grub_uint64_t text_offset; /* Image load offset */
|
|
- grub_uint64_t res0; /* reserved */
|
|
- grub_uint64_t res1; /* reserved */
|
|
+ grub_uint64_t text_offset; /* Image load offset, little endian */
|
|
+ grub_uint64_t image_size; /* Effective Image size, little endian */
|
|
+ grub_uint64_t flags; /* kernel flags, little endian */
|
|
+ grub_uint32_t version; /* Version of this header */
|
|
+ grub_uint32_t res1; /* reserved */
|
|
grub_uint64_t res2; /* reserved */
|
|
grub_uint64_t res3; /* reserved */
|
|
- grub_uint64_t res4; /* reserved */
|
|
- grub_uint32_t magic; /* Magic number, little endian, "RSCV" */
|
|
+ grub_uint32_t magic; /* Magic number, little endian, "RSC\x05" */
|
|
grub_uint32_t hdr_offset; /* Offset of PE/COFF header */
|
|
};
|
|
|
|
--
|
|
2.33.0
|
|
|