bitbake hello world demo 实验

1.安装bitbake,并设定path
使用git下載 bitbake並安裝
$git clone git://git.openembedded.org/bitbake
設定PATH
$export PATH=/home/<your directory>/bitbake/bin:$PATH

 

2. 执行bitbake:

 bitbake
ERROR: Unable to find conf/bblayers.conf or conf/bitbake.conf. BBPATH is unset and/or not in a build directory?

3. 创建hello 目录,并设置BBPATH变量:

export BBPATH="/home/<your directory>/hello"

再次执行bitbake,保存如下:

ERROR: Unable to find conf/bblayers.conf or conf/bitbake.conf. BBPATH is unset and/or not in a build directory?

4.创建conf/bitbake.conf,run bitbake

$ mkdir conf
再在conf下建立bitbake.conf,并输入下面内容

TMPDIR  = "${TOPDIR}/tmp"
CACHE   = "${TMPDIR}/cache"
STAMP   = "${TMPDIR}/stamps"
T       = "${TMPDIR}/work"
B       = "${TMPDIR}"

执行bitbake:

ERROR: Unable to start bitbake server (None)
ERROR: Server log for this session (/home/<your directory>/hello/bitbake-cookerdaemon.log):
--- Starting bitbake server pid 127776 at 2020-04-16 16:09:25.846593 ---
ERROR: ParseError in configuration INHERITs: Could not inherit file classes/base.bbclass

5. 创建classes/base.bbclass,run bitbake

$ mkdir classes

在base.bbclass输入

addtask build

执行bitbake
 $ bitbake
     Nothing to do.  Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information

6.创建一个layer

创建myplayer,一个layer 中必须包含layer.conf 和recipe 文件。

创建mylayer/conf/layer.conf 文件,内容如下:

BBPATH .= ":${LAYERDIR}"

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

     BBFILE_COLLECTIONS += "mylayer"
     BBFILE_PATTERN_mylayer := "^${LAYERDIR}/"

创建recipe 文件printhello.bb 内容如下:

DESCRIPTION = "Prints Hello World"
     PN = 'printhello'
     PV = '1'

     python do_build() {
        bb.plain("********************");
        bb.plain("*                  *");
        bb.plain("*  Hello, World!   *");
        bb.plain("*                  *");
        bb.plain("********************");
     }
执行  bitbake printhello,打印如下:

ERROR: no recipe files to build, check your BBPATH and BBFILES?
ERROR: Nothing PROVIDES 'printhello'

Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
这是因为在hello/conf/bbplayer.conf 中没有声明layer

7.在hello/conf/bbplayer.conf 中声明recipe 的路径

创建hello/conf/bbplayer.conf 内容如下:

BBLAYERS ?= "/home/<your directory>/mylayer"

8 执行 bitbake printhello 打印如下:

bitbake printhello -f
WARNING: Layer mylayer should set LAYERSERIES_COMPAT_mylayer in its conf/layer.conf file to list the core layer names it is compatible with.
WARNING: Layer mylayer should set LAYERSERIES_COMPAT_mylayer in its conf/layer.conf file to list the core layer names it is compatible with.
Parsing recipes: 100% |####################################| Time: 0: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
Initialising tasks: 100% |#################################| Time: 0:00:00
NOTE: No setscene tasks
NOTE: Executing Tasks
********************
*                  *
*  Hello, World!   *
*                  *
********************
NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn't need to be rerun and all succeeded.

Summary: There were 2 WARNING messages shown.

demo 成功执行:
 

 


 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值