如何确定针对内核对象文件编译的Linux内核版本?

时间:2016-08-30 17:32:56

标签: linux kernel versioning

我已经获得了内核模块的.o和.ko版本。如何确定针对此编译的Linux内核的版本?

2 个答案:

答案 0 :(得分:1)

抱歉

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

执行命令modinfo <kernel_module_name>并寻找 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

答案 1 :(得分:0)

uname。请参阅man uname以获取帮助

uname -ar 

为您提供内核版本和其他信息,如下所示:

Linux ArcherPucci 4.7.2-1-ARCH#1 SMP PREEMPT 8月20日星期六23:02:56 CEST 2016 x86_64 GNU / Linux

-a给你所有信息

-r给你内核版本