Yocto实践(1): 基于Dunfell 构建Yocto项目

因为工作中很多时候需要基于Yocto来改代码、编译SDK,很久之前就想彻底搞明白Yocto的理念、整个构建的细节。

现在开坑,基于Yocto官方文档,以实践记录+网络资料整理的方式,希望加深对Yocto的理解。

操作基于2020年4月份发行的3.1版本(Dunfell)。 Yocto的版本release记录:https://wiki.yoctoproject.org/wiki/Releases

 

系统要求:参考Yocto官方的参考文档https://www.yoctoproject.org/docs/current/brief-yoctoprojectqs/brief-yoctoprojectqs.html PC最好是Linux发行版,要求如下:

硬盘:至少50GB

发行版:最近的Fedora, openSUSE, CentOS, Debian, or Ubuntu

常用工具:

  • Git 1.8.3.1 or greater

  • tar 1.28 or greater

  • Python 3.5.0 or greater.

  • gcc 5.0 or greater.

需要安装如下软件包(我用的是Ubuntu 18.04, 以Ubuntu18.04为例。其他发行版请参考上面的链接):

$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
     build-essential chrpath socat cpio python python3 python3-pip python3-pexpect \
     xz-utils debianutils iputils-ping libsdl1.2-dev xterm

获取Poky: 

$ git clone git://git.yoctoproject.org/poky
Cloning into 'poky'...
remote: Counting objects: 432160, done.
remote: Compressing objects: 100% (102056/102056), done.
remote: Total 432160 (delta 323116), reused 432037 (delta 323000)
Receiving objects: 100% (432160/432160), 153.81 MiB | 8.54 MiB/s, done.
Resolving deltas: 100% (323116/323116), done.
Checking connectivity... done.

下载完成后会得到一个Poky文件夹。从这个文件夹里可以看到Git commit history。你可以在默认的分支上构建你的系统,也可以新建一个分支。如下:

$ git checkout tags/yocto-3.1 -b csdn1013-yocto-3.1
Switched to a new branch 'csdn1013-yocto-3.1'
~/poky$ git branch
* csdn1013-yocto-3.1
  dunfell

开始构建

1. 首先需要初始化编译环境source oe-init-build-env

~/poky$ source oe-init-build-env
You had no conf/local.conf file. This configuration file has therefore been
created for you with some default values. You may wish to edit it to, for
example, select a different MACHINE (target hardware). See conf/local.conf
for more information as common configuration options are commented.

You had no conf/bblayers.conf file. This configuration file has therefore been
created for you with some default values. To add additional metadata layers
into your configuration please add entries to conf/bblayers.conf.

The Yocto Project has extensive documentation about OE including a reference
manual which can be found at:
    http://yoctoproject.org/documentation

For more information about OpenEmbedded see their website:
    http://www.openembedded.org/


### Shell environment set up for builds. ###

You can now run 'bitbake <target>'

Common targets are:
    core-image-minimal
    core-image-sato
    meta-toolchain
    meta-ide-support

You can also run generated qemu images with a command like 'runqemu qemux86'

Other commonly useful commands are:
 - 'devtool' and 'recipetool' handle common recipe tasks
 - 'bitbake-layers' handles common layer tasks
 - 'oe-pkgdata-util' handles common target package tasks

如上面提示,现在通过bitbake编译工具可以编译一些目标image了:

    core-image-minimal
    core-image-sato
    meta-toolchain
    meta-ide-support

$bitbake core-image-sato

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值