Commit b03c036e authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'riscv/for-v5.3' of git://

Pull RISC-V fix from Paul Walmsley:
 "Last week, Palmer and I learned that there was an error in the RISC-V
  kernel image header format that could make it less compatible with the
  ARM64 kernel image header format. I had missed this error during my
  original reviews of the patch.

  The kernel image header format is an interface that impacts
  bootloaders, QEMU, and other user tools. Those packages must be
  updated to align with whatever is merged in the kernel. We would like
  to avoid proliferating these image formats by keeping the RISC-V
  header as close as possible to the existing ARM64 header. Since the
  arch/riscv patch that adds support for the image header was merged
  with our v5.3-rc1 pull request as commit 0f327f2a ("RISC-V: Add
  an Image header that boot loader can parse."), we think it wise to try
  to fix this error before v5.3 is released.

  The fix itself should be backwards-compatible with any project that
  has already merged support for premature versions of this interface.
  It primarily involves ensuring that the RISC-V image header has
  something useful in the same field as the ARM64 image header"

* tag 'riscv/for-v5.3' of git://
  riscv: modify the Image header to improve compatibility with the ARM64 header
parents 36024fcf 474efecb
......@@ -18,7 +18,7 @@ The following 64-byte header is present in decompressed Linux kernel image.
u32 res1 = 0; /* Reserved */
u64 res2 = 0; /* Reserved */
u64 magic = 0x5643534952; /* Magic number, little endian, "RISCV" */
u32 res3; /* Reserved for additional RISC-V specific header */
u32 magic2 = 0x56534905; /* Magic number 2, little endian, "RSC\x05" */
u32 res4; /* Reserved for PE COFF offset */
This header format is compliant with PE/COFF header and largely inspired from
......@@ -37,13 +37,14 @@ Notes:
Bits 16:31 - Major version
This preserves compatibility across newer and older version of the header.
The current version is defined as 0.1.
The current version is defined as 0.2.
- res3 is reserved for offset to any other additional fields. This makes the
header extendible in future. One example would be to accommodate ISA
extension for RISC-V in future. For current version, it is set to be zero.
- The "magic" field is deprecated as of version 0.2. In a future
release, it may be removed. This originally should have matched up
with the ARM64 header "magic" field, but unfortunately does not.
The "magic2" field replaces it, matching up with the ARM64 header.
- In current header, the flag field has only one field.
- In current header, the flags field has only one field.
Bit 0: Kernel endianness. 1 if BE, 0 if LE.
- Image size is mandatory for boot loader to load kernel image. Booting will
......@@ -3,7 +3,8 @@
#ifndef __ASM_IMAGE_H
#define __ASM_IMAGE_H
#define RISCV_IMAGE_MAGIC2 "RSC\x05"
......@@ -23,7 +24,7 @@
#define __HEAD_FLAGS (__HEAD_FLAG(BE))
......@@ -39,9 +40,8 @@
* @version: version
* @res1: reserved
* @res2: reserved
* @magic: Magic number
* @res3: reserved (will be used for additional RISC-V specific
* header)
* @magic: Magic number (RISC-V specific; deprecated)
* @magic2: Magic number 2 (to match the ARM64 'magic' field pos)
* @res4: reserved (will be used for PE COFF offset)
* The intention is for this header format to be shared between multiple
......@@ -58,7 +58,7 @@ struct riscv_image_header {
u32 res1;
u64 res2;
u64 magic;
u32 res3;
u32 magic2;
u32 res4;
#endif /* __ASSEMBLY__ */
......@@ -39,9 +39,9 @@ ENTRY(_start)
.word 0
.dword 0
.word 0
.balign 4
.word 0
.global _start_kernel
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment