Chinaunix首页 | 论坛 | 博客

1U

  • 博客访问: 3909
  • 博文数量: 4
  • 博客积分: 120
  • 博客等级: 入伍新兵
  • 技术积分: 50
  • 用 户 组: 普通用户
  • 注册时间: 2008-08-23 14:08
文章分类
文章存档

2011年(1)

2008年(3)

我的朋友
最近访客

分类: LINUX

2008-08-23 14:18:58

  配置

[root@localhost busybox-1.4.2]# make defconfig
[root@localhost busybox-1.4.2]# make xconfig
=============================================
修改配置 主要修改如下
=============================================
Busybox Settings
     Build Options
   [*]Build BusyBox as a static binary    
      //
选此项静态编译。

Miscellaneous Utilities
     []taskset    //
选了就会出错

-------------------------------------------------
  编译
[root@localhost busybox-1.5.1]# make all install
-----------------------------------------------------------------
最后会在  busybox-1.5.1/_install/目录生成你要的 bin sbin  usr 目录
------------------------------------------------------------------
2.
编写linuxrc 文件
-----------------------------------------------------------------
#!/bin/sh
#e cho "mount /etc as ramfs"
/bin/mount -n -t ramfs ramfs /etc
/bin/cp -a /mnt/etc/* /etc

echo "re-create the /etc/mtab entries"
# re-create the /etc/mtab entries
/bin/mount -f -t cramfs -o remount,ro /dev/mtdblock/3  /

#mount some file system
echo "mount  /dev/shm as tmpfs"
/bin/mount -n -t  tmpfs tmpfs /dev/shm

#挂载/procproc文件系统
echo "mount /proc as proc"
/bin/mount -n -t  proc none /proc

#挂载/syssysfs文件系统
echo "mount  /sys as sysfs"  
/bin/mount -n -t  sysfs none /sys

/bin/mount -f -t ramfs ramfs /etc

echo "yaffs is mounted"
/bin/mount -t yaffs /dev/mtdblock/1 /mnt/yaffs
exec /sbin/init
---------------------------------------------------------------------
3.
权限修改
chmod  chmod 775 linuxrc

4.  编写 inittab文件
---------------------------------------------------------------------
::sysinit:/etc/init.d/rc
::askfirst:-/bin/sh
tty2::askfirst:-/bin/sh
tty3::askfirst:-/bin/sh
tty4::askfirst:-/bin/sh
tty0::askfirst:-/bin/sh
   ::restart:/sbin/init
        ::ctrlaltdel:/sbin/reboot
::shutdown:/bin/umount -a -r
::shutdown:/sbin/swapoff -a
----------------------------------------------------------------------

5. rc文件
----------------------------------------------------------------------
#!/bin/sh

/bin/mount -a
-----------------------------------------------------------------------

6. fastab 文件
----------------------------------------------------------------------
none  /proc  proc defaults 0 0
none  /dev/pts devpts mode=0622 0 0
tmpfs  /dev/shm tmpfs defaults 0 0
----------------------------------------------------------------------

7. 各文件的关系
----------------------------------------------------------------------
7.1
建立一个目标板的空根目录
我们将在这里构建构建根文件系统,创建基础目录结构. 存放交叉编译后生成的目标应用程序
BUSYBOXTINYLOGIN),存放库文件等。
[root@localhost rootfs]# mkdir my_rootfs
[root@localhost rootfs]# pwd
/home/arm/dev_home/rootfs/my_rootfs
[root@localhost rootfs]# cd my_rootfs
[root@localhost my_rootfs]#
7.2
my_rootfs中建立Linux目录树
[root@localhost my_rootfs]#mkdir bin dev etc home lib mnt proc sbin sys tmp root usr
[root@localhost my_rootfs]#mkdir mnt/etc
[root@localhost my_rootfs]#mkdir usr/bin usr/lib usr/sbin
[root@localhost my_rootfs]#touch linuxrc
[root@localhost my_rootfs]#tree
|bin
|dev
|etc
|home
|lib
|linuxrc
/*
此文件为启动脚本,是一shell脚本文件。本文后面有专门介绍 */
|mnt
| `etc  
|proc
|sbin
|sys
|tmp
|root
`usr
|bin
|lib
`sbin

8. 把上面编译出来的 busybox文件拷贝到 my_rootfs 文件系统
---------------------------------------------------------------
busybox1.5.1/_install/目录下的 bin  sbin  usr 覆盖 my_rootfs
文件夹里的空文件夹。
--------------------------------------------------------------

9. 5 生成的文件(rc)拷贝到 /mnt/etc/init.d/目录(先在/mnt/etc/目录新建格init.d目录)
46生成的文件(inittab fastab )放到 /mnt/etc/目录
2 生成的文件linuxrc 放到/目录
        
这里所提到的 /目录即my_rootfs目录。
10.
新建/dev设备,/dev目录(即my_rootfs/dev/.
mknod console c 5 1

8. 生成cramfs文件
----------------------------------------------------------------
下载mkfs.cramfs工具,然后用下面命令生成你要的cramfs文件系统
./mkfs.cramfs  ./my_rootfs    ./root.cramfs

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

chinaunix网友2008-08-23 14:20:43

阳总终于开博了