您的位置:首页 > 其它

内核编译之支持NTFS

2014-05-21 16:22 162 查看
内核编译之支持NTFS 这次我们就拿让redhat支持ntfs来演示一下linux内核编译
有时候我们需要定制化自己的内核,或要启用某些功能来支持我们的硬件&系统或去掉一些不必要的功能来减少攻击面。这个时候我们就需要编译内核来实现我们的目的了,好了,现在我们开始来演示一下怎么做。
首先,我们要得到内核源代码,这个可以直接去下载,地址是http://www.kernel.org/进去之后如下图,我们下载我们需要的就可以了
650) this.width=650;" style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://img1.51cto.com/attachment/201208/30/4042188_1346313112m2AS.jpg" "554" height="366" />
下载完成后,我们得到一个归档过的文件,我们来做解压
过程如下,我们还可以用file 命令来看一下这是什么文件,如图,这是用bzip2归档过的,我们就用bzip2来解压好了
650) this.width=650;" style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" title="clip_image004" border="0" alt="clip_image004" src="http://img1.51cto.com/attachment/201208/30/4042188_1346313112JwBO.jpg" "552" height="174" />
用同样的步骤,我们解压linuxxxxx.tar
tar -xvf linux-2.6.32.59.tar
650) this.width=650;" style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" title="clip_image006" border="0" alt="clip_image006" src="http://img1.51cto.com/attachment/201208/30/4042188_1346313114pCzX.jpg" "402" height="400" />
好的,我们现在来copy到/usr/srv下,我给它重名命成linux
mv linux-2.6.32.59 /usr/src/linux
650) this.width=650;" style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" title="clip_image008" border="0" alt="clip_image008" src="http://img1.51cto.com/attachment/201208/30/4042188_1346313115BwRG.jpg" "558" height="159" />
还有,如果你是通过安装kernel-source或系统带的源代码也可以,记住清除从前编译内核时残留的.o 文件和不必要的关联
makemrproper
我们既然要编译内核,肯定要有make命令,编译要用gcc,所以我们直接来安装一下
650) this.width=650;" style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" title="clip_image010" border="0" alt="clip_image010" src="http://img1.51cto.com/attachment/201208/30/4042188_1346313116k321.jpg" "553" height="200" />
650) this.width=650;" style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" title="clip_image012" border="0" alt="clip_image012" src="http://img1.51cto.com/attachment/201208/30/4042188_1346313116WaE4.jpg" "554" height="46" />
这是通过cat README |less得出的,如下图
650) this.width=650;" style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" title="clip_image014" border="0" alt="clip_image014" src="http://img1.51cto.com/attachment/201208/30/4042188_1346313117ufDq.jpg" "551" height="272" />
在图形界面下编译的时候用make xconfig;字符界面下用make menuconfig,我个人喜欢用后者
如果出现错误,会提示的很清楚,我们按着来就好了
650) this.width=650;" style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" title="clip_image016" border="0" alt="clip_image016" src="http://img1.51cto.com/attachment/201208/30/4042188_1346313118crA8.jpg" "551" height="222" />
650) this.width=650;" style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" title="clip_image018" border="0" alt="clip_image018" src="http://img1.51cto.com/attachment/201208/30/4042188_1346313119xYSN.jpg" "553" height="116" />
出现这个画面的时候说明问题已经不大了,但还是不好看,下面的乱码是因为字符集问题
650) this.width=650;" style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" title="clip_image020" border="0" alt="clip_image020" src="http://img1.51cto.com/attachment/201208/30/4042188_1346313120d1i1.jpg" "556" height="313" />
下图中我已经把字符集改成纯英文的了,如图所示,我们可以用键盘上的上下来选择,我们看到,这里分门别类的列出来的项目,此次我们的目标是ntfs,它属于文件系统格式类的,下图中我们有个file systems,这就是了,我们选中后直接回车就可以进入子项,在里面就会有很多的文件格式
650) this.width=650;" style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" title="clip_image022" border="0" alt="clip_image022" src="http://img1.51cto.com/attachment/201208/30/4042188_1346313120CoAv.jpg" "554" height="346" />
进入后,我们往下走,找到如下图所示的DOS/FAT/NT开头的,然后我们再次双击进去,找到NTFS
650) this.width=650;" style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" title="clip_image024" border="0" alt="clip_image024" src="http://img1.51cto.com/attachment/201208/30/4042188_1346313122XrkO.jpg" "553" height="347" />
找到后我们按空格可以选中,然后我们按ESC,退出来,一路ESC
650) this.width=650;" style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" title="clip_image026" border="0" alt="clip_image026" src="http://img1.51cto.com/attachment/201208/30/4042188_1346313123Mu4q.jpg" "554" height="351" />
亲,这里一定要选YES啊,不然你前面选半天的东西就没了
650) this.width=650;" style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" title="clip_image028" border="0" alt="clip_image028" src="http://img1.51cto.com/attachment/201208/30/4042188_1346313124myfg.jpg" "554" height="350" />
下图中,说配置写入到了.config
650) this.width=650;" style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" title="clip_image030" border="0" alt="clip_image030" src="http://img1.51cto.com/attachment/201208/30/4042188_1346313124lii4.jpg" "557" height="351" />
自带的帮助里一直再说一定要注意备份,你们也是哦亲
650) this.width=650;" style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" title="clip_image032" border="0" alt="clip_image032" src="http://img1.51cto.com/attachment/201208/30/4042188_1346313125slat.jpg" "556" height="312" />
make bzImage开始编译过程,这个时间可能会有那么一点长。。其实有那么两点长。。。三点长,好吧,比较长!!!这个和硬件配置有关系
650) this.width=650;" style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" title="clip_image034" border="0" alt="clip_image034" src="http://img1.51cto.com/attachment/201208/30/4042188_1346313126mCF2.jpg" "371" height="400" />
直到出现下图,完成编译
650) this.width=650;" style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" title="clip_image035" border="0" alt="clip_image035" src="http://img1.51cto.com/attachment/201208/30/4042188_1346313128OcHL.jpg" "460" height="305" />
根据上图提示,build出来的放到了arch下,我们直接复制到boot下,为了好辨认,我们给他起他其他名字
650) this.width=650;" style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" title="clip_image037" border="0" alt="clip_image037" src="http://img1.51cto.com/attachment/201208/30/4042188_1346313129aS8l.jpg" "555" height="194" />
make modules我们开始编译模块,这个时间也有点长,这取决于我们选了多少模块
650) this.width=650;" style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" title="clip_image039" border="0" alt="clip_image039" src="http://img1.51cto.com/attachment/201208/30/4042188_1346313130qX2e.jpg" "443" height="201" />
Make modules_install
我们来安装一下上一步编译好的模块,这一步还是比较快的
650) this.width=650;" style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" title="clip_image041" border="0" alt="clip_image041" src="http://img1.51cto.com/attachment/201208/30/4042188_1346313131BCoW.jpg" "556" height="372" />
如果你用的是SCSI硬盘并且采用的是ext3后的分区格式的话,请注意,一定要制作initrd.img,因为驱动就在里面
650) this.width=650;" style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" title="clip_image043" border="0" alt="clip_image043" src="http://img1.51cto.com/attachment/201208/30/4042188_1346313131OSIU.jpg" "555" height="104" />
我们来更新System.map文件
650) this.width=650;" style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" title="clip_image045" border="0" alt="clip_image045" src="http://img1.51cto.com/attachment/201208/30/4042188_13463131323dMk.jpg" "509" height="107" />
然后我们执行make install就OK了
Make install是个自动化的过程,你看,我们的/boot/grub/grub.conf已经有了新的内容了,reboot的时候我们选择新内核就好了,如果要默认,就在那个default=X这里指定
650) this.width=650;" style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" title="clip_image047" border="0" alt="clip_image047" src="http://img1.51cto.com/attachment/201208/30/4042188_1346313133b3PH.jpg" "554" height="350" />
650) this.width=650;" style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" title="clip_image049" border="0" alt="clip_image049" src="http://img1.51cto.com/attachment/201208/30/4042188_1346313135mTeR.jpg" "532" height="400" />
完美成功,祝大家顺利
本文出自 “阳光☆奋进” 博客,请务必保留此出处http://ucweb.blog.51cto.com/4042188/977531
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: