您的位置:首页 > 运维架构 > Linux

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

2010-05-11 15:38 567 查看
在移植嵌入式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

bin etc lib proc sbin usr

dev home mnt ramdisk tmp var

这是由于终端不支持颜色所致.

如果使用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…
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: