天天看点

使用linux内核,打造自己的linux

学习过linux的同学都只知道linux是开源免费的,也只是非常棒的,。但是既然开源,那我们是否自己也可以动手打造一个简单的linux呢?今天我们来实验一下

1.在虚拟机里添加一块新的硬盘

<a href="http://blog.51cto.com/attachment/201308/145353782.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201308/145356437.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201308/145358211.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201308/145401173.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201308/145403216.png" target="_blank"></a>

2.在新的硬盘上创建分区

<a href="http://blog.51cto.com/attachment/201308/145406344.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201308/145409217.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201308/145411119.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201308/145415272.png" target="_blank"></a>

3.把linux上启动是需要的文件拷贝到我们自己创建的linux上

a. 创建、挂载 mbr/grub

<a href="http://blog.51cto.com/attachment/201308/145418720.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201308/145421657.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201308/145424630.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201308/145427454.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201308/145430810.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201308/145433977.png" target="_blank"></a>

b.创建系统需要的目录

<a href="http://blog.51cto.com/attachment/201308/145436705.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201308/145440135.png" target="_blank"></a>

如果要将硬盘和机器使用,可能会因为型号之类的区别,部分驱动文件需要修改,我们可以对驱动进行拆包修改

<a href="http://blog.51cto.com/attachment/201308/145443675.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201308/145446790.png" target="_blank"></a>

将修改后的文件还原为init包,最后的名字可以自己修改

<a href="http://blog.51cto.com/attachment/201308/151252875.png" target="_blank"></a>

c.inittab和rc.sysint

<a href="http://blog.51cto.com/attachment/201308/145448861.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201308/145533873.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201308/145536768.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201308/145538472.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201308/145541896.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201308/145544921.png" target="_blank"></a>

对于进程而言,包含了很多的库文件,一个个的拷很麻烦,我们可以写一个脚本来帮助我们快速复制

脚本如下:

<a href="http://blog.51cto.com/attachment/201308/145550920.png" target="_blank"></a>

d.添加开机背景

<a href="http://blog.51cto.com/attachment/201308/145553203.png" target="_blank"></a>

最重要的一条要给rc.sysinit文件增加执行的权限

<a href="http://blog.51cto.com/attachment/201308/145555827.png" target="_blank"></a>

4.对我们的linux测试

<a href="http://blog.51cto.com/attachment/201308/145559660.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201308/145602482.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201308/145605845.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201308/145607736.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201308/145610171.png" target="_blank"></a>

ok!实验结束...

    本文转自Tar0 51CTO博客,原文链接:http://blog.51cto.com/tar0cissp/1265257,如需转载请自行联系原作者

继续阅读