目标创建一个自定义的最小系统
准备工作,首先安装必要的工作环境
1.创建一个版本库
mkdir my_atmel
cd my_atmel
2.通过git下载poky
git clone git://git.yoctoproject.org/poky -b rocko
3.通过git下载meta-openembedded
git clone git://git.openembedded.org/meta-openembedded -b rocko
4.通过git下载meta-qt5
git clone git://code.qt.io/yocto/meta-qt5.git
cd meta-qt5
git checkout v5.9.4
cd ..
5.通过git下载meta-atmel
git clone git://github.com/linux4sam/meta-atmel.git -b rocko
开始构建系统
1.打开poky文件夹
cd poky
2.初始化版本库
source oe-init-build-env build-atmel
3.添加meta-atmel的配置文件,并进行初始化设置
vim conf/bblayers.conf
参考设置:
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../../..')}"
BBLAYERS ?= " \
${BSPDIR}/poky/meta \
${BSPDIR}/poky/meta-poky \
${BSPDIR}/poky/meta-yocto-bsp \
${BSPDIR}/meta-atmel \
${BSPDIR}/meta-openembedded/meta-oe \
${BSPDIR}/meta-openembedded/meta-networking \
${BSPDIR}/meta-openembedded/meta-python \
${BSPDIR}/meta-openembedded/meta-multimedia \
${BSPDIR}/meta-qt5 \
"
BBLAYERS_NON_REMOVABLE ?= " \
${BSPDIR}/poky/meta \
${BSPDIR}/poky/meta-poky \
"
4.配置local.conf 配置文件
主要配置以下几点,仅供参考,可以根据自己需求调整,调整内容必须是当前SOCs/MCHINE 支持的。不能随便填写。
MACHINE ??= "sama5d3-xplained"
[...]
DL_DIR ?= "your_download_directory_path"
[...]
PACKAGE_CLASSES ?= "package_ipk"
[...]
USER_CLASSES ?= "buildstats image-mklibs"
DISTRO = "poky-atmel"
5. 创建一个最小核心(该过程耗时较长,根据个人的网速决定)
bitbake core-image-minimal
6.如果需要添加QT,那么需要在local.conf中添加配置
LICENSE_FLAGS_WHITELIST += "commercial"
SYSVINIT_ENABLED_GETTYS = ""
7.创建一个Atmel 演示镜像 (该过程耗时较长,根据个人的网速决定)
bitbake atmel-qt5-demo-image
完成后会输出相关信息
Typical bitbake output
======================
Build Configuration:
BB_VERSION = "1.36.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "universal"
TARGET_SYS = "arm-poky-linux-gnueabi"
MACHINE = "sama5d2-xplained"
DISTRO = "poky-atmel"
DISTRO_VERSION = "2.4.2"
TUNE_FEATURES = "arm armv7a vfp thumb neon callconvention-hard cortexa5"
TARGET_FPU = "hard"
meta
meta-poky
meta-yocto-bsp = "rocko:cca8bde9d700d68c5f36d7d4c47c048526aedfc0"
meta-atmel = "rocko:0353a4afb1f404aa0830b19dcde4f057070a4ce3"
meta-oe
meta-networking
meta-python
meta-multimedia = "rocko:dacfa2b1920e285531bec55cd2f08743390aaf57"
meta-qt5 = "HEAD:e721e84659869e4a04838d95d7cdbab9d48f5c3d"
8.添加嵌入式软件SDK支持
bitbake -c populate_sdk atmel-qt5-demo-image
9.安装SDK
./tmp/deploy/sdk/poky-atmel-glibc-x86_64-atmel-qt5-demo-image-cortexa5hf-vfp-toolchain-2.1.1.sh
10.使用SDK
cd /opt/poky-atmel/2.1.1/
source environment-setup-cortexa5hf-neon-poky-linux-gnueabi
以上就完成了整个yocto工程建立,下面可以开始使用了,先从“Hellow Word”开始。
参考文献:
1.http://www.at91.com/linux4sam/bin/view/Linux4SAM/PokyBuild#How_to_build_Poky_for_AT91
2.https://www.yoctoproject.org/docs/latest/dev-manual/dev-manual.html#usingpoky-extend-addpkg-singlec