出于纯粹的好奇心,我尝试在我的 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
关于我做错了什么的一些提示?谢谢!
最佳答案
你是如何开始的?
通常,您从 kernel.org 下载最新的内核,将压缩包复制到/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 6
或 shutdown -r now
),然后试用新内核。
跳过 make install
步骤的全部意义在于它会覆盖/替换您现有的内核。我上面描述的步骤允许您同时安装和运行新内核和现有内核。如果新内核损坏或遗漏了一个重要选项,您仍然可以回退到现有的稳定/工作内核,而无需启动/恢复 CD/DVD。
关于linux-kernel - 在 slackware 上编译 2.6.0 内核,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8869931/