Tony Li
Tony Li

Reputation: 106

How can I determine the Linux kernel version that a kernel object file was compiled against?

I've been given both .o and .ko versions of a kernel module. How can I determine the version of the Linux kernel that this was compiled against?

Upvotes: 1

Views: 344

Answers (2)

FOP
FOP

Reputation: 1022

Sorry

From https://unix.stackexchange.com/questions/195241/is-there-a-way-to-determine-what-kernel-version-a-kernel-module-was-compiled-aga

Execute the command modinfo <kernel_module_name> and look for vermagic

shw@shw:/tmp # modinfo btrfs
filename: /lib/modules/3.13.0-36-generic/kernel/fs/btrfs/btrfs.ko
license: GPL
alias: devname:btrfs-control
alias: char-major-10-234
alias: fs-btrfs srcversion: EA2C07F0B841AE2A6D8F91F
depends: libcrc32c,raid6_pq,xor
intree: Y
**vermagic: 3.13.0-36-generic SMP mod_unload modversions 686** <==
signer: Magrathea: Glacier signing key
sig_key: FF:9A:DA:11:B8:55:51:6A:72:98:65:9D:4E:3F:BB:76:C5:4A:D3:30
sig_hashalgo: sha512

Upvotes: 1

FOP
FOP

Reputation: 1022

With uname. See man uname for help

uname -ar 

give you the version of kernel and other info, like this:

Linux ArcherPucci 4.7.2-1-ARCH #1 SMP PREEMPT Sat Aug 20 23:02:56 CEST 2016 x86_64 GNU/Linux

-a give you all info

-r give you kernel version

Upvotes: 0

Related Questions