红联首页 凝聚Linux人的力量
菜鸟过关 | 新手在线 | 实用网址 | 我与Linux的故事 | Linux新闻 | Linux视频 | Linux人才 | 软件下载 | 文本版 | English
发新话题
打印

rebuild kernel in Debian GNU/Linux

rebuild kernel in Debian GNU/Linux

安装编译2.6内核所需的软件
apt-get install kernel-package libncurses5-dev fakeroot module-init-tools

http://www.kernel.org 下载最新内核,解压到/usr/src目录下;
tar -jxvf linux-2.6.25.tar.bz2 -C /usr/src
cd /usr/src/linux-2.6.25
cd /usr/src/
! use the provious working config files
cp /boot/config-2.6.22-3-686 ./

make menuconfig

在对话框中选择导入刚才的配置文件/usr/src/linux-2.6.25/config-2.6.22-3-686。

保存退出。配置信息默认会保存在/usr/src/linux/.config文件中,以供下一次编译内核时使用。

make-kpkg clean

编译新内核并把二进制文件打成deb包:
fakeroot make-kpkg -revision=mykernel.1.0 kernel_image --initrd

内核编译完成后在/usr/src目录下就会生成一个deb软件包: linux-image-2.6.25_mykernel.1.0_i386.deb

安装这个deb包:
dpkg -i linux-image-2.6.10_mykernel.1.0_i386.deb

输出结果:
Unpacking linux-image-2.6.25 (from linux-image-2.6.25_mykernel.1.0_i386.deb) ...
Done.
Setting up linux-image-2.6.25 (mykernel.1.0) ...
Running depmod.
Running postinst hook script update-grub.
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-2.6.25
Found kernel: /boot/vmlinuz-2.6.22-3-686
Found kernel: /boot/vmlinuz-2.6.18-5-686
Updating /boot/grub/menu.lst ... done

这样,在/boot目录下会生成System.map-2.6.10,vmlinuz-2.6.10文件。同时系统自动在/boot/grub/menu.lst中加入新内核的启动选项。重启系统,选择使用新内核。

TOP

发新话题