3

出于纯粹的好奇,我尝试在我的 slackware 机器上编译一个 2.6.0 内核。

root@darkstar:/home/linux-2.6.0# uname -a
Linux darkstar 2.6.37.6-smp #2 SMP Sat Apr 9 23:39:07 CDT 2011 i686 Intel(R) Core(TM)2 Duo CPU     P8600  @ 2.40GHz GenuineIntel GNU/Linux

当我尝试编译时,我得到:-

root@darkstar:/home/linux-2.6.0# make menuconfig                                                                                         
  HOSTCC  scripts/fixdep
scripts/fixdep.c: In function 'traps':
scripts/fixdep.c:359:2: warning: dereferencing type-punned pointer will break strict-aliasing rules
scripts/fixdep.c:361:4: warning: dereferencing type-punned pointer will break strict-aliasing rules
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/mconf.o
scripts/kconfig/mconf.c:91:21: error: static declaration of 'current_menu' follows non-static declaration
scripts/kconfig/lkc.h:63:21: note: previous declaration of 'current_menu' was here
make[1]: *** [scripts/kconfig/mconf.o] Error 1
make: *** [menuconfig] Error 2

关于我做错了什么的一些提示?谢谢!

4

2 回答 2

5

你是如何开始的?

通常,您从 kernel.org 下载最新的内核,将 tarball 复制到 /usr/src,然后:

 1. tar -zxvvf linux-2.6.xxxx.tar.gz
 2. ln -nsf linux-2.6.xxxx linux   # ie: Update the "/usr/src/linux" symbolic link to
                                   #   point to the new kernel source directory
 3. make menuconfig                # or make xconfig
 4. make modules                   # Build the kernel modules
 5. make modules_install           # Install the previously built modules for the
                                   #   new kernel
 6. make bzImage                   # Create the boot image

此时,请勿运行make install。大多数指南都说要这样做,但这是错误的!相反,将新创建的 bzImage 文件复制到 /boot(即:find -name bzImage /usr/src/linux,然后cp/boot),然后编辑您的 LILO 配置文件(编辑/etc/lilo.conf,完成后,运行lilo),然后重新启动系统(即:init 6shutdown -r now),并尝试新的核心。

跳过这make install一步的全部意义在于它覆盖/替换了您现有的内核。我上面描述的步骤允许您同时安装和运行新内核和现有内核。如果新内核损坏或您遗漏了一个重要选项,您仍然可以回退到现有的稳定/工作内核,而无需启动/恢复 CD/DVD。

于 2012-05-23T04:27:28.780 回答
1

如果我记得很清楚,我认为您缺少 ncurses 库。这些是使用 menuconfig 创建界面所必需的。

尝试从 X 会话中执行 make xconfig 并查看它是否有效。

如果是这种情况,那么肯定会丢失 ncurses 库。

检查:

ls /var/log/packages/ncurses* 

查看是否安装

于 2013-12-07T11:17:19.277 回答