Chinaunix首页 | 论坛 | 博客
  • 博客访问: 62744
  • 博文数量: 10
  • 博客积分: 728
  • 博客等级: 下士
  • 技术积分: 235
  • 用 户 组: 普通用户
  • 注册时间: 2012-04-13 13:17
文章存档

2012年(10)

分类: 嵌入式

2012-06-22 08:54:04

折腾了两晚后,终于在 linux-2.6.22.6 上把根文件系统建立起来了,现记录于此。
一、参考资料
二、实验环境
board     :FL2440
bootloader:u-boot-1.1.6
kernel    :linux-2.6.22.6
rootfs    :busybox-1.9.1 + tinylogin
交叉编译工具:
(1)网上下载的 3.3.2 版本的 arm-linux-gcc
(2)网上下载的 3.4.1 版本的 arm-linux-gcc
(3)arm-linux-gcc version 4.3.2 (自己制作的crosstool-NG-1.9.3-hyh)
三、发现问题
1.我的 kernel 的编译工具是自己用 crosstool-NG-1.9.3 制作的 4.3.2 版本的编译工具编译的。按照 tekkaman 的步骤移植后我用同样的编译工具(4.3.2)制作了根文件系统,但是在 nfs 挂载了后输出下面的信息后就停止了

  1. ......
  2. Looking up port of RPC 100003/2 on 192.168.1.6
  3. eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1
  4. Looking up port of RPC 100005/1 on 192.168.1.6
  5. VFS: Mounted root (nfs filesystem).
  6. Freeing init memory: 112K
2.在不改变内核的前提下,我用了 nfs 挂载了 tekkaman 的根文件系统,运行良好。这说明问题出在我制作的根文件系统上。
3.把我制作的 rootfs 和 tekkaman 的进行了认真的比对,发现基本是一致的。另外,调试输出的“VFS: Mounted root (nfs filesystem).”说明内核是已经挂载上根文件系统了。这说明我的制作方法和主机的 nfs 都是没问题的。
4.那问题出在哪里呢?答案是交叉编译工具链(4.3.2)与目标机的 kernel(linux-2.6.22.6)不兼容。
四、解决问题
我分别用 3.3.2、3.4.1、4.3.2的交叉编译工具进行了试验,发现发现只有 3.4.1 制作出来的根文件系统能够正常的运行在 2.6.22.6 的 kernel 上。
1.使用 4.3.2 的交叉编译工具
试验时,目标机在输出 "Freeint init memory:112k" 后就停止运行了。后来我参考了下http://blog.csdn.net/qq345160153/article/details/7090439,修改内核配置后,目标机输出"FATAL: kernel too old,Kernel panic – not syncing: Attempted to kill init!"即停止。我用 file rootfs/lib/libc-2.9.so 发现这个运行库支持的是 linux-2.6.32 的内核,遂决定采用低版本交叉编译工具试试。
2.使用 3.3.2 的交叉编译工具
用 3.3.2 制作的根文件系统还是不行,目标机在停止之前提示找不到共享库文件。于是我参考的方法:

  1. From: Mike Frysinger
  2. To: busybox@xxxxxxxxxxx
  3. Cc: Bob Zhang
  4. Date: 2007年6月23日 上午2:32
  5. Attachments: signature.asc
  6. On Friday 22 June 2007, Bob Zhang wrote:
  7. I have used busybox 1.6.0 and 1.5.1
  8. I used the kernel 2.6.18 from Montavista ,used arm_v5t_le-gcc to
  9. compile kernel and busybox , but my busybox can't enter shell
  10. this is rarely a busybox problem
  11. see if booting with init=/bin/sh works
  12. if it doesnt, create a static application that just displays "hello" and boot
  13. that with init=
  14. if the static works but the dynamic fails, it's a toolchain problem ... go
  15. talk to the people who made it
  16. -mike
我写了个 hello.c 分别以动态链接和静态链接用 3.3.2 的编译工具编译,结果静态链接的 hello 能打印"hello",但是动态链接的 hello 却不能打印"hello"。根据上面的信息,遂判断还是 toolchain 的问题。
3.使用 3.4.1 的交叉编译工具
这次终于成功了。
阅读(2183) | 评论(0) | 转发(0) |
0

上一篇:挂载根文件系统后停在 Freeing init memory: 112K

下一篇:没有了

给主人留下些什么吧!~~