使用OpenEmbedded构建交叉编译环境 [转]

使用OpenEmbedded构建交叉编译环境      CSDN Blog推出文章指数概念,文章指数是对Blog文章综合评分后推算出的,综合评分项分别是该文章的点击量,回复次数,被网摘收录数量,文章长度和文章类型;满分100,每月更新一次.
http://blog.csdn.net/leo_cao/archive/2007/08/06/1728122.aspx

1,选择 /opt做为存放openembedded的文件系统。
2,设置环境变量:
export OEDIR=/opt/openembedded
export PATH=$OEDIR/bitbake/bin:$PATH
export BBPATH=$OEDIR/build:$OEDIR/org.openembedded.dev

3,建立 “/opt/openembedded”目录,这是根
4,构建环境,先安装软件包,debian系统testing branch:
http://www.openembedded.org/wiki/RequiredSoftware
http://www.openembedded.org/wiki/OEandYourDistro

5,接下,获取bitbake
svn co svn://svn.berlios.de/bitbake/branches/bitbake-1.8/ bitbake

然后,安装monotone 0.32版本,获取OE的数据库:
wget http://www.openembedded.org/snapshots/OE.mtn.bz2
bunzip2 <OE.mtn.bz2 >OE.mtn

然后更新
mtn --db=OE.mtn db migrate
mtn --db=OE.mtn pull monotone.openembedded.org org.openembedded.dev

然后获取 openembedded的源代码
mtn --db=OE.mtn checkout --branch=org.openembedded.dev

6,创建配置文件
cp org.openembedded.dev/conf/local.conf.sample build/conf/local.conf
修改后的格式:
DL_DIR = "${OEDIR}/sources"

BBFILES := "${OEDIR}/org.openembedded.dev/packages/*/*.bb"
#BBMASK = ""

# Select between multiple alternative providers, if more than one is eligible.
PREFERRED_PROVIDERS = "virtual/qte:qte virtual/libqpe:libqpe-opie"
PREFERRED_PROVIDERS += " virtual/libsdl:libsdl-x11"
PREFERRED_PROVIDERS += " virtual/${TARGET_PREFIX}gcc-initial:gcc-cross-initial"
PREFERRED_PROVIDERS += " virtual/${TARGET_PREFIX}gcc:gcc-cross"
PREFERRED_PROVIDERS += " virtual/${TARGET_PREFIX}g++:gcc-cross"

MACHINE = "qemuarm"
TARGET_ARCH = "arm"
TARGET_OS = "linux"

DISTRO = "generic"
MACHINE_KERNEL_VERSION = "2.6"

IMAGE_FSTYPES = "jffs2 tar"

BBDEBUG = "yes"

# PARALLEL_MAKE = "-j 4"

BBINCLUDELOGS = "yes"

7,获得交叉编译工具链
bitbake gcc

8,使用交叉编译工具
交叉编译工具在tmp/cross/bin/下,可以用它们编译一个 hello, world。

9,运行编译好的目标程序
这就需要用qemu这样的模拟程序了,或者用开发板。

你可能感兴趣的:(#openembedded)