|
前几天心血来潮,想Debian下装一个新的内核试,又不想使当前系统出问题。于是想搞个可选的启动。
于是就开始了编译之路。。。
1. 下载最新内核
www.kernel.org, 我选是最稳定版。2.6.12.4,linux-2.6.12.4.tar.bz2.
2. 开始编译
--------------------
#tar jxf linux-2.6.12.4
#cd linux-2.6.12.4
#make mrproper
#make menuconfig
(其中关于nvidia显卡的选项注意,可参看最后的附录)
#make-kpkg --append-to-version -custom kernel-image 注:发现这真是debian的好处。
#make-kpkg --append-to-version -custom kernel-headers 注:对以后很有用,用nvidia显卡的知道,custom是自己定的子版本
#cd ..
#dpkg -i kernel-image-2.6.12.4-custom-*.deb kernel-headers-2.6.12.4-custom-*.deb
注:其中*,跟你自己的产生的具体而定
-------------------
原以为此时就应该可以了。可不知如果是这样的话,很容易在新内核引导的时候出现kernel panic的错误,自己就傻一阵子。。不知如何是好。后来grub/menu.lst中跟当前相比,少了initrd的内容。所以后来才知道要产生一个个,于是就要:
-------------------
#mkinitrd -o /boot/initrd.img-2.6.12.4-* 2.6.12.4-*
接着重起即可。
=======================
=======================
||相关问题 ||
=======================
=======================
一般情况,上述过程以后,系统能正常起动。不过对于驱动程序可能就会有问题了,我以我自己的nforce2和nvidia的显卡说明可以碰到的问题。
==--nforce---==
对于成功安装新内核以后,nvsound 或nvnet可能失效了。就要重新nvidia官方提供的NFORCE驱动。注意:其中如是你想两个内核都能正常工作的话,编译只就要加上
----------------
./NFORCE-Linux-x86-1.0-0301-pkg1.run --kernel-module-only
-----------------------------------------------
这样,nvnet和nvsound就只作为相就内核的module,不会影响其它内核。
====--nvidia 显卡--====
一般对于新装系统不会有这样的问题,特别是对于升级的系统有。使用官方的驱动程序始终没有办法通过。会有如下的问题,下面是/var/log/nvidia-installer.log的片段
+++++++++++++++++++++++
...
dia.o /tmp/selfgz7266/NVIDIA-Linux-x86-1.0-7174-pkg1/usr/src/nv/nvidia.mod.o
NVIDIA: left KBUILD.
-> done.
-> Kernel module compilation complete.
ERROR: Unable to load the kernel module 'nvidia.ko'. This is most likely
because the kernel module was built using the wrong kernel source files.
Please make sure you have installed the kernel source files for your
kernel; on Red Hat Linux systems, for example, be sure you have the
'kernel-source' rpm installed. If you know the correct kernel source
files are installed, you may specify the kernel source path with the
'--kernel-source-path' commandline option.
-> Kernel module load error: insmod: error inserting './usr/src/nv/nvidia.ko':
-1 File exists
...
+++++++++++++++++++++++
而可以发现,nvidia.ko是成功生成了,但无法安装。这个问题一直让我不明白。
重起后,也是不无正常加载,/var/log/XFree86.0.log如下:
+++++++++++++++++++++++
....
(**) NVIDIA(0): Depth 24, (--) framebuffer bpp 32
(==) NVIDIA(0): RGB weight 888
(==) NVIDIA(0): Default visual is TrueColor
(==) NVIDIA(0): Using gamma correction (1.0, 1.0, 1.0)
(--) NVIDIA(0): Linear framebuffer at 0xD0000000
(--) NVIDIA(0): MMIO registers at 0xFD000000
(EE) NVIDIA(0): Failed to initialize the NVIDIA kernel module!
(EE) NVIDIA(0): *** Aborting ***
(II) UnloadModule: "nvidia"
(II) UnloadModule: "vgahw"
(II) Unloading /usr/X11R6/lib/modules/libvgahw.a
....
+++++++++++++++++++++++++
说是无法装载nivdia模块,可是你用lsmod就可以看到,已装载。
所以我可以认为,因为不能成功安装的原因是因为当时已被加载,只不过不能正常工作罢了。
所以我再试一次
---------------------------------------
#rmmod nvidia
#./NVIDIA-Linux-x86-1.0-7676-pkg1.run
-----------------------------------------------------
或是
----------------------------------------
#rmmod nvidia
#./NVIDIA-Linux-x86-1.0-7676-pkg1.run --extract-only
#cd NVIDIA-Linux-x86-1.0-7676-pkg1/
#make install 或 make kernel_module_install
-----------------------------------------
应该能成功,重起,成功
补充:
了解到原因的所在以后,很多因为这个原因的问题都可以解决了。如,原来我的的系统 的nvida驱动是装有/lib/modules/2.6.7-k7-1/nvidia中的,而一般是被安装在/lib/modules/2.6***/kernel/drivers/video/中的。所有如果因为个原因使得你原来的内核又不能正常的工作的话,也是有可能的。只要复制一下就可以。还有就是两个内核的nvidia驱动的版本应该一致。
=======
||附录 ||引自Debian-Kernel-Compile-Howto (Kernel 2.6)
=======
http://www.falkotimme.com/howtos ... 6_compile/index.php
2. If you have an nVidia card, de-select the following during <make xconfig>:
Graphics Support -> nVidia Riva support (FB_RIVA)
Kernel Hacking -> Use 4Kb for kernel stacks instead of 8Kb (4KSTACKS)
Processor Type and Features -> Local APIC support on uniprocessors (X86_UP_APIC) |
|