一聚教程网:一个值得你收藏的教程网站

热门教程

Linux kernel在“make install”时的问题分析总结

时间:2022-11-14 22:07:43 编辑:袖梨 来源:一聚教程网

在编译内核后,make install 时可能遇到“ERROR: modinfo: could not find module XXX”的问题;命令行中操作看到的内容如下:

代码如下 复制代码
[root@smilejay linux-3.12]# make modules_install
..........
INSTALL sound/soundcore.ko
INSTALL sound/synth/emux/snd-emux-synth.ko
INSTALL sound/synth/snd-util-mem.ko
INSTALL sound/usb/snd-usb-audio.ko
INSTALL sound/usb/snd-usbmidi-lib.ko
INSTALL sound/usb/usx2y/snd-usb-usx2y.ko
DEPMOD 3.12.0
[root@smilejay linux-3.12]# make install
sh /root/linux-3.12/arch/x86/boot/install.sh 3.12.0 arch/x86/boot/bzImage
System.map "/boot"
ERROR: modinfo: could not find module power_meter
ERROR: modinfo: could not find module nf_conntrack_ipv4
ERROR: modinfo: could not find module nf_defrag_ipv4
ERROR: modinfo: could not find module nf_conntrack_ipv6
ERROR: modinfo: could not find module nf_defrag_ipv6
ERROR: modinfo: could not find module xt_state
ERROR: modinfo: could not find module nf_conntrack
ERROR: modinfo: could not find module i2c_piix4
ERROR: modinfo: could not find module sg
ERROR: modinfo: could not find module ext4
ERROR: modinfo: could not find module mbcache
ERROR: modinfo: could not find module jbd2
ERROR: modinfo: could not find module sr_mod
ERROR: modinfo: could not find module cdrom
ERROR: modinfo: could not find module pata_acpi
ERROR: modinfo: could not find module ata_generic
ERROR: modinfo: could not find module ata_piix



原因分析:在make install时,为了让新内核中不缺少所需module,会先检查当前系统已经加载了的module(lsmod命令可查看),然后对比新安装的内核模块,如果新的内核模块中缺少一些module(和当前lsmod命令的输出做对比),就会报“ERROR: modinfo: could not find module power_meter”这样的错误信息。

具体来说,缺少相应module而报错,大致可分为3种情况:

1. 确实是缺少了某个module,其解决方法是:如果报的module对于你来说是有用,检查编译kernel时的.config文件,加上对应的配置(配为=m),重新编译和安装modules即可;如果你觉得这个module没啥用,大可不必管它了。

2. 新编译的kernel已经将该选项编译进kernel了(.config中选择为=Y),从而不需要生成这个module的.ko文件,系统找不到对应的.ko文件,但是已经在新内核中了,不必理会这个报错。例如,上面的“ERROR: modinfo: could not find module ext4”是因为我将EXT4文件系统模块编译为built-in了,如下:

代码如下 复制代码
[root@smilejay linux-3.12]# grep EXT4 .config
CONFIG_EXT4_FS=y
# CONFIG_EXT4_FS_POSIX_ACL is not set
# CONFIG_EXT4_FS_SECURITY is not set
# CONFIG_EXT4_DEBUG is not set



3.
模块的名称变了,用当前系统lsmod命令查找的模块名称,在新编译的内核中找不到module了。只需要检查确认即可,如这里的“ERROR: modinfo: could not find module power_meter”就是这种类型,检查方式如下:

代码如下 复制代码
# 当前系统已经加载了power_meter模块
[root@smilejay ~]# lsmod | grep meter
power_meter 9169 1

# 但是kernel 3.12 中该module名称为 acpi_power_meter,和'lsmod'查到的power_meterb不一致。
[root@smilejay ~]# find /lib/ -name "*power_meter.ko"
/lib/modules/2.6.32-358.el6.x86_64/kernel/drivers/acpi/power_meter.ko
/lib/modules/3.12.0/kernel/drivers/hwmon/acpi_power_meter.ko


最后,如果那些错误报的内核模块,你认为不重要或者都经过上面的分析解决后,你就可以忽略这些错误提示了;尽管有这些“ERROR: modinfo: ”错误提示,但是kernel还是被正确安装了的,往下继续操作使用即可。

热门栏目