分享

编译内核常见错误 收录

 raymoon_sure 2014-06-18
编译内核常见错误
http://blog./uid-22278460-id-1777662.html
make menuconfig错误:
运行到 HOSTCC  scripts/basic/fixdep
发生错误:
make[1]: *** [scripts/basic/fixdep] Error 1
make: *** [scripts_basic] Error 2
解决办法:apt-get install build-essential

运行到:HOSTCC  scripts/kconfig/kxgettext.o
发生错误:
*** Unable to find the ncurses libraries or the
*** required header files.
*** 'make menuconfig' requires the ncurses libraries.
*** 
*** Install ncurses (ncurses-devel) and try again.
*** 
make[1]: *** [scripts/kconfig/dochecklxdialog] Error 1
make: *** [menuconfig] Error 2
解决办法:apt-get install build-essential



内核编译错误的一些解决办法

一:

invalid option `abi=aapcs-linux'选项错误
scripts/kconfig/conf -s arch/arm/Kconfig
CHK     include/linux/version.h
SYMLINK include/asm-arm/arch -> include/asm-arm/arch-s3c2410
make[1]: `include/asm-arm/mach-types.h' is up to date.
CHK     include/linux/utsrelease.h
CC      arch/arm/kernel/asm-offsets.s
cc1: error: invalid option `abi=aapcs-linux'
make[1]: *** [arch/arm/kernel/asm-offsets.s] Error 1
make: *** [prepare0] Error 2

解决方法:

You're building an EABI kernel with an OABI compiler. You can either turn off the EABI option in your config file (Kernel Features->Use EABI),or, you can use an EABI toolchain such as the ARM/GNU Linux one from <http://www./gnu_toolchains/arm/download.html>.I recommend the latter, because then you can run Arjan's new images.
上述的关掉EABI选项可以通过测试


二:

drivers/video/console/vgacon.o:987:warning:comparison is always true due to limited range of data type
make[3]:***[drivers/video/console/vgacon.o] error 1
make[2]:***[drivers/video/console2] error 2
make[1]:***[drivers/video1] error 2
make:***[drivers] error 2


解决方法:

在make menuconfig 时选哪个设备驱动的选项进去在选Graphics support ->
console display driver support->
vga text console(不选这个)
再编译就行了!

三:`rtc_lock'未定义错误(未完全解决)

方法:

drivers/built-in.o(.text+0x281e4):drivers/char/nvram.c:350: more undefined references to `rtc_lock' follow
查 找drivers/char/nvram.c有关的rtc_lock定义,发现2.6.21与以往的kernel不同,于是在包含文件中查找,在 include/linux/mc146818rtc.h中发现了rtc_lock的定义,但是有一个__KERNEL__的条件编译选项,去掉这个条件 编译选项,再make zImage,但是问题好像依然存在,继续在drivers/char/nvram.c中增加这个定义spinlock_t rtc_lock;再编译,发现编译通过。

四:

make zImage和make xipImage
Kernel configured for XIP (CONFIG_XIP_KERNEL=y)
Only the xipImage target is available in this case
make[1]: *** [arch/arm/boot/zImage] Error 1
make: *** [zImage] Error 2


解决方法:

好象是make menuconfig的时候Boot options--->Kernel Execte-In-Place from ROM选项问题,去掉这个选项编译通过(如果是make xopImage时則需要将这个选项选上),最终成功编译了make zImage。

五:

出现make:***[.tmp_vmlinux1] Error 1这类错误

解决方法:修改arch/arm/kernel/vmlinux.lds
[arm@localhost linux2.6.14]$
vi arch/arm/kernel/vmlinux.lds
将文件尾2条的ASSERT注释掉(1439行)
/* ASSERT((__proc_info_end __
proc_info_begin), "missing CPU support") */
/* ASSERT((__arch_info_end __
arch_info_begin), "no machine record defined") */
然后重新make zImage即可

六:

如果大家遇到一下几个问题可以参考本文:
a      make menuconfig
1)     /usr/bin/ld: cannot find -lncurses
解决办法:
sudo apt-get install libncurses5-dev
2)     Your display is too small to run Menuconfig!
解决办法:     窗口最大化
b
/usr/local/arm/bin/arm-linux-ld:arch/arm/kernel/vmlinux.lds:782: parse error
make: *** [.tmp_vmlinux1] 错误 1

ld链接时产生错误
对应行:
/home/kevin/ARMSystem/linux-2.6.12/arch/arm/kernel/vmlinux.lds
/* those must never be empty */
ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support")
ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined")
解决办法: 注释掉这两行

Linux内核编译时常见错误及解决方案
http://emb./answer/2013/0514/1325.html
相信大家在进行Linux内核编译时常会遇见这样或那样的错误,下面笔者列罗列了关于Linux内核编译时最常见的一些错误以及解决方案,大家不妨可以参考下。

1、若编译内核时总是出现同一个错误,如下:

在make   modules_install时最后几行弹出错误:

if   [   -r   System.map   -a   -x   /sbin/depmod   ];   then   /sbin/depmod   -ae   -F   System.map     2.6.12.2;   fi

/bin/sh:   line   1:     3357   已杀死                               /sbin/depmod   -ae   -F   System.map   2.6 .12.2

make:   ***   [_modinst_post]   错误   137

如果继续make   install,重启,是进不去刚刚编译安装的那个内核的,显示内核错误。

分析:如果 System.map可读 并且 /sbin/depmod可执行;那么就执行/sbin/depmod -ae -F System.map  2.6.20;结束

depmod(depend module)

功能说明:分析可载入模块的相依性。

语  法:depmod [-adeisvV][-m <文件>][--help][模块名称]

补充说明:depmod可检测模块的相依性,供modprobe在安装模块时使用。

参  数:

-a或--all  分析所有可用的模块。

-d或debug  执行排错模式。

-e  输出无法参照的符号。

-i  不检查符号表的版本。

-m<文件>或system-map<文件>  使用指定的符号表文件。

-s或--system-log  在系统记录中记录错误。

-v或--verbose  执行时显示详细的信息。

-V或--version  显示版本信息。

--help  显示帮助。

解决方法:make   module_install之前你是否关闭了selinux,

该问题是selinux阻止写/lib/modules/ <version> 目录

2、若重启系统后显示:

Warning--SElinux relabel is required

Disabling security enforcement

Relabeling could take a very long time

depending on file system size

可以更改grub.conf 将selinux=0添加到如下位置

kernel /vmlinuz-2.6.11-1.1369_FC4 ro root=LABEL=/ selinux=0 rhgb quiet

或者更改/etc/selinux/config,将SELINUX=Disabled,存盘就可以把 selinux 关闭了

3、修改selinux

在新版本中的Red Hat 和 Fedora 上,修改档案/etc/sysconfig/selinux:

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

#       enforcing - SELinux security policy is enforced.

#       permissive - SELinux prints warnings instead of enforcing.

#       disabled - SELinux is fully disabled.

SELINUX=enforcing

# SELINUXTYPE= type of policy in use. Possible values are:

#       targeted - Only targeted network daemons are protected.

#       strict - Full SELinux protection.

SELINUXTYPE=targeted

把 SELINUX设定为disable, 下次启动系统后将会停止SElinux.

Linux核心参数(Kernel Parameter)

或者可以在核心参数后加上: selinux=0 (停止) 或 selinux=1 (开启)参数

档案/boot/grub/menu.lst

title Fedora Core (2.6.18-1.2798.fc6)

root (hd0,0)

kernel /vmlinuz-2.6.18-1.2798.fc6 ro root=LABEL=/ rhgb quiet  selinux=0

initrd /initrd-2.6.18-1.2798.fc6.img

检查SELinux现时况态

要知到你现在是否使用 SELinux:

# getenforce

disabled

4、重启后若出现Kernel panic:VFS: Unable to mount root fs on unknown-block(0,0)

从错误信息上看,是没有识别到硬盘。看来,我机器上的SATA硬盘必须在内核中做相应的配置才能识别。

仔细阅读了内核配置时的帮助信息,得知内核支持两种SATA驱动程序:一种是libata,在SCSI子系统中,支持最新的SATA控制器;还有一种是 IDE驱动程序中的SATA,主要是支持第一代的SATA控制器。我的机器应该是比较新的,所以先按libata的方式来配置试试。

先看看我的SATA控制器是什么类型的?运行lspci,输出如下:

00:1f.2 IDE interface: Intel Corporation 82801GBM/GHM (ICH7 Family) SATA IDE Con troller (rev 01)

就是SATA控制器的类型。

解决方法:在make menuconfig中设置以下选项:

Device Driver

|---->SCSI device support

|---->SCSI disk support

|----->verbose SCSI error reporting (不是必须的,但可方便问题定位)

|----->SCSI low-level drivers

|---->Serial ATA (SATA) support

|---->intel PIIX/ICH SATA support

<*> RAM disk support     在 device drivers -> Block devices中

<*> Initial RAM disk (initrd) support   在 device drivers -> Block devices中

<*> Compressed ROM file system support (cramfs) 在file systems -> Miscellaneous filesystems中

5、若重启之后出现网卡不识别,无法激活,出现via-rhine device eth0 does not seem to be present, delaying initialization

缺少VIA 驱动

运行 make menuconfig

在Networking support-->Networking device support --> Ethernet (10 or 100Mbit) 里找到 <M>"VIA Rhine RevB support"

6、若重启后显示如下:

reading all physical volumns, this may take a while…

no volumns group found!

unable to find volumns group "VolGroup00"

ERROR: /bin/lvm exited abnormal with value 5 (pid 335)

error 6 mounting ext3

ERROR OPENING /dev/console!!:2

error dup2ing fd of 0 to 0

error dup2ing fd of 1 to 1

error duping fd of 2 to 2

switchroot:mount failed:22

kernel panic - no syncing: attempted to kill init!

运行make menuconfig时在 device drivers ->[*] Multiple devices driver support (RAID and LVM)

如果有以下选项,也应该启用它们:<*>  Logical volume manager (LVM) support

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多