免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1478 | 回复: 0
打印 上一主题 下一主题

从无到有用busybox做最小文件系统 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-01-31 13:26 |只看该作者 |倒序浏览
    这里以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 mLibrary crypt is neededLibrary m is neededFinal link with: crypt m
    这里意思是需要libcrypt和libm的库。还有一类是最基本的libc库和ld库。
  • 做ramdisk,可以参考我前面的文章。
  • 到这里,一个最简单的fs已经工作了,已经可以看到这样一个东西了
    RAMDISK: Compressed image found at block 0Time: OSTS clocksource has been installed.VFS: Mounted root (ext2 filesystem).Freeing init memory: 140Kinit 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 directoryPlease 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.# lsbin         dev         lib         linuxrc     lost+found  sbin
  • 复制/etc/文件,直接使用busybox source中带的sample,  
    cp examples/bootfloppy/etc/* _install/ -ar
    再创建一个/proc目录, 现在是这个样子
    Freeing init memory: 140Kinit 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# lsbin         etc         linuxrc     procdev         lib         lost+found  sbin
                   
                   
                                 到这里为止,一个基本的文件系统就可以了。接下来就是往里加入自己需要的东西就可以了。


    本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/31934/showart_474189.html
  • 您需要登录后才可以回帖 登录 | 注册

    本版积分规则 发表回复

      

    北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
    未成年举报专区
    中国互联网协会会员  联系我们:huangweiwei@itpub.net
    感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

    清除 Cookies - ChinaUnix - Archiver - WAP - TOP