ko6410内核和根文件系统的编译过程

来源:互联网 发布:通用汽车dps编程软件 编辑:程序博客网 时间:2024/05/14 09:29

1、配置内核

 make menuconfig ARCH=arm

2、编译内核

 make uImage ARCH=arm CROSS_COMPILE=arm-linux-

 (uImage路径:内核位置/arch/arm/boot/uImage)

3、文件系统

 mkdir rootfs

 cd rootfs

 mkdir bin dev etc lib proc sbin sys usr mnt tmp var home root

 mkdir usr/bin usr/lib usr/sbin usr/share lib/modules

 

4、创建设备文件

  cd dev/

  mknod -m 666 console c 5 1

  mknod -m 666 null c 1 3

  

5 安装/etc

  tar etc.tar.gz -C /home/tftpboot/rootfs

 

6、编译内核模块

  make modules ARCH=arm CROSS_COMPILE=arm-linux-

  安装内核模块

  make modules ARCH=arm

  INSTALL_MOD_PATH=/home/tftpboot/rootfs

 

7、配置busybox

    进入busybox目录执行

    make menuconfig

a、进入Busybox Settings->

   build Options->

   选上“Build busybox as a static binary,静态链接

   Cross Complier Prefix(arm-linux-)

 

   installation Options->

   选上“Don't usr/usr

   BusyBox Installation Prefix(/home/tftpboot/rootfs)

 

8、编译、安装busybox

  make ARCH=arm CROSS_COMPILE=arm-linux-

  make install

 

9、使用Initramfs

1、配置

make menuconfig ARCH=arm

 General setup ->

[* ] Initial RAM filesystem and Ram disk...

 修改文件系统的路径

2、进入制作好的根文件系统中,执行

ln -s ./bin/busybox init

3、重新编译内核

 make uImage ARCH=arm CROSS_COMPILE=arm-linux-

 

 

9NFS文件系统

1、配置

make menuconfig ARCH=arm

  General setup ->

  [ ] Initial RAM filesystem and Ram disk...

  File systems ->

  [*] Network file systems->

  <*> NFS client support

  [*] Root file system on NFS

 

2、重新编译内核

 make uImage ARCH=arm CROSS_COMPILE=arm-linux-

 

 

10、配置uboot的启动参数:

set bootargs "root=/dev/mtdblock2 rootfstype=cramfs console=ttySAC0,115200"

修改为:set bootargs "root=/dev/nfs nfsroot=192.168.0.3:/home/tftpboot/rootfs ip=192.168.0.5 rw console=ttySAC0,115200"

其中:

root=/dev/nfs:表示内核采用nfs方式启动根文件系统

nfsroot=192.168.0.3:/home/tftpboot/rootfs:表示nfs启动根文件系统位于nfs服务器/home/tftpboot/rootfs目录下,服务器的ip地址为:192.168.0.3

ip=192.168.0.5:开发的板子的ip

rw:表示文件可以读写

console=ttySAC0,115200ttySAC0为控制台,波特率为115200

原创粉丝点击