打印
[ZLG-ARM]

从无到有用busybox做最小文件系统

[复制链接]
2211|3
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
armqt|  楼主 | 2009-7-3 13:47 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
 这里以ixp435平台为例子。 
Get source code: busybox-1.7.2-1 (当然其他的版本的都可以)
Tool chain:armv5-linux-* (和编linux kernel的相同)
make menuconfig ,配置功能,可以从其他地方拿一个过来改改。注意打开'Busybox Settings'->'Installation Options'->' Don't use /usr' 这样在安装的时候会安装到自己指定的目录(default ./_install),或者可以在make时加参数CONFIG_PREFIX=目录
make ARCH=arm CROSS_COMPILE=armv5b-linux- install
复制必要的库文件: 如果没有,会出现这样的错误
Failed to execute /sbin/init.  Attempting defaults...
Kernel panic - not syncing: No init found.  Try passing init= option to kernel.
库文件要到这里使用的编译器相对应的目录中找。这里一般需要两类库文件:一类是busybox编译完后提示出来的lib:比如Trying libraries: crypt m
Library crypt is needed
Library m is needed
Final link with: crypt m
这里意思是需要libcrypt和libm的库。还有一类是最基本的libc库和ld库。
做ramdisk,可以参考我前面的**。
到这里,一个最简单的fs已经工作了,已经可以看到这样一个东西了
RAMDISK: Compressed image found at block 0
Time: OSTS clocksource has been installed.
VFS: Mounted root (ext2 filesystem).
Freeing init memory: 140K
init started: BusyBox v1.7.2 (2008-01-30 14:38:42 CST)
starting pid 18, tty '': '/etc/init.d/rcS'
Cannot run '/etc/init.d/rcS': No such file or directory

Please press Enter to activate this console. 
starting pid 19, tty '': '/bin/sh'


BusyBox v1.7.2 (2008-01-30 14:38:42 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

# ls
bin         dev         lib         linuxrc     lost+found  sbin

复制/etc/文件,直接使用busybox source中带的sample, 
cp examples/bootfloppy/etc/* _install/ -ar
再创建一个/proc目录, 现在是这个样子 
Freeing init memory: 140K
init started: BusyBox v1.7.2 (2008-01-30 14:38:42 CST)
starting pid 18, tty '': '/etc/init.d/rcS'
starting pid 20, tty '': '/bin/sh'


BusyBox v1.7.2 (2008-01-30 14:38:42 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.


Processing /etc/profile... Done

# ls
bin         etc         linuxrc     proc
dev         lib         lost+found  sbin
           到这里为止,一个基本的文件系统就可以了。接下来就是往里加入自己需要的东西就可以了。

相关帖子

沙发
qtopia| | 2009-7-4 12:50 | 只看该作者

弄过了

使用特权

评论回复
板凳
chun1chun| | 2009-7-18 13:38 | 只看该作者

顧名思義:忙碌的盒子

使用特权

评论回复
地板
armqt|  楼主 | 2009-7-24 17:33 | 只看该作者

学习哦了

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

31

主题

150

帖子

0

粉丝