Setup Cross-development using OpenEmbedded

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这样的模拟程序了,或者用开发板。
Comments