[File] [PATCH] Magdir/linux S390 kernel image; Show version

Jens Remus jremus at linux.ibm.com
Mon Mar 17 13:52:28 UTC 2025


Linux kernel S390 boot executable images have the magic string "S390EP"
at 0x10008 (since v3.2). [1]  The parameter area has a pointer to the
kernel version at 0x10428 (since v5.3, which has been 0 since v3.2) [2]
Based on Vasily's implementation from his commit message of his Linux
kernel commit 6abe28197024 ("s390: enable detection of kernel version
from bzImage").

While at it update the identifier to "Linux kernel S390 boot executable
Image", to align it to the other architectures.

[1]: Linux kernel, arch/s390/boot/head.S, EP_OFFSET and EP_STRING.
[2]: Linux kernel, arch/s390/include/asm/setup.h, struct parmarea,
     kernel_version.

Co-authored-by: Vasily Gorbik <gor at linux.ibm.com>
Signed-off-by: Jens Remus <jremus at linux.ibm.com>
---
 magic/Magdir/linux | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/magic/Magdir/linux b/magic/Magdir/linux
index d2e3aaa1d68c..4afcc0736707 100644
--- a/magic/Magdir/linux
+++ b/magic/Magdir/linux
@@ -456,7 +456,9 @@
 ############################################################################
 # Linux S390 kernel image
 # Created by: Jan Kaluza <jkaluza at redhat.com>
-8 string \x02\x00\x00\x18\x60\x00\x00\x50\x02\x00\x00\x68\x60\x00\x00\x50\x40\x40\x40\x40\x40\x40\x40\x40 Linux S390
+# Update: Jens Remus <jremus at linux.ibm.com> based on Vasily Gorbik <gor at linux.ibm.com>
+# Linux kernel: arch/s390/boot/head.S and arch/s390/include/asm/setup.h
+8 string \x02\x00\x00\x18\x60\x00\x00\x50\x02\x00\x00\x68\x60\x00\x00\x50\x40\x40\x40\x40\x40\x40\x40\x40 Linux kernel S390 boot executable Image
 >0x00010000 search/b/4096 \x00\x0a\x00\x00\x8b\xad\xcc\xcc
 # 64bit
 >>&0 string \xc1\x00\xef\xe3\xf0\x68\x00\x00 Z10 64bit kernel
@@ -468,6 +470,11 @@
 >>&0 string \x81\x00\xc8\x80\x00\x00\x00\x00 Z9-109 32bit kernel
 >>&0 string \x80\x00\x20\x00\x00\x00\x00\x00 Z990 32bit kernel
 >>&0 string \x80\x00\x00\x00\x00\x00\x00\x00 Z900 32bit kernel
+# Linux kernel v3.2+
+>0x10008		string		S390EP
+# Linux kernel v5.3+
+>>0x10428		ubequad		>0
+>>>(0x10428.Q)		string		>\0	\b, version %s
 
 ############################################################################
 # Linux ARM compressed kernel image
-- 
2.45.2



More information about the File mailing list