[plug] What's the best way to get kernel version from a binary?

Marcos Raúl Carot marcos.carot at gmail.com
Thu Nov 24 12:09:54 AWST 2016


This maybe?

To find out what version of Linux is compiled, use the strings utility on
the uncompressed vmlinux image.

For example:

strings linux-src/build/build-generic/vmlinux|grep "Linux version"

Sample output:

Linux version 3.2.0-56-generic (root at puerto-cayo) (gcc version 4.6.3
(Ubuntu/Linaro 4.6.3-1ubuntu5) ) #86 SMP Fri Nov 1 10:24:18 EDT 2013
(Ubuntu 3.2.0-56.86-generic 3.2.51)




From
http://stackoverflow.com/questions/3180029/how-can-i-determine-the-build-version-of-linux-kernel-uimage

On Thu, 24 Nov 2016 at 12:04 Euan de Kock <euan at dekock.net> wrote:

> Would ldd give any useful library links that use the kernel version number
> - not in front of a machine to check, so I'm just guessing...
>
> Euan
>
> On 24 Nov. 2016 11:56 am, "BillK" <billk at iinet.net.au> wrote:
>
> It's a binary, not a running kernel! And you can't boot it until you have
> built a matching initrd. Catch 22
>
> BillK
>
>
> On 24 November 2016 11:48:56 AM AWST, "Marcos Raúl Carot" <
> marcos.carot at gmail.com> wrote:
>
> cat /proc/version
>
> On Thu, 24 Nov 2016, 11:36 Bill Kenworthy <billk at iinet.net.au> wrote:
>
> What's the best way to get kernel version from a binary?
>
> Context is that the raspberry pi stock firware doesn’t use version
> numbers in the filename and I want to know what kernel version I am
> building a custom initrd using dracut for a btrfs on root filesystem.
>
> Easy to get manually (strings|grep the file) but its clumsy and hard to
> get precision in a script and uname doesn’t work on a file :(
>
> BillK
> _______________________________________________
> PLUG discussion list: plug at plug.org.au
> http://lists.plug.org.au/mailman/listinfo/plug
> Committee e-mail: committee at plug.org.au
> PLUG Membership: http://www.plug.org.au/membership
>
> ------------------------------
>
> PLUG discussion list: plug at plug.org.au
> http://lists.plug.org.au/mailman/listinfo/plug
> Committee e-mail: committee at plug.org.au
> PLUG Membership: http://www.plug.org.au/membership
>
>
> --
> Sent from my Android phone with K-9 Mail. Please excuse my brevity.
>
> _______________________________________________
> PLUG discussion list: plug at plug.org.au
> http://lists.plug.org.au/mailman/listinfo/plug
> Committee e-mail: committee at plug.org.au
> PLUG Membership: http://www.plug.org.au/membership
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.plug.org.au/pipermail/plug/attachments/20161124/2dbe3f56/attachment.html>


More information about the plug mailing list