#1029754 please support telling the architecture of a vmlinuz image

#1029754#5
Date:
2023-01-25 07:58:47 UTC
From:
To:
Hi Adam,

arch-test already is great, but maybe it can do even more. I would like
to know which architecture corresponds to a given vmlinuz image.

A vmlinuz image tends to consist of a boot stub followed by a compressed
ELF image. The compression scheme varies and we don't exactly know where
the compressed image starts. A relatively hacky way to do this is runnig
linux.git/scripts/extract-vmlinux and then feeding the output to
elf-arch. Maybe we can pull part of this functionality into arch-test?

The context of this is usage of arch-test in debvm. Given a root
filesystem, I already use elf-arch on the contained /bin/true to guess
its architecture. However the kernel image may correspond to a bigger
architecture (i386 -> amd64, armel -> armhf, armhf -> arm64, etc.) and I
would like to determine such cases automatically. As such, this
functionality is only really relevant for architectures with sibling
32bit / 64bit architectures.

There is not much ugrency to this. It just feels like arch-test would be
the right place to own this functionality. Thanks for considering. If
you end up considering this out-of-scope (e.g. due to the need for
various decompressors), don't hesitate to close this as wontfix.

Helmut

#1029754#12
Date:
2023-02-15 16:08:02 UTC
From:
To:
I looked into it, but it seems that extract-vmlinux will fail at least for
uncompressed EFI kernels: it won't skip the PE wrapper to get to ELF.

And apparently I'm too much of an idiot to find how the wrapper's length is
stored within over multiple hours of searching.  While I bet I could solve
the problem after some more thinking, I'll prioritize other stuff for now.

It's a valid request, I'm just a bit short on tuits these days.


Meow!