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

Jens Remus jremus at linux.ibm.com
Tue May 20 07:54:17 UTC 2025


Hello Chistos!

On 06.04.2025 20:43, Christos Zoulas wrote:
> Committed, I kept the word "kernel" in the name.

Thank you very much!

Marc re-raised his concern, that the change from "Linux S390" to "Linux
kernel S390 boot executable" may break existing tools, that grep for
"Linux S390".  I agree with his concerns.

An example are our own s390-tools:
https://github.com/ibm-s390-linux/s390-tools/blob/v2.37.0/netboot/Makefile.pxelinux.0#L13C28-L13C45
https://github.com/ibm-s390-linux/s390-tools/blob/v2.37.0/netboot/mk-s390image#L106C40-L106C57

Wouldn't it be safer to use change the string to "Linux S390 kernel boot
executable" instead?
https://github.com/file/file/blob/master/magic/Magdir/linux#L461

>> On Mar 17, 2025, at 12:10 PM, Jens Remus <jremus at linux.ibm.com> wrote:
>> On 17.03.2025 14:52, Jens Remus wrote:
>>> 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.
>>
>> Marc brought up (offline), that changing the identifier from "Linux
>> S390" to "Linux kernel S390 boot executable Image" might break existing
>> scripts that grep for "Linux S390".  He suggested that a compromise
>> might be to change it to "Linux S390 kernel boot executable Image",
>> which only appends to the existing identifier.
>>
>>> [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

Thanks and regards,
Jens
-- 
Jens Remus
Linux on Z Development (D3303)
+49-7031-16-1128 Office
jremus at de.ibm.com

IBM

IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Böblingen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/



More information about the File mailing list