您的位置:首页 > 其它

bitbake 建立helloword

2015-05-28 13:33 225 查看
1、建立hello 工程

我的目录在 /home/chunyun/yocto/下。

mkdir hello

cd hello/

下载bitbake,参考 http://www.yoctoproject.org/docs/1.8/bitbake-user-manual/bitbake-user-manual.html#obtaining-bitbake 配置bitbake。

配置环境变量:
依然切换到 hello目录,
export PATH=/home/chunyun/yocto/bitbake/bin/:$PATH
注:我的bitbake目录在yocto下。

2、设置BBPATH
BBPATH="/home/chunyun/yocto/hello/"

export BBPATH

echo BBPATH

BBPATH即工作目录。
3、创建
conf/bitbake.conf

这个配置是用来存储 变量和 相关的数据元、配置文件等。
内容:

TMPDIR = "${TOPDIR}/tmp"

CACHE = "${TMPDIR}/cache"

STAMP = "${TMPDIR}/stamps"

T = "${TMPDIR}/work"

B = "${TMPDIR}"

4、创建
classes/base.bbclass


类文件提供共同的代码和方法。
类文件内容:
addtask build

5、创建相关层级内容

在工作目录创建
mkdir mylayer
mkdir conf

建立层级配置文件 conf/layer.conf,用来供调用。
layer.conf内容为

BBPATH .= ":${LAYERDIR}"

BBFILES += "${LAYERDIR}/*.bb"

BBFILE_COLLECTIONS += "mylayer"

BBFILE_PATTERN_mylayer := "^${LAYERDIR}/"

创建一个print方法在mylayer目录层
命名为 bblayers.conf, 内容:
DESCRIPTION = "Prints Hello World"

PN = 'printhello'

PV = '1'

python do_build() {

bb.plain("..................");

bb.plain(". .");

bb.plain(". Hello, World! .");

bb.plain(". .");

bb.plain("..................");

}
6、创建
conf/bblayers.conf

这个目录在hello目录下,使用的是本地调用路径。
BBLAYERS ?= " \

/home/chunyun/yocto/mylayer \

"

7、运行 helleworld。
bitbake printhello

可以看到如下:
Parsing recipes: 100% |###############################################################################################| Time: 00:00:00

Parsing of 1 .bb files complete (0 cached, 1 parsed). 1 targets, 0 skipped, 0 masked, 0 errors.

NOTE: Resolving any missing task queue dependencies

NOTE: Preparing RunQueue

NOTE: Executing RunQueue Tasks

NOTE: Tasks Summary: Attempted 1 tasks of which 1 didn't need to be rerun and all succeeded.

运行成功。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: