View Issue Details

IDProjectCategoryView StatusLast Update
0000560fileGeneralpublic2024-11-09 22:17
ReporterStuart Menefy Assigned Tochristos  
PrioritynormalSeverityfeatureReproducibilityN/A
Status resolvedResolutionfixed 
Product Version5.45 
Fixed in Version5.46 
Summary0000560: Add support to recognise RISC-V Linux kernel images
DescriptionThe RISC-V Linux kernel images (usually called "Image") have a header which is deliberately similar to the AARCH64 Linux kernel.

It is described here:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch/riscv/include/asm/image.h?h=v6.10.9
and implemented here:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch/riscv/kernel/head.S?h=v6.10.9#n22

Attached is a patch to recognise it.
TagsNo tags attached.

Activities

Stuart Menefy

2024-09-11 16:05

reporter  

0001-Add-a-pattern-to-identify-RISC-V-kernel-images.patch (1,241 bytes)   
From 680554c58369d7c70ff79ea5d7b4ca4ea9e417d8 Mon Sep 17 00:00:00 2001
From: Stuart Menefy <stuart.menefy@codasip.com>
Date: Wed, 11 Sep 2024 16:59:53 +0100
Subject: [PATCH] Add a pattern to identify RISC-V kernel images.

The Linux RISC-V kernel provides a simple header to match against
(which is deliberately similar to that used by AARCH64).

The current version of this is simply a magic string and a flags
field with additional information.

Signed-off-by: Stuart Menefy <stuart.menefy@codasip.com>
---
 magic/Magdir/linux | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/magic/Magdir/linux b/magic/Magdir/linux
index a5776f6d..2193a698 100644
--- a/magic/Magdir/linux
+++ b/magic/Magdir/linux
@@ -521,6 +521,12 @@
 >0x18   lelong  &4          \b, 16K pages
 >0x18   lelong  &6          \b, 32K pages
 
+############################################################################
+# Linux RISC-V kernel image
+0x38	string	RSC\05		Linux kernel RISC-V boot executable Image
+>0x18	lelong	^1		\b, little-endian
+>0x18	lelong	&1		\b, big-endian
+
 ############################################################################
 # Linux 8086 executable
 0	lelong&0xFF0000FF 0xC30000E9	Linux-Dev86 executable, headerless
-- 
2.43.0

christos

2024-11-09 22:17

manager   ~0004077

Added, thanks

Issue History

Date Modified Username Field Change
2024-09-11 16:05 Stuart Menefy New Issue
2024-09-11 16:05 Stuart Menefy File Added: 0001-Add-a-pattern-to-identify-RISC-V-kernel-images.patch
2024-11-09 22:17 christos Assigned To => christos
2024-11-09 22:17 christos Status new => assigned
2024-11-09 22:17 christos Status assigned => resolved
2024-11-09 22:17 christos Resolution open => fixed
2024-11-09 22:17 christos Fixed in Version => 5.46
2024-11-09 22:17 christos Note Added: 0004077