Chinaunix首页 | 论坛 | 博客
  • 博客访问: 376997
  • 博文数量: 38
  • 博客积分: 3071
  • 博客等级: 中校
  • 技术积分: 423
  • 用 户 组: 普通用户
  • 注册时间: 2007-02-15 11:11
文章分类

全部博文(38)

文章存档

2017年(1)

2011年(1)

2010年(5)

2009年(6)

2008年(3)

2007年(22)

我的朋友

分类: LINUX

2008-01-31 13:26:23

    这里以ixp435平台为例子。
  1. Get source code: busybox-1.7.2-1 (当然其他的版本的都可以)
  2. Tool chain:armv5-linux-* (和编linux kernel的相同)
  3. make menuconfig ,配置功能,可以从其他地方拿一个过来改改。注意打开"Busybox Settings"->"Installation Options"->" Don't use /usr" 这样在安装的时候会安装到自己指定的目录(default ./_install),或者可以在make时加参数CONFIG_PREFIX=目录
  4. make ARCH=arm CROSS_COMPILE=armv5b-linux- install
  5. 复制必要的库文件: 如果没有,会出现这样的错误
    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库。
  6. 做ramdisk,可以参考我前面的文章。
  7. 到这里,一个最简单的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
  8. 复制/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
           到这里为止,一个基本的文件系统就可以了。接下来就是往里加入自己需要的东西就可以了。
阅读(11586) | 评论(9) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2008-12-01 14:12:09

在下按你的办法做了一个文件系统,用mkcramfs做了img.但是运行后显示Failed to execute linuxrc,请问是什么原因呢?还有vi linuxrc显示乱码。

chinaunix网友2008-12-01 14:12:05

在下按你的办法做了一个文件系统,用mkcramfs做了img.但是运行后显示Failed to execute linuxrc,请问是什么原因呢?还有vi linuxrc显示乱码。

chinaunix网友2008-12-01 14:12:04

在下按你的办法做了一个文件系统,用mkcramfs做了img.但是运行后显示Failed to execute linuxrc,请问是什么原因呢?还有vi linuxrc显示乱码。

chinaunix网友2008-05-24 11:26:48

Trying libraries: crypt mLibrary crypt is neededLibrary m is needed Final link with: crypt m 我编译busybox时提示上面的信息。 请问博主:那我要做的是不是如下的: 在宿主机库文件中的libcrypt和libm的库文件复制到我建立的文件系统里面?? 谢谢! (我在交叉编译器的文件中没有发现上述的库文件)