Embedded linux移植常见错误及使用总结

在移植嵌入式Linux中碰到了不少错误(u-boot,BusyBox,kernel),搜索了网上不少资源,得到了解决办法,这里整理如下:
一. u-boot
1.arm-linux-gcc: installation problem, cannot exec `cpp0': ?????????
这是由于没有把arm-linux-gcc安装在他的默认目录导致的
2.95版本          /usr/local/arm/2.95.3/bin
3.0版本以上     /usr/local/arm/bin

2.xxx is not in the sudoers file. This incident will be reported
(1) 进入超级用户模式。也就是输入"su -",系统会让你输入超级用户密码,输入密码后就进入了超级用户模式。
(2) 添加文件的写权限。也就是输入命令"chmod u+w /etc/sudoers"。
(3) 编辑/etc/sudoers文件。也就是输入命令"vim /etc/sudoers",输入"i"进入编辑模式,找到这一 行:"root ALL=(ALL) ALL"在起下面添加"xxx ALL=(ALL) ALL"(这里的xxx是你的用户名),然后保存(就是先摁一下Esc键,然后输入":wq")退出。
(4) 撤销文件的写权限。也就是输入命令"chmod u-w /etc/sudoers"。

3.软浮点编译问题
使用arm-linux-gcc-3.4.1和arm-linux-2.95.3交叉编译工具编译U-BOOT-1.1.6时会出现以下错误:
/lib_arm/_udivsi3.S:67: relocation truncated to fit: R_ARM_PLT32 __div0
/ lib_arm/_umodsi3.S:79: relocation truncated to fit: R_ARM_PLT32 __div0
解决办法是使用arm-linux-3.3.2或者用crosstool生成支持软浮点的交叉编译工具.
如果使用crosstool可以参考:
http://blog.csdn.net/shevsten/archive/2007/07/14/1691197.aspx

二. Linux Kernel
1. 使用arm-linux-gcc 4.3.2编译产生undefined reference to `__udivdi3' 的错误
在makefile中查找到:
KBUILD_CFLAGS   := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs /
     -fno-strict-aliasing -fno-common /
     -Werror-implicit-function-declaration 改为:

改为                 
KBUILD_CFLAGS   := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs /
     -fno-strict-aliasing -fno-common /
     -fno-tree-scev-cprop /
     -Werror-implicit-function-declaration

2. tftp命令格式

tftp -l filename -r filename 192.168.0.15 -g


三.BusyBox
1.BusyBox-1.1.3出现错误:
Bummer, could not run '/bin/sh': No such file or directory
将etc/inittab文件,rcS文件中的sh替换成ash,如:
console::askfirst:-/bin/sh 改成
console::askfirst:-/bin/ash
因为在bin目录中没有sh,只有ash
在高版本BusyBox,如1.10.1中,编译后就有sh了,就使用:-/bin/sh
2.运行命令出现乱码,如ls
# ls
[1;34mbin[0m [1;34metc[0m [1;34mlib[0m [1;34mproc[0m [1;36msbin[0m [1;34musr[0m
[1;34mdev[0m [1;34mhome[0m [1;34mmnt[0m [1;34mramdisk[0m [1;36mtmp[0m [1;34mvar[0m
这是由于终端不支持颜色所致.
如果使用HyperTerminal,可以在终端-文件-属性-设置里的终端仿真改为"自动检测".

四.虚拟机使用(VirtualBox & VMware)
1. VirtualBox虚拟ubuntu自动mount windows下的共享目录
(1) 首先安装addon: sudo sh VboxLinuxAdditions.run
(2) Windows 下虚拟 Ubuntu11.04, 在 VirtualBox 下设置 Windows 共享目录文件夹 VMSharedFolder
(3) 共享目录设置那边的 Auto-mount, 如果勾选了这个 , 它会自动在 /media/ 的目录下生成以 rs_ 开头的共享文件 , rs_VMSharedFolder... 不勾选 Auto-mount
(4) 在 mnt 下新建 share 目录 , 在终端中输入 sudo mount -t vboxsf tempfolder /mnt/share/, 就可以看到 VMSharedFolder 被 mount 到 share 下了
(5) 让 unbuntu 启动时自动挂载 VMSharedFolder 到 share, 编辑 /etc/fstab 文件
sudo gedit /etc/fstab
添加一句
VMSharedFolder /mnt/share vboxsf rw,gid=100,uid=1000,auto 0 0

重启 ,OK…

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值