以linux-2.6.38.4.tar.bz2源码包为例
上官网http://www.kernel.org/下载stable版的 linux-2.6.38.4.tar.bz2源码包,用sudo或root账户执行下面指令
mv /home/zhb/Downloads/ linux-2.6.38.4.tar.bz2 /usr/src
tar
tar - xvf linux - 2.6 . 38.4 .tar.bz2
# # 使用make install#一步到位或者继续使用下面的指令
make mrproper # 确保目录下没有不正确的.o文件和文件依赖
make menuconfig # 需要Ncures库支持,xconfig需要qt库支持,config和oldconfig不需要,配置好内核需要的功能后保存为.config文件
make dep # 对内核的配置文件.config执行完整性和依赖性检测
make clean # 清除不必要的文件
make bzImage # 大内核用它否则用zImage,可执行内核的压缩格式,此时生成内核文件arch/x86/boot/bzImage
make modules # 编译可加载模块
make modules_install # 将编译好的模块移动到/lib/modules/2.6.38.4/对应的目录中去;insmod 会查找这些目录
mkinitrd initramfs - 2.6 . 38.4 .img 2.6 . 38.4 # 生成 initramfs-2.6.38.4.img 根文件系统初始化文件
mv arch / x86 / boot / bzImage / boot / vmlinuz - 2 . 2.6 . 38.4
mv initramfs - 2.6 . 38.4 .img / boot / initramfs - 2.6 . 38.4 .img
mv System.map / boot / System.map
vi / boot / grub / menu.lst # 模仿老的内核启动项添加一个新的启动项,只要修改相应的内核文件明和初始
reboot # 重启
1万+

被折叠的 条评论
为什么被折叠?



