现在的位置: 首页 > 综合 > 正文

busybox-1.16.0制作yaffs2文件系统

2013年10月10日 ⁄ 综合 ⁄ 共 4280字 ⁄ 字号 评论关闭

busybox-1.16.0制作yaffs2文件系统

  1. 平台
    系统:Ubuntu-9.04    
    交叉编译器:gcc-3.4.1,glibc-2.3.3
    验证平台:S3C2440,Linux-2.6.33.6,nand flash
    使用源文件:busybox-1.16.0.tar.bz2
  2. 下载busybox-1.16.0.tar.bz2,并解压 #tar jcvf busybox-1.16.0.tar.bz2
    #cd busybox-1.16.0
  3. 修改Makefile #gedit Makefile
    修改ARCH和CROSS_COMPILE为如下
    #自己的交叉编译器
    CROSS_COMPILE = arm-linux-
    #arm结构
    ARCH = arm
  4. 配置busybox #make menuconfig
    下面只列出虚注意的,未列出的为默认
    Busybox Settings --->
        General Configuration --->
                Buffer allocation policy (Allocate with Malloc) --->
            [*] Show verbose applet usage messages
            [*] Store applet usage messages in compressed form
            [*] Support --install [-s] to install applet links at runtime
            [*] Enable locale support (system needs locale for this to work)
            [*] Support for --long-options
            [*] Use the devpts filesystem for Unix98 PTYs
            [*] Support writing pidfiles
            [*] Runtime SUID/SGID configuration via /etc/busybox.conf
            [*] Suppress warning message if /etc/busybox.conf is not readable
            (/proc/self/exe) Path to BusyBox executable
        Build Options --->
            [*] Build BusyBox as a static binary (no shared libs)
            [*] Build with Large File Support (for accessing files > 2 GB)
        Installation Options --->
            [ ] Don
  5. 编译和安装busybox(当然你把该小结看完再执行也行) #make
    #make install

    顺利的话,你会在busybox-1.16.0文件夹下发现一个新的文件夹 _install ,他就是你需要的该文件系统,恭喜你,根文件系统编译成功了。
    当然它只是根文件系统,并不是你可直接下载到板子上的东西,你还要做相应的配置,和借助一些工具加工。
    还有,在编译的时候你很有可能出现很多问题,例如我也出现了
    coreutils/fsync.c: In function `fsync_main':
    coreutils/fsync.c:27: error: `O_NOATIME' undeclared (first use in this function)
    coreutils/fsync.c:27: error: (Each undeclared identifier is reported only once
    coreutils/fsync.c:27: error: for each function it appears in.)
    make[1]: *** [coreutils/fsync.o] 错误 1
    make: *** [coreutils] 错误 2
    经过查质料,把配置里面的Coreutils里的fsync不选中,重新编译,就解决了,如下
    Coreutils --->
          [ ] fsync
    你如果遇到问题也一定要自己查资料解决的,有的问题是交叉编译器导致的

  6. 开始构建文件系统    1)新建一个目录root-2.6.33.4,把busybox-1.16.0/_install/目录下生成:bin、linuxrc、sbin、usr复制过来,并且在该目录下创建文件系统所需要的其他目录 #mkdir root-2.6.33.4
    #cp -rf busybox-1.16.0/_install/* root-2.6.33.4/
    #cd root-2.6.33.4/
    #mkdir dev etc home lib mnt opt proc tmp var www

       2)向各目录中添加文件系统所需要的目录或文件,没有提到的就不用添加。这里要注意各种文件的权限,建议都改为777,命令:#chmod 777 文件名
    "dev"目录,创建两个设备文件: #mknod console c 5 1
    #mknod null c 1 3

    "etc"目录,创建各种配置文件并向里面添加内容,没有列出的就不用添加:
    boa/boa.conf: boa WEB服务器配置文件,暂时为空。
    group: 系统用户组配置文件,内容如下: root:*:0:
    daemon:*:1:
    bin:*:2:
    sys:*:3:
    adm:*:4:
    tty:*:5:
    disk:*:6:
    lp:*:7:lp
    mail:*:8:
    news:*:9:
    uucp:*:10:
    proxy:*:13:
    kmem:*:15:
    dialout:*:20:
    fax:*:21:
    voice:*:22:
    cdrom:*:24:
    floppy:*:25:
    tape:*:26:
    sudo:*:27:
    audio:*:29:
    ppp:x:99:
    500:x:500:plg
    501:x:501:fa

    inittab: 系统init进程配置文件,内容如下: # /etc/inittab
    ::sysinit:/etc/init.d/rcS
    console::askfirst:-/bin/sh
    ::ctrlaltdel:/sbin/reboot
    ::shutdown:/bin/umount -a -r

    mime.types: 暂时为空。
    passwd: 系统密码文件,内容如下: root::0:0:root:/:/bin/sh
    ftp::14:50:FTP User:/var/ftp:
    bin:*:1:1:bin:/bin:
    daemon:*:2:2:daemon:/sbin:
    nobody:*:99:99:Nobody:/:
    sky::502:502:Linux User,,,:/home/mry:/bin/sh

    rc.d/init.d/httpd: 内容如下: #!/bin/sh

    base=boa

    # See how we were called.
    case "$1" in
      start)
            /usr/sbin/$base
            ;;
      stop)
        pid=`/bin/pidof $base`
        if [ -n "$pid" ]; then
            kill -9 $pid
        fi
            ;;
    esac

    exit 0
    sysconfig/HOSTNAME: 主机名称文件,内容如下: MY2440
    fstab: 系统挂载文件系统列表,内容如下: # device  mount-point   type     options     dump   fsck order
    none      /proc         proc     defaults    0      0
    none      /dev/pts      devpts   mode=0622   0      0
    tmpfs     /dev/shm      tmpfs    defaults    0      0

    init.d/rcS: 系统启动加载项,内容如下: #!/bin/sh

    PATH=/sbin:/bin:/usr/sbin:/usr/bin
    runlevel=S
    prevlevel=N
    umask 022
    export PATH runlevel prevlevel

    #
    #    Trap CTRL-C &c only in this shell so we can interrupt subprocesses.
    #
    /bin/mount -t proc none /proc
    /bin/mount -t tmpfs none /tmp
    /bin/mount -t tmpfs none /var

    /bin/mkdir -p /var/log

    /bin/hostname -F /etc/sysconfig/HOSTNAME
    mdev.conf: mdev设备配置文件,暂时为空。
    net.conf: 网络配置文件,暂时为空。
    profile: 用户环境配置文件,内容如下: # Ash profile
    # vim: syntax=sh

    # No core files by default
    #ulimit -S -c 0 > /dev/null 2>&1

    USER="`id -un`"
    LOGNAME=$USER
    PS1='[/u@/h /W]/# '
    PATH=$PATH:/usr/local/bin
    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
    HOSTNAME=`/bin/hostname`

    export USER LOGNAME PS1 PATH LD_LIBRARY_PATH
    resolv.conf: DNS配置文件,内容如下: nameserver 61.144.56.100

    "home"目录:创建一个mry目录,与etc目录passwd文件中的mry相对应
    "lib"目录:这个里面放的都是库文件,直接从交叉编译器的库文件目录中拷贝过来(也可以不拷贝): #cp -f /usr/local/arm/arm-linux3.4.1/gcc-3.4.1-glibc-2.3.3/arm-linux/lib /*so* lib/ -a

  7. 使用yaffs制作工具编译构建好的文件系统。先解压mkyaffs2image.tgz(可以在他们的网站上下载),会自动解压到开发主机的/usr/sbin/目录下。编译后生成的文件系统镜像root-2.6.33.4.bin也在这个目录下
    #tar -zxvf mkyaffs2image.tgz
    #mkyaffs2image-128M root-2.6.33.4/ root-2.6.33.4.bin
  8. 下载文件系统镜像到开发板上测试,使用情况如下:

抱歉!评论已关闭.