根文件系统制作 (一)
来源:互联网 发布:ar.js 编辑:程序博客网 时间:2024/05/18 00:11
根据busybox源码可知,最小的根文件系统要具备如下条件:
1./dev/console 和/dev/null(open()打开设备)
2.init(来源于busybox,主要是一些命令,如cp,ls等,等编译busybox时,就得到)
3./etc/inittab
4.配置指定的程序
5.C库(r如:标准输入,输出,错误等)
【环境】
1:Ubuntu 10.10
2:u-boot-2010.03
3:linux-2.6.35
4:busybox-1.17.3
5:优龙FS2410
6:交叉编译器:arm-none-linux-gnueabi-gcc version 4.3.2
1)解压缩busybox
tar xjvf busybox-1.17.3.tar.bz2
解压后,可以在当前busybox目录下,看INSTALL或README,教你如何编译
2)配置源码
tony@Ubuntu:~/win/busybox-1.17.3$make menuconfig
BusyboxSettings --->
BuildOptions --->
[*] BuildBusyBox as a static binary (no shared libs)
[ ] Force NOMMU build (NEW)
[ ] Build with Large File Support (foraccessing files > 2 GB)
(/home/tony/toolchain/bin/arm-none-linux-gnueabi-)Cross Compiler prefix
() Additional CFLAGS (NEW)
3)编译
tony@Ubuntu:~/win/busybox-1.17.3$make
4)安装
busybox默认安装路径为源码目录下的_install
但是最好不要用默认目录,不然很容易破坏我们得东西,组号再创建一个目录
tony@Ubuntu:~/win/busybox-1.17.3$ mkdir -p /win/first_fs
tony@Ubuntu:~/win/busybox-1.17.3$ make CONFIG_PREPIX=/win/first_fs/install 根据busybox就可知道
tony@Ubuntu:~/win/busybox-1.17.3$ cd win/first_fs/install
tony@Ubuntu:~/win/busybox-1.17.3$make install
bin linuxrc sbin usr
-------------------------------------------------------------------------------
上面则实现了busybox编译,也可以用一些命令了(如;ls ,cp等)
----------------------------------------------------------------------------
6)添加其他所需目录
tony@Ubuntu:~/win/busybox-1.17.3/_install$mkdir dev etc mnt proc var tmp sys root lib
7)添加库
tony@Ubuntu:~/win/busybox-1.17.3/_install/lib$cp /home/tony/toolchain/arm-none-linux-gnueabi/lib/*so* ./lib/ -a
8)在管理员模式对库瘦身
tony@Ubuntu:~/win/busybox-1.17.3/_install$sudo su
root@Ubuntu:/home/tony/win/busybox-1.17.3/_install#source /home/tony/.bashrc //如果在etc/profile中不用
root@Ubuntu:/home/tony/win/busybox-1.17.3/_install#arm-none-linux-gnueabi-strip./lib/*
root@Ubuntu:/home/tony/win/busybox-1.17.3/_install#exit
9)添加系统启动文件
tony@Ubuntu:~/win/busybox-1.17.3/_install/etc$vim inittab
添加如下内容:
#this is run first except when booting insingle-user mode.
::sysinit:/etc/init.d/rcS
# /bin/sh invocations on selected ttys
# Start an "askfirst" shell on theconsole (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
10)在etc下添加fstab
tony@Ubuntu:~/win/busybox-1.17.3/_install/etc$vim fstab
添加如下内容:
#device mount-point type options dump fsch 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
11)这里我们挂载的文件系统有三个:proc、sysfs和tmpfs,在内核中proc和sysfs默认都支持,
而tmpfs是没有支持的,检查内核有没有支持tmpfs,如果没有请设置
tony@Ubuntu:~/win/linux-2.6.35$make menuconfig
File systems --->
Pseudo filesystems --->
[*] Virtual memory file system support(former shm fs)
[*] Tmpfs POSIX Access Control Lists
重新编译内核
12)在etc下创建init.d目录,并在该目录下创建rcS文件
tony@Ubuntu:~/win/busybox-1.17.3/_install/etc$mkdir init.d
tony@Ubuntu:~/win/busybox-1.17.3/_install/etc/init.d$vim rcS
添加如下内容:
#!/bin/sh
#This is the firstscript called by init process
/bin/mount -a
为rcS添加可执行权限
tony@Ubuntu:~/win/busybox-1.17.3/_install/etc/init.d$chmod +x rcS
13)在etc下创建profile文件
tony@Ubuntu:~/win/busybox-1.17.3/_install/etc$vim profile
添加如下内容:
#!/bin/sh
exportHOSTNAME=tony
export USER=root
export HOME=root
#exportPS1="[$USER@$HOSTNAME \W]#"
PATH=/bin:/sbin:/usr/bin:/usr/sbin
LD_LIBRARY_PATH=lib:/usr/lib:$LD_LIBRARY_PATH
export PATHLD_LIBRARY_PATH
14)在dev下创建console节点(这个设备节点是必须的)
tony@Ubuntu:~/win/busybox-1.17.3/_install$sudo mknod dev/console c 5 1
15)制作已完成,在NFS中进行测试
①将OK的文件系统拷贝到/opt/filesystem下
tony@Ubuntu:~/win/busybox-1.17.3$cp _install/* /opt/filesystem -a
②设置U-Boot环境变量
setenv bootcmd tftp 30800000 uImage \; bootm
setenv bootargs console=ttySAC0,115200 init=/linuxrc root=nfs nfsroot=192.168.7.103:/opt/filesystem ip=192.168.7.163
重新启动开发板,查看是否能够正常挂载
- 根文件系统制作 (一)
- 根文件系统制作 (一)
- 制作根文件系统(一)
- 一步步制作根文件系统 (一)
- jffs2根文件系统制作(一)
- linux文件系统制作(一)
- 根文件制作(一):根文件系统树 和 Initramfs文件系统的制作
- 根文件系统制作一制作根文件系统树
- 嵌入式根文件系统的移植和制作(一)
- LINUX移植——根文件系统制作(一)
- Linux内核移植和根文件系统制作(一)
- 一步一步制作yaffs/yaffs2根文件系统(一)
- 使用busybox制作Linux文件系统(一)
- rootfs文件系统的制作(一)
- linux根文件系统制作——step by step(一)
- 制作嵌入式根文件系统(常见问题详解)
- 制作根文件系统(修正版)
- 根文件系统制作(修订版二)
- 1:(C#下使用GDAL库)下载和引用方法
- U-Boot-2010.12移植到2440 .
- android:textAppearance解析
- ASP+MYSQL:ODBC 驱动程序不支持所需的属性
- memcpy()函数的离奇事件
- 根文件系统制作 (一)
- BM
- RF5相关资源(待整理)
- 谷歌开发者大会召开 地图服务成亮点
- 构造SqlDataAdapter InsertCommand和UpdateCommand 帮助类解决并发冲突
- jffs2文件系统制作 .(二)
- 投票系统
- jdbc 连接 mysql 时的中文乱码问题
- yaffs2文件系统制作 .