文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>不能用安装的linux自带的源代码编译

不能用安装的linux自带的源代码编译

时间:2009-06-02  来源:newcch


    虽然RedHat有提供kernel的source package(kernel-devel-xxxxx),且只要安装该套件后kernel source tree即会被放置在 /usr/src/kernels/ 目录下,但是若我们试着在该kernel source tree里面进行complie的动作则会出现以下的错误讯息:『make[1]: *** No rule to make target `init/main.o', needed by `init/built-in.o'. Stop.』。会造成这种情况的原因并不清楚,总之我们就是不能直接拿kernel-devel套件里面提供的kernel source tree来打造自己的kernel。因此我们必须要改用kernel-xxxxx.src.rpm还原出的kernel source tree来进行patch与compile的动作。
 所需要的套件:
kernel-2.6.9-55.EL.src.rpm (在此以2.6.9-55.EL这个版本为例)

一、从source rpm档案中还原出kernel source tree
1.rpm -ivh kernel-2.6.9-55.EL.src.rpm
相关的档案会被放置在 /usr/src/redhat 的子目录中(SOURCE,SPECS等),但在RPM Database中将不会有这个套件的安装记录,此为正常现象。
2.cd /usr/src/redhat/SPECS
rpmbuild -bp kernel-2.6.spec –target=i686
此指令会把所有RedHat提供的patch档案patch至kernel source tree中,并将kernel source tree放置于 /usr/src/redhat/BUILD/kernel-2.6.9/linux-2.6.9目录中。   二、Patch Distribution Kernel 1. 将patch档案复制到kernel source tree的root dir
eg. cp myhappy.patch /usr/src/redhat/BUILD/kernel-2.6.9/linux-2.6.9
2. cd /usr/src/redhat/BUILD/kernel-2.6.9/linux-2.6.9
  patch -p1 < myhappy.patch
三、设定Kernel
1. cd /usr/src/redhat/BUILD/kernel-2.6.9/linux-2.6.9
  make menuconfig
3. 此时会有选单出现,请将画面移到最下方选取 "Load An Alternate Configuration File" 4. 开始设定kernel   四、编译kernel 1. cd /usr/src/redhat/BUILD/kernel-2.6.9/linux-2.6.9
2. vi MakeFile
  EXTRAVERSION = -55-custom
修改EXTRAVERSION的值以免和原本的版本搞混,例如改为-55-custom则最后产生出来的kernel iamge为vmlinuz-2.6.9-55-custom。 3. make clean
注意!不能用make mrproper,否则会连.config(kernel设定档)也一并清除。
4. make   此部分为修改,2.6.X的内核这样编译就可以啦
6. make modules_install
7. make install
8. 最后要记得修改 /boot/grub/grub.conf
注:
若是不想用 make install 来自动安装kernel image,也可以改用手工安装。

1. 将kernel source tree中的arch/i386/boot/bzImage改名为vmlinux-2.6.9-55-custom
2. mkinitrd initrd-2.6.9-55-custom.img `2.6.9-55-custom` 3. cp /usr/src/redhat/BUILD/kernel-2.6.9/linux-2.6.9/System.map \     /boot/System.map-2.6.9-55-custom 4. 将kernel与initrd images放置到 /boot目录,并修改 /boot/grub/grub.conf
 
英语网站的资料: rpmbuild -bp kernel-2.6.spec If you want to build the kernel for a specific architecture such as i386, i586, i686, or x86_64, you can do it like this:
rpmbuild -bp --target=i686 kernel-2.6.spec
mkinitrd /boot/initrd-2.6.18-custom-2.6.18.2.img 2.6.18-custom-2.6.18.2
相关阅读 更多 +
排行榜 更多 +
PvZ戴夫的时空冒险重置

PvZ戴夫的时空冒险重置

策略塔防 下载
PVZTV雪版阳光加50

PVZTV雪版阳光加50

策略塔防 下载
双刃战士雪姐

双刃战士雪姐

冒险解谜 下载