搜索
bottom↓
回复: 38

坛子里做linux-arm嵌入式应用的多不?兄弟们用的都有哪些平台?我用的是gentoo平台cross

[复制链接]

出0入0汤圆

发表于 2009-7-30 10:35:10 | 显示全部楼层 |阅读模式
RT
做这类开发,得先有个交叉编译环境,这个有多种选择。
先说下我目前用的

——————————————————————————————————————————————————————————————————
1、建立交叉编译环境,请在任何内建 emerge 软件管理功能的 Linux 发行版(最典型的是 Gentoo Linux,不过甚至 Cygwin 也能做到)中,执行如下操作
# emerge crossdev
# crossdev -S --binutils 2.18.50.0.8 --gcc 4.3.1-r1 -s4 --ex-gdb --target arm-unknown-linux-gnu
然后就会一切自动搞定,不需要做任何多余的事情

2、建立 arm 的本机编译环境,请参照 LFS,非常容易
——————————————————————————————————————————————————————————————————
以上是watercat大虾的经验分享,我也是按照他说得这种方式来的,不过我的跟他的有点小区别,我没有指定binutils和gcc的版本,直接使用最新的stable版:
# emerge crossdev
# crossdev -S -s4 --ex-gdb --target arm-unknown-linux-gnu
这种方式非常简单,只需要在系统编译结束后,将安装的几个组件添加到/var/lib/portage/world中去即可(是为了防止emerge --depclean时将安装的crosstool卸载)
完成后运行:# arm-unknown-linux-gnu-gcc -v
Using built-in specs.
Target: arm-unknown-linux-gnu
Configured with: /var/tmp/cross/arm-unknown-linux-gnu/portage/cross-arm-unknown-linux-gnu/gcc-4.4.1/work/gcc-4.4.1/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/arm-unknown-linux-gnu/gcc-bin/4.4.1 --includedir=/usr/lib/gcc/arm-unknown-linux-gnu/4.4.1/include --datadir=/usr/share/gcc-data/arm-unknown-linux-gnu/4.4.1 --mandir=/usr/share/gcc-data/arm-unknown-linux-gnu/4.4.1/man --infodir=/usr/share/gcc-data/arm-unknown-linux-gnu/4.4.1/info --with-gxx-include-dir=/usr/lib/gcc/arm-unknown-linux-gnu/4.4.1/include/g++-v4 --host=i686-pc-linux-gnu --target=arm-unknown-linux-gnu --build=i686-pc-linux-gnu --disable-altivec --disable-fixed-point --without-ppl --without-cloog --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --disable-multilib --disable-libmudflap --disable-libssp --disable-libgomp --enable-cld --disable-libgcj --enable-languages=c,c++,fortran --with-sysroot=/usr/arm-unknown-linux-gnu --disable-bootstrap --disable-libgomp --enable-__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.4.1 p1.0'
Thread model: posix
gcc version 4.4.1 (Gentoo 4.4.1 p1.0)


这里有一点疑惑,就是watercat说到的第二点,建立arm本机编译环境有多大的必要?个人认为没有必要建立arm的本机编译环境,本机上只要跑跑应用程序就可以了。arm平台的性能弱于PC,使用ARM本机编译系统来编译,需比交叉编译链耗费更长的时间。不知这种想法可正确,若无道理,还请大虾指正。

不过目前用这个方案的貌似不是很多

阿莫论坛20周年了!感谢大家的支持与爱护!!

你熬了10碗粥,别人一桶水倒进去,淘走90碗,剩下10碗给你,你看似没亏,其实你那10碗已经没有之前的裹腹了,人家的一桶水换90碗,继续卖。说白了,通货膨胀就是,你的钱是挣来的,他的钱是印来的,掺和在一起,你的钱就贬值了。

出0入0汤圆

发表于 2009-7-30 10:41:26 | 显示全部楼层
一直在用ELDK。

出0入0汤圆

 楼主| 发表于 2009-7-30 11:07:39 | 显示全部楼层
再说说我知道的其他方案,对于这些方案,也仅处在了解的阶段,说得不对的地方还请兄弟们指正。
———————————————————————————————————————————————————————
1.参照CLFS等手册一步步整合,比较麻烦,而且编译出来的工具链没有经过测试,但是好处是能得到最新的编译工具链
homepage:  http://trac.cross-lfs.org/

由于编译过程复杂,又可能碰到一些莫名其妙的错误,所以最好还是用别人已经弄好的,我的朋友中很多都是用的这种方法,直接下载别人已经弄好的,虽然版本比较低
最常用的编译版本是arm-linux-gcc-3.4.1 和 arm-linux-3.3.2 的,3.4.1的用于编译2.6的内核,而3.3.2的常用于编译busybox,和bootloader(u-boot),编译的版本配合不好的话就会出错,所以要选择好编译版本,如果这个版本不行的话,可以试试其他的版本,在uclinux上用的多的就是arm-elf-tools-20030314

http://www.handhelds.org/download/projects/toolchain/arm-linux-gcc-3.4.1.tar.bz2
http://www.handhelds.org/download/projects/toolchain/arm-linux-gcc-3.3.2.tar.bz2

———————————————————————————————————————————————————————
2.使用crosstool来构建交叉编译链
homepage:  http://www.kegel.com/crosstool/

这个crosstool比较好用,只要稍微改动下就能自动编译,目前最新版本为0.43,最高支持gcc-4.2-glibc-2.3.6


———————————————————————————————————————————————————————
3.使用OpenEmbedded
homepage:  http://wiki.openembedded.net/index.php/Main_Page

Openmoko, 一个开源的手机项目,就是用OpenEmbedded构建的

出0入0汤圆

 楼主| 发表于 2009-7-30 12:07:57 | 显示全部楼层
补充下2楼提到的:ELDK(Embedded Linux Development Kit )

eldk(embedded linux development kit)是德国denx软件工程公司推出的嵌入式linux开发套件,而denx公司的ceo就是大名鼎鼎的u-boot的维护人wolfgang denk。
从eldk 4.0开始,这个开发套件开始提供针对arm和mips的交叉编译环境(eldk最初只支持ppc)。此外,eldk 4.0还提供了u-boot-1.1.4和linux 2.6.15的源代码,和其他一些已预先交叉编译好的软件包。
eldk 4.1中包含了u-boot-1.2和linux 2.6.19.2,还提供了在windows平台上运行的方法(借助于colinux)。
最新的eldk 4.2目前只提供了ppc版本的
homepage:  www.denx.de/wiki/DULG/ELDK

出0入0汤圆

 楼主| 发表于 2009-7-30 12:54:46 | 显示全部楼层
我理解中的arm开发为以下过程:
通过JTAG下载bootloader,然后通过串口/网络来下载基于arm的linux系统到flash中。

因此,构建好交叉工具链后,还需要有个 arm上的linux系统

这个可以通过CLFS来构建(使用已经构建好的交叉工具链),这里有个问题,在楼主位也提到:是否需要构建arm 本机编译环境?

另外,是否还有其他的方法呢?

出0入0汤圆

发表于 2009-7-30 13:20:39 | 显示全部楼层
楼主开始干了,还是准备做,有了编译器有了源码就可干活喽,你用的这些我没用过,ELDK准备用

出0入0汤圆

发表于 2009-7-30 13:29:33 | 显示全部楼层
ELDK,已经带ARM本机编译系统了,包括GCC,等。挂个NFS上去,就可以用啊。

出0入0汤圆

发表于 2009-7-30 13:45:29 | 显示全部楼层
想问楼上的ELDK解开后有多大,我的虚拟机已经8G多了受不了,还有便宜UCLINUX会有问题吗

出0入0汤圆

 楼主| 发表于 2009-7-30 13:47:11 | 显示全部楼层
【5楼】 flight871
我也没有用过 只是从网上搜集的 现在用的是gentoo中的crossdev
正在尝试用portage来构建arm linux系统

【6楼】 laowang
ARM本机编译系统 有什么好处呢?为什么不使用交叉编译工具链?
由于arm平台的性能弱于PC,因此,使用 ARM本机编译系统 编译ARM平台上的软件比用交叉编译链耗费更长的时间,这个怎么解决?

出0入0汤圆

发表于 2009-7-30 13:53:34 | 显示全部楼层
那你试试ELDK好了,以前看过文档,ELDK应该包括了编译器和linux源码以及uboot,你拿来就可以用了

出0入0汤圆

 楼主| 发表于 2009-7-30 18:28:51 | 显示全部楼层
我还没有用ELDK的打算
现在用的是Gentoo,用ELDK估计得折腾

还是先用着crossdev来弄,毕竟是watercat推荐的东东,呵呵

出0入0汤圆

 楼主| 发表于 2009-7-30 21:13:30 | 显示全部楼层
正在搭建系统,然后为arm编译内核

已经安装了busybox、ncurses、make和kernel源码
正准备下一步

现在有点不明白该怎么确保在编译内核时使用的是刚编译好的make,而不是build system上的make
另外,编译好内核后,该怎么继续搭建系统呢?是否参照LFS手册安装一些列的软件包,然后将搭建好的系统移植到arm平台上去?

出0入0汤圆

 楼主| 发表于 2009-7-31 00:13:59 | 显示全部楼层
发现自己走弯路了
gentoo有直接提供arm版本的stage3,这样如果arm平台性能够强劲,可以直接使用stage来构建arm-linux系统

如果由于arm平台性能的问题,可以通过crossdev构建的crosstool来编译内核、bootloader、文件系统,然后把这些烧写到flash中去,再弄好必要的驱动,最后进行应用程序的开发

不知这样的理解可对?

出0入20汤圆

发表于 2009-7-31 07:38:19 | 显示全部楼层
我给你个建议,使用ELDK.我们所有的ARM9平台都在ELDK下做的.里面连ROOTFS都有了.

出0入0汤圆

发表于 2009-7-31 07:40:29 | 显示全部楼层
我用 ubuntu + buildroot + NGW100 做avr32-linux开发,
有没有同道的兄弟?

出0入0汤圆

发表于 2009-7-31 08:17:41 | 显示全部楼层
debian + buildroot + NGW100

出0入0汤圆

发表于 2009-7-31 09:08:53 | 显示全部楼层
centos+buildroot的飘过

出0入0汤圆

 楼主| 发表于 2009-7-31 11:42:17 | 显示全部楼层
多谢楼上各位~~

出0入0汤圆

 楼主| 发表于 2009-7-31 13:46:59 | 显示全部楼层
ELDK4.2支持的系统:
The ELDK can be installed onto and operate with the following operating systems:
Fedora Core 4, 5, 6 Fedora 7, 8, 9
Red Hat Linux 7.3, 8.0, 9
SuSE Linux 8.x, 9.0, 9.1, 9.2, 9.3
OpenSUSE 10.2, 10.3 (32 Bit); OpenSUSE 11.0 (32 and 64 Bit)
Debian 3.0 (Woody), 3.1 (Sarge) and 4.0 (Etch)
Ubuntu 4.10, 5.04, 6.10
FreeBSD 5.0

Users also reported successful installation and use of the ELDK on the following host systems:
Suse Linux 7.2, 7.3
Mandrake 8.2
Slackware 8.1beta2
Gentoo Linux 2006.1

我用的是gentoo linux 2008.0,安装也成功,目前还没有测试是否可用
——————————————————————————————————————————————————————————
ELDK4.2支持的ARM平台分类:
是以是否有浮点协处理器来区分的两个版本,都支持ARM EABI,不过不知是哪个版本,也不知采用的是大端还是小端,用的C run lib不是是glibc还是uclibc

1.3. Supported Target Architectures
The ELDK for ARM systems supports processors complying with the ARM architecture version 2 to 6. This includes ARM7, ARM9, XScale, AT91RM9200, i.MX31, S3C6400 and other ARM based systems.

The version of 4.2 and higher of ELDK has two ARM targets in distribution - one with the soft-float math support, and another one with the Vector Floating Point math support. Both targets comply with ARM Embedded Application Binary Interface (EABI).

The ELDK ARM target architectures are:

arm-linux = soft-float math
armVFP-linux = Vector Floating Point (VFP) math

出0入0汤圆

 楼主| 发表于 2009-7-31 18:19:31 | 显示全部楼层
google到一网站,介绍的挺好,主要介绍条目如下所示
1 Prebuilt toolchains
    CodeSourcery
    DENX ELDK
    Scratchbox
    Fedora ARM
    Embedded Debian cross-tools packages

2 Toolchain building systems
    Buildroot
    Crossdev (Gentoo)
    Crosstool
    Crosstool-NG
    Crossdev/tsrpm (Timesys)
    OSELAS.Toolchain()
    Bitbake

出0入0汤圆

 楼主| 发表于 2009-7-31 20:04:48 | 显示全部楼层
忘了网址
http://elinux.org/Toolchains

在编译u-boot,为支持的board:smdk2410
1.用crossdev编译出来的工具链
#make smdk2410_config
#make CROSS_COMPILE=arm-unknown-linux-gnu-

报错:
board.c:126: error: inline function 'coloured_LED_init' cannot be declared weak
board.c:128: error: inline function 'red_LED_on' cannot be declared weak
board.c:130: error: inline function 'red_LED_off' cannot be declared weak
board.c:132: error: inline function 'green_LED_on' cannot be declared weak
board.c:134: error: inline function 'green_LED_off' cannot be declared weak
board.c:136: error: inline function 'yellow_LED_on' cannot be declared weak
board.c:138: error: inline function 'yellow_LED_off' cannot be declared weak
google后知道是因为GCC版本过高的缘故,但是没有找到解决的办法
http://www.linuxsir.org/bbs/showthread.php?t=351525



2.用ELDK带的工具链
#make smdk2410_config
#make CROSS_COMPILE=arm-linux-

报错:
-Map u-boot.map -o u-boot
arm-linux-ld: ERROR: lib_arm/libarm.a(board.o) uses VFP instructions, whereas u-boot does not
arm-linux-ld: failed to merge target specific data of file lib_arm/libarm.a(board.o)
arm-linux-ld: ERROR: lib_arm/libarm.a(interrupts.o) uses VFP instructions, whereas u-boot does not
arm-linux-ld: failed to merge target specific data of file lib_arm/libarm.a(interrupts.o)
arm-linux-ld: ERROR: net/libnet.a(net.o) uses VFP instructions, whereas u-boot does not

从显示的信息来看,是由于我用的cross compiler是soft float版本,不支持VFP,而U-BOOT自带的lib_arm/libarm.a等文件又是使用支持VFP的compiler生成的
看来得重新安装ELDK了,这回得选armVFP-linux了

出0入0汤圆

发表于 2009-7-31 20:16:21 | 显示全部楼层
ELDK开发前期爽,马上就能用。后期麻烦。
buildroot前期要配置,下载软件包,编译,麻烦点;弄完以后就比较方便了,rootfs是自动生成的。

我现在早期做原型用eldk+nfs搞定。如果是小型的文件系统,buildroot生成的rootfs作为生产用。如果要交叉编译大型的软件如php,mysql,apache等,我就用openembedded作为生产环境。

出0入0汤圆

 楼主| 发表于 2009-7-31 20:39:48 | 显示全部楼层
突然想起Gentoo系统的GCC才4.3.2-r2,而这里就已经是4.4.1了
意识到在用crossdev编译cross tool时make.conf里KEYWORDS="~ARM ARM"造成了这个错误

http://patchwork.kernel.org/patch/107/
这个网页提到“work around GCC bug with __weak aliases”
解决的办法是打patch,将compiler-gcc.h文件中的
#define __weak        __attribute__((weak))
删除
/*
+ * Mark weak aliases also noinline, because some GCC versions
+ * incorrectly inline weak aliases (even when a non-weak variant
+ * is there) and thus cause crashes:
+ */
+#define __weak                                __attribute__((weak)) noinline
+
+/*

出0入0汤圆

 楼主| 发表于 2009-7-31 20:46:17 | 显示全部楼层
【21楼】 zlei
多谢~~

ELDK很方便,刚开始用,还没有体会到后期的繁杂,呵呵
不过它是在Crosstool-0.43的基础上构建的,而Crosstool已没有人在维护了,这个是个问题

buildroot没有用过,看起来不错的样子

现在想继续尝试下crossdev,用稳定分支重新构建crosschain,希望结果能好点
等这个过程结束,如果时间允许,尝试下buildroot,只可惜buildroot只使用uClibc C library

crossdev时,-P参数貌似没有什么用,我使用-P -av,并没有什么效果

出0入0汤圆

 楼主| 发表于 2009-7-31 23:16:40 | 显示全部楼层
编译工具链太耗时间了~~
今天没有编译完 没有时间等 只好Ctrl+C了

出0入0汤圆

 楼主| 发表于 2009-8-1 10:31:16 | 显示全部楼层
奇怪,我重新运行
# crossdev -S -s4 --ex-gdb --target arm-unknown-linux-gnu
后 #arm-unknown-linux-gnu-gcc -v的输出还是4.4.1
看来crossdev并没有将先前的版本卸载掉,这样就比较麻烦了

清除系统,竟提示删除GCC 4.3.2,而不是4.4.1

(原文件名:QQ截图未命名4.png)

手动删除GCC4.4.1后,编译工具链还是用不了
看来还得重新构建工具链了

出0入0汤圆

 楼主| 发表于 2009-8-1 12:43:50 | 显示全部楼层
终于用crossdev构建的cross conpiler成功编译了U-BOOT-2009.06
# arm-unknown-linux-gnu-gcc -v
Using built-in specs.
Target: arm-unknown-linux-gnu
Configured with: /var/tmp/cross/arm-unknown-linux-gnu/portage/cross-arm-unknown-linux-gnu/gcc-4.3.2-r4/work/gcc-4.3.2/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/arm-unknown-linux-gnu/gcc-bin/4.3.2 --includedir=/usr/lib/gcc/arm-unknown-linux-gnu/4.3.2/include --datadir=/usr/share/gcc-data/arm-unknown-linux-gnu/4.3.2 --mandir=/usr/share/gcc-data/arm-unknown-linux-gnu/4.3.2/man --infodir=/usr/share/gcc-data/arm-unknown-linux-gnu/4.3.2/info --with-gxx-include-dir=/usr/lib/gcc/arm-unknown-linux-gnu/4.3.2/include/g++-v4 --host=i686-pc-linux-gnu --target=arm-unknown-linux-gnu --build=i686-pc-linux-gnu --disable-altivec --disable-fixed-point --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --disable-multilib --disable-libmudflap --disable-libssp --disable-libgomp --enable-cld --disable-libgcj --enable-languages=c,c++,fortran --with-sysroot=/usr/arm-unknown-linux-gnu --disable-bootstrap --disable-libgomp --enable-__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.3.2-r4 p1.7, pie-10.1.5'
Thread model: posix
gcc version 4.3.2 (Gentoo 4.3.2-r4 p1.7, pie-10.1.5)

(原文件名:QQ截图未命名5.png)

出0入0汤圆

 楼主| 发表于 2009-8-1 20:30:19 | 显示全部楼层
1 Prebuilt toolchains  
    CodeSourcery  
    DENX ELDK  
    Scratchbox  
    Fedora ARM  
    Embedded Debian cross-tools packages  

2 Toolchain building systems  
    Buildroot  
    Crossdev (Gentoo)  
    Crosstool  
    Crosstool-NG  
    Crossdev/tsrpm (Timesys)  
    OSELAS.Toolchain()  
    Bitbake
————————————————————————————————————————————————
结合楼上各位兄弟的回帖,这里我比较倾向于:
CodeSourcery这种预编译好的crosstool包
以及以下三种自己编译crosstool方式--Buildroot、Crossdev (Gentoo) 、Bitbake
其中Bitbake是OpenEmbedded的包管理工具

出0入0汤圆

 楼主| 发表于 2009-8-2 15:50:20 | 显示全部楼层
刚学了一招,升级crossdev构建出来的cross toolchain
#emerge --sync
#crossdev -S -s4 --ex-gdb --target arm-unknown-linux-gnu

其中后一条指令必须跟构建cross toolchain时的一致
因为我在构建时用#crossdev -S -s4 --ex-gdb --target arm-unknown-linux-gnu,所以升级时敲的还是这条命令

出0入0汤圆

 楼主| 发表于 2009-8-3 13:33:50 | 显示全部楼层
昨天试了下openembedded,太占空间了
不过openembedded看起来很不错~~
看他manual中:
History
OpenEmbedded was invented and founded by the creators of the OpenZaurus project. At this time the project had pushed buildroot to its limits. It supported the creation of ipk packages, feeds and images and had support for more than one machine. But it was impossible to use different patches, files for different architectures, machines or distributions. To overcome this shortcoming OpenEmbedded was created.

After a few months other projects started using OpenEmbedded and contributing back. On 7 December 2004 Chris Larson split the project into two parts: BitBake, a generic task executor and OpenEmbedded, the metadata for BitBake.

跟其他方式的对比:
buildroot
Writing of BitBake recipes is more easy and more intuitive than writing Makefiles while providing higher flexibility. This allows you to tweak specific recipes for your very special needs and to add new recipes very fast. You can build toolchains, Software Distribution Kits (SDKs), complete Distributions or just single packages. The flexibility of OpenEmbedded allows you to reuse the once written recipes for many different purposes. OpenEmbedded provides everything buildroot will be able to provide. But in contrast to buildroot OpenEmbedded will allow you to achieve what you really want to achieve. You can add new package formats, new filesystems, new output formats easily. OpenEmbedded will suit your need.

crosstool
Crosstool allows to create toolchains for you. It can only create the initial toolchain for you. It will not compile other needed libraries or applications for you, it will not be able to track dependencies or to package them properly. OpenEmbedded supports all configurations crosstool supports. You can start to create toolchains with OpenEmbedded, then as your needs grow create a more complete SDK from already present base libraries and applications and if you recognize you need to have packages for the target you have them almost built already.

出0入0汤圆

 楼主| 发表于 2009-8-4 18:42:29 | 显示全部楼层
用crossdev很多东西还要自己来做
有点麻烦了

直接用gentoo for arm又不合适
资源限制
S3C2440  主频400M
64M SDRAM
64M NAND FLASH

出0入0汤圆

发表于 2009-8-4 19:09:52 | 显示全部楼层
MARK

出0入0汤圆

发表于 2010-2-23 16:02:00 | 显示全部楼层
ELDK LINUX ARM MARK

出0入0汤圆

发表于 2010-2-23 16:05:40 | 显示全部楼层
就为mark eldk~

出0入0汤圆

发表于 2010-3-1 22:22:21 | 显示全部楼层
我见过一个人就在XScale开发板上玩过LFS(不是CLFS)。
那个慢哟……

出0入0汤圆

发表于 2010-3-2 08:44:56 | 显示全部楼层
学习了。。。

出0入0汤圆

发表于 2010-3-2 12:17:52 | 显示全部楼层
学习

出0入0汤圆

发表于 2011-10-30 11:45:21 | 显示全部楼层
这个贴子真的应该MARK
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片。注意:要连续压缩2次才能满足要求!!】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-10-3 06:23

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表