[LINUX问答]内核编译

本文介绍了解决在Ubuntu下使用makemenuconfig命令时遇到的问题,即缺少ncurses库导致无法正常进行Linux内核配置的过程,并展示了如何通过安装正确的库文件来修复此问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、make mrproper

root@ubuntu:/boot# cd /usr/src/linux-source-3.5.0/
root@ubuntu:/usr/src/linux-source-3.5.0# make mrproper
  CLEAN   /usr/src/linux-source-3.5.0/debian/
root@ubuntu:/usr/src/linux-source-3.5.0#

 

2、make menuconfig

root@ubuntu:/usr/src/linux-source-3.5.0# make menuconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.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

 

解决办法

root@ubuntu:/usr/src/linux-source-3.5.0# apt-get install libncurses5-dev
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following extra packages will be installed:
  libtinfo-dev
Suggested packages:
  ncurses-doc
The following NEW packages will be installed:
  libncurses5-dev libtinfo-dev
0 upgraded, 2 newly installed, 0 to remove and 331 not upgraded.
Need to get 306 kB of archives.
After this operation, 1,145 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1
http://us.archive.ubuntu.com/ubuntu/ quantal/main libtinfo-dev i386 5.9-10ubuntu1 [93.3 kB]
Get:2
http://us.archive.ubuntu.com/ubuntu/ quantal/main libncurses5-dev i386 5.9-10ubuntu1 [213 kB]
Fetched 306 kB in 2s (113 kB/s)         
Selecting previously unselected package libtinfo-dev:i386.
(Reading database ... 155438 files and directories currently installed.)
Unpacking libtinfo-dev:i386 (from .../libtinfo-dev_5.9-10ubuntu1_i386.deb) ...
Selecting previously unselected package libncurses5-dev.
Unpacking libncurses5-dev (from .../libncurses5-dev_5.9-10ubuntu1_i386.deb) ...
Setting up libtinfo-dev:i386 (5.9-10ubuntu1) ...
Setting up libncurses5-dev (5.9-10ubuntu1) ...
root@ubuntu:/usr/src/linux-source-3.5.0# make menuconfig
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/lxdialog/checklist.o
  HOSTCC  scripts/kconfig/lxdialog/inputbox.o
  HOSTCC  scripts/kconfig/lxdialog/menubox.o
  HOSTCC  scripts/kconfig/lxdialog/textbox.o
  HOSTCC  scripts/kconfig/lxdialog/util.o
  HOSTCC  scripts/kconfig/lxdialog/yesno.o
  HOSTCC  scripts/kconfig/mconf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c

...................................

 

 

root@ubuntu:/usr/src/linux-source-3.5.0# make-kpkg
The program 'make-kpkg' is currently not installed. You can install it by typing:
apt-get install kernel-package

 

 

 

注意

Linux下面去编译项目之前,一般常会用make mrproper去先删除之前编译所生成的文件和配置文件,备份文件等,其中,mrproper和distclean,clean之间的区别,Linux内核源码根目录下面的makefile中,有很清晰的解释:
help:
@echo 'Cleaning targets:'
@echo ' clean - Remove most generated files but keep the config and'
@echo ' enough build support to build external modules'
@echo ' mrproper - Remove all generated files + config + various backup files'

@echo ' distclean - mrproper + remove editor backup and patch files'

简单点说

make mrproper命令会删除所有的编译生成文件、内核配置文件(.config文件)和各种备份文件,所以几乎只在第一次执行内核编译前才用这条命令。

make clean命令则是用于删除大多数的编译生成文件,但是会保留内核的配置文件.config,还有足够的编译支持来建立扩展模块。所以你若只想删除前一次编译过程的残留数据,只需执行make clean命令。

总而言之,make mrproper删除的范围比make clean大,实际上,make mrproper在具体执行时第一步就是调用make clean

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值