6

I have recently been playing around with creating kernel modules using some crosstools for an embedded setup.

It would be helpful to me in future to have the ability to identify the version of the kernel that these modules have been built against. I can find no information online about this so I am starting to think that perhaps it is not possible.

So my question is are there any command line utilities that can ascertain the kernel version headers that a *.ko file was compiled against?

11

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.