Chinaunix首页 | 论坛 | 博客
  • 博客访问: 686259
  • 博文数量: 152
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1793
  • 用 户 组: 普通用户
  • 注册时间: 2013-09-12 12:26
个人简介

相信自己,只有不想做的,没有做不到的。

文章分类

全部博文(152)

文章存档

2021年(1)

2015年(2)

2014年(74)

2013年(75)

分类: LINUX

2013-09-13 22:00:38

 

一、根文件系统制作

1、  源码下载

我们选择的版本是busybox-1.17.3.tar.bz2下载路径为:

2、  解压源码

$ tar  xvf  busybox-1.17.3.tar.bz2

3、  进入源码目录  

$ cd  busybox-1.17.3

4、  配置源码

$ make menuconfig

Busybox Settings --->

       Build Options --->

              [*] Build BusyBox as a static binary (no shared libs)

              [ ] Force NOMMU build

              [ ] Build with Large File Support (for accessing files > 2 GB)

              (arm-cortex_a8-linux-gnueabi-) Cross Compiler prefix

              () Additional CFLAGS

5、  编译

$ make

6、  安装

busybox默认安装路径为源码目录下的_install

$ make  install

7、  进入安装目录下

$ cd  _install

$ ls

bin  linuxrc  sbin  usr

8、  创建其他需要目录

$ mkdir  dev  etc  mnt  proc  var  tmp  sys  root

9、  添加库

?         将工具链中的库拷贝到_install目录下

$ cp  /home/linux/toolchain/arm-cortex_a8-linux-gnueabi/sysroot/lib   ./  -a

?         删除静态库和共享库文件中的符号表

$ rm  lib/*.a

$ arm-cortex_a8-linux-gnueabi-strip  lib/*

?         删除不需要的库,确保所有库大小不超过4M

$ rm  lib/libstdc++*

$ du  -mh   lib/

10、  添加系统启动文件

etc下添加文件inittab,文件内容如下:

#this is run first except when booting in single-user mode.

:: sysinit:/etc/init.d/rcS   //运行的第一个程序

# /bin/sh invocations on selected ttys

# start an "askfirst" shell on the console (whatever that may be)

::askfirst:-/bin/sh   //进入控制平台操作

# stuff to do when restarting the init process

::restart:/sbin/init

# stuff to do before rebooting

::ctrlaltdel:/sbin/reboot

etc下添加文件fstab文件内容如下:静态挂载

#device     mount-point     type        options         dump     fsck order

proc         /proc             proc           defaults     0                0

tmpfs         /tmp                   tmpfs         defaults         0                 0

sysfs          /sys                    sysfs          defaults           0                 0

tmpfs    /dev                   tmpfs         defaults         0                 0

       这里我们挂的文件系统有三个procsysfstmpfs在内核中procsysfs默认都支持,而tmpfs是没有支持的,我们需要添加tmpfs的支持

修改内核配置:

File systems --->

       Pseudo filesystems --->

              [*] Virtual memory file system support (former shm fs)

              [*] Tmpfs POSIX Access Control Lists

重新编译内核

      

       etc下创建init.d目录,并在init.d下创建rcS文件,rcS文件内容为:

#!/bin/sh

# This is the first script called by init process

/bin/mount  -a     //挂载/dev/pts /sys /tmp

echo  /sbin/mdev  >  /proc/sys/kernel/hotplug

/sbin/mdev  -s  

       rcS添加可执行权限:

       $ chmod   +x  init.d/rcS

       etc下添加profile文件,文件内容为:

#!/bin/sh

export HOSTNAME=farsight

export USER=root

export HOME=root

export PS1="[$USER@$HOSTNAME \W]\# "

PATH=/bin:/sbin:/usr/bin:/usr/sbin

LD_LIBRARY_PATH=/lib:/usr/lib:$LD_LIBRARY_PATH

export PATH  LD_LIBRARY_PATH

11、  设备文件创建

根文件系统中有一个设备节点是必须的,在dev下创建console节点

$ sudo  mknod   dev/console  c  5  1

重要:新制作的文件系统尺寸若超出8M,删除不需要的库文件

       NFS测试

    1删除原先的/source/rootfs

    $ sudo  rm  -rf  /source/rootfs  

    2、将我们新建文件系统拷贝到/source/rootfs目录下

    $sudo  mkdir  /source/rootfs

    $ sudo  cp  _install/*   /source/rootfs   –a

    3、设置uboot环境变量

# setenv  bootcmd  tftp  20008000  zImage\; go  20008000

# setenv  bootargs  root=nfs  nfsroot=192.168.1.100:/source/rootfs  init=/linuxrc console=ttySAC0,115200  ip=192.168.1.200

# saveenv

重新启动开发板,查看是否能够正常挂载,功能是否正常

阅读(447) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~