20160714_jeffrey - silenceuncrio/diary GitHub Wiki
- 0935 - review - recipe - u-boot-imx - bitbake task - do_compile
-
1005 -
M300\fsl-release-bsp\sources\meta-fsl-arm\
-meta-fsl-arm
layer -
1050 -
bitbake-layers show-layers
- 看 M300 layers -M300/fsl-release-bsp/sources/
簡化 成<POKY_DIR>
-
1105 -
<POKY_DIR>/meta-fsl-arm/conf/layer.conf
是meta-fsl-arm layer
的configuration file
-
1200 -
<POKY_DIR>\meta-fsl-arm\conf\machine\imx6ulevk.conf
- 不知道 怎麼 被 吃進去 -
1310 -
<POKY_DIR>\meta-fsl-arm\conf\machine\imx6ulevk.conf
- 細節 算了 -
1325 -
<POKY_DIR>/poky/meta/recipes-bsp/u-boot/u-boot_2015.01.bb
- 解析 -
1410 -
<POKY_DIR>/poky/meta/recipes-bsp/u-boot/u-boot.inc
- 解析 -
1440 -
addtask deploy before do_build after do_compile
- 解析 -
1500 -
<POKY_DIR>\meta-fsl-bsp-release\imx\meta-bsp\recipes-bsp\u-boot\u-boot-imx_2015.04.bb
- 追蹤 - 1535 - morris 表示 明天 料備齊後 送 打件廠 - 下禮拜三 回來 算快
- 1550 - Yoctco Project Mega-Manual - Chapter 20. A Closer Look at the Yocto Project Development Environment - 20.1. User Configuration
review 先
溫故知新 更不要說這個 故 也算相對新
- recipe - u-boot-imx
- bitbake task - do_compile
來看 M300\fsl-release-bsp\sources\meta-fsl-arm\conf\machine\imx6ulevk.conf
先看 M300\fsl-release-bsp\sources\meta-fsl-arm\README
OpenEmbedded/Yocto BSP layer for Freescale's ARM platforms
==========================================================
This layer provides support for Freescale's ARM platforms for use with
OpenEmbedded and/or Yocto.
...
所以抽象來看 M300\fsl-release-bsp\sources\meta-fsl-arm\
的話就是個 meta-fsl-arm
layer
The Source Directory contains both general layers and BSP layers right out of the box.
The Source Directory contains BitBake, Documentation, Metadata and other files that all support the Yocto Project. Consequently, you must have the Source Directory in place on your development system in order to do any development using the Yocto Project.
Sometimes you might hear the term "poky directory" used to refer to this directory structure.
這邊讓人困擾
說的 Source Directory
像是 M300/fsl-release-bsp/sources/
jeffrey@jeffrey-VirtualBox:~/M300/fsl-release-bsp/sources$ ls -l
total 44
drwxrwxr-x 4 jeffrey jeffrey 4096 7月 5 14:02 base
drwxrwxr-x 10 jeffrey jeffrey 4096 7月 5 14:02 meta-browser
drwxrwxr-x 20 jeffrey jeffrey 4096 7月 5 14:02 meta-fsl-arm
drwxrwxr-x 7 jeffrey jeffrey 4096 7月 5 14:02 meta-fsl-arm-extra
drwxrwxr-x 4 jeffrey jeffrey 4096 7月 5 14:02 meta-fsl-bsp-release
drwxrwxr-x 8 jeffrey jeffrey 4096 7月 5 14:02 meta-fsl-demos
drwxrwxr-x 14 jeffrey jeffrey 4096 7月 5 14:02 meta-openembedded
drwxrwxr-x 19 jeffrey jeffrey 4096 7月 5 14:03 meta-openembedded.original
drwxrwxr-x 4 jeffrey jeffrey 4096 7月 5 14:03 meta-proscend
drwxrwxr-x 8 jeffrey jeffrey 4096 7月 5 14:03 meta-qt5
drwxrwxr-x 13 jeffrey jeffrey 4096 7月 5 14:03 poky
但 M300/fsl-release-bsp/sources/
本身卻又有一個 poky
目錄
jeffrey@jeffrey-VirtualBox:~/M300/fsl-release-bsp/sources/poky$ ls -l
total 76
drwxrwxr-x 6 jeffrey jeffrey 4096 7月 5 14:03 bitbake
drwxrwxr-x 7 jeffrey jeffrey 4096 7月 5 14:03 build
drwxrwxr-x 3 jeffrey jeffrey 4096 7月 5 14:03 build_small
drwxrwxr-x 13 jeffrey jeffrey 4096 7月 5 14:03 documentation
-rw-rw-r-- 3 jeffrey jeffrey 515 7月 5 14:03 LICENSE
drwxrwxr-x 21 jeffrey jeffrey 4096 7月 5 14:03 meta
drwxrwxr-x 5 jeffrey jeffrey 4096 7月 5 14:03 meta-selftest
drwxrwxr-x 7 jeffrey jeffrey 4096 7月 5 14:03 meta-skeleton
drwxrwxr-x 5 jeffrey jeffrey 4096 7月 5 14:03 meta-yocto
drwxrwxr-x 8 jeffrey jeffrey 4096 7月 5 14:03 meta-yocto-bsp
-rwxrwxr-x 1 jeffrey jeffrey 2000 7月 5 14:03 oe-init-build-env
-rwxrwxr-x 1 jeffrey jeffrey 2432 7月 5 14:03 oe-init-build-env-memres
-rw-rw-r-- 1 jeffrey jeffrey 2458 7月 5 14:03 README
-rw-rw-r-- 1 jeffrey jeffrey 19318 7月 5 14:03 README.hardware
drwxrwxr-x 9 jeffrey jeffrey 4096 7月 5 14:03 scripts
而且 M300/fsl-release-bsp/sources/poky/
更符合 Source Directory
的描述
The Source Directory contains BitBake, Documentation, Metadata and other files that all support the Yocto Project. Consequently, you must have the Source Directory in place on your development system in order to do any development using the Yocto Project.
回頭來看 meta-fsl-arm
這個 layer - M300\fsl-release-bsp\sources\meta-fsl-arm\
利用 bitbake-layers show-layers
可以看到 M300 有哪些 layers
jeffrey@jeffrey-VirtualBox:~/M300/fsl-release-bsp/build_small$ bitbake-layers show-layers
layer path priority
==========================================================================
meta /home/jeffrey/M300/fsl-release-bsp/sources/poky/meta 5
meta-yocto /home/jeffrey/M300/fsl-release-bsp/sources/poky/meta-yocto 5
meta-oe /home/jeffrey/M300/fsl-release-bsp/sources/meta-openembedded/meta-oe 6
meta-fsl-arm /home/jeffrey/M300/fsl-release-bsp/sources/meta-fsl-arm 5
meta-fsl-arm-extra /home/jeffrey/M300/fsl-release-bsp/sources/meta-fsl-arm-extra 4
meta-bsp /home/jeffrey/M300/fsl-release-bsp/sources/meta-fsl-bsp-release/imx/meta-bsp 8
meta-sdk /home/jeffrey/M300/fsl-release-bsp/sources/meta-fsl-bsp-release/imx/meta-sdk 8
meta-networking /home/jeffrey/M300/fsl-release-bsp/sources/meta-openembedded/meta-networking 5
meta-python /home/jeffrey/M300/fsl-release-bsp/sources/meta-openembedded/meta-python 7
meta-ruby /home/jeffrey/M300/fsl-release-bsp/sources/meta-openembedded/meta-ruby 7
meta-filesystems /home/jeffrey/M300/fsl-release-bsp/sources/meta-openembedded/meta-filesystems 6
meta-proscend /home/jeffrey/M300/fsl-release-bsp/sources/meta-proscend 10
我想我們可以把 M300/fsl-release-bsp/sources/
簡化成 <POKY_DIR>
方便記錄
-
Yoctco Project Mega-Manual
-
Chapter 5. Common Tasks
-
5.1. Understanding and Creating Layers
-
5.1.2. Creating Your Own Layer
- Create a Layer Configuration File
-
5.1.2. Creating Your Own Layer
-
5.1. Understanding and Creating Layers
-
Chapter 5. Common Tasks
<POKY_DIR>/meta-fsl-arm/conf/layer.conf
是 meta-fsl-arm layer
的 configuration file
試著解析 <POKY_DIR>/meta-fsl-arm/conf/layer.conf
# We have a conf and classes directory, add to BBPATH
BBPATH .= ":${LAYERDIR}"
# We have a packages directory, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
${LAYERDIR}/recipes-*/*/*.bbappend"
BBFILE_COLLECTIONS += "fsl-arm"
BBFILE_PATTERN_fsl-arm := "^${LAYERDIR}/"
BBFILE_PRIORITY_fsl-arm = "5"
FSL_EULA_FILE = "${LAYERDIR}/EULA"
FSL_MIRROR ?= "http://www.freescale.com/lgfiles/NMG/MAD/YOCTO/"
MIRRORS += " \
${FSL_MIRROR} http://download.ossystems.com.br/bsp/freescale/source/ \n \
"
# Let us add layer-specific bbappends which are only applied when that
# layer is included in our configuration
BBFILES += "${@' '.join('${LAYERDIR}/%s/recipes*/*/*.bbappend' % layer \
for layer in BBFILE_COLLECTIONS.split())}"
# Add layer-specific bb files too
BBFILES += "${@' '.join('${LAYERDIR}/%s/recipes*/*/*.bb' % layer \
for layer in BBFILE_COLLECTIONS.split())}"
這邊的 LAYERDIR
是 <POKY_DIR>/meta-fsl-arm
解析 BBPATH .= ":${LAYERDIR}"
BBPATH .= ":<POKY_DIR>/meta-fsl-arm"
BBPATH = "${BBPATH}:<POKY_DIR>/meta-fsl-arm"
解析 BBFILES += "${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bbappend"
等同於 BBFILES += "<POKY_DIR>/meta-fsl-arm/recipes-*/*/*.bb <POKY_DIR>/meta-fsl-arm/recipes-*/*/*.bbappend"
先看 <POKY_DIR>/meta-fsl-arm/recipes-*/*/*.bb
cd 到 <POKY_DIR>/meta-fsl-arm
利用 ls -l recipes-*/*/*.bb
可觀察結果
<POKY_DIR>/meta-fsl-arm/recipes-*/*/*.bbappend
同理
還是不知道 <POKY_DIR>\meta-fsl-arm\conf\machine\imx6ulevk.conf
是怎麼被吃進去的
我想應該早在 MACHINE=imx6ulevk source setup-environment build_small
的時候就決定了 <POKY_DIR>\meta-fsl-arm\conf\machine\imx6ulevk.conf
細節就算了吧
解析 <POKY_DIR>/poky/meta/recipes-bsp/u-boot/u-boot.inc
由 bitbake-layers show-layers
可知 <POKY_DIR>/poky/meta
是 meta layer
jeffrey@jeffrey-VirtualBox:~/M300/fsl-release-bsp/build_small$ bitbake-layers show-layers
layer path priority
==========================================================================
meta /home/jeffrey/M300/fsl-release-bsp/sources/poky/meta 5
...
meta layer
的 configuration file - <POKY_DIR>/poky/meta/conf/layer.conf
# We have a conf and classes directory, add to BBPATH
BBPATH .= ":${LAYERDIR}"
# We have recipes-* directories, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb"
...
解析 BBPATH .= ":${LAYERDIR}"
BBPATH .= ":<POKY_DIR>/poky/meta"
解析 BBFILES += "${LAYERDIR}/recipes-*/*/*.bb"
等同於 BBFILES += "<POKY_DIR>/poky/meta/recipes-*/*/*.bb"
cd 到 <POKY_DIR>/poky/meta
利用 ls -l recipes-*/*/*.bb
可已看到 u-boot
相關的 recipe
jeffrey@jeffrey-VirtualBox:~/M300/fsl-release-bsp/sources/poky/meta$ ls -l recipes-*/*/*.bb
...
-rw-rw-r-- 1 jeffrey jeffrey 311 7月 5 14:03 recipes-bsp/u-boot/u-boot_2015.01.bb
-rw-rw-r-- 1 jeffrey jeffrey 1606 7月 5 14:03 recipes-bsp/u-boot/u-boot-fw-utils_2015.01.bb
-rw-rw-r-- 1 jeffrey jeffrey 894 7月 5 14:03 recipes-bsp/u-boot/u-boot-mkimage_2015.01.bb
...
雖然 倒果為因 不過我們的目標是 <POKY_DIR>/poky/meta/recipes-bsp/u-boot/u-boot.inc
直接來解析 <POKY_DIR>/poky/meta/recipes-bsp/u-boot/u-boot_2015.01.bb
這個 recipe
require u-boot.inc
DEPENDS += "dtc-native"
# This revision corresponds to the tag "v2015.01"
# We use the revision in order to avoid having to fetch it from the repo during parse
SRCREV = "92fa7f53f1f3f03296f8ffb14bdf1baefab83368"
PV = "v2015.01+git${SRCPV}"
EXTRA_OEMAKE_append = " KCFLAGS=-fgnu89-inline"
require u-boot.inc
的敘述就會帶到 <POKY_DIR>/poky/meta/recipes-bsp/u-boot/u-boot.inc
我們可以說 u-boot_2015.01.bb recipe
由下面這些 file 所構成
<POKY_DIR>/poky/meta/recipes-bsp/u-boot/u-boot_2015.01.bb
<POKY_DIR>/poky/meta/recipes-bsp/u-boot/u-boot.inc
解析 <POKY_DIR>/poky/meta/recipes-bsp/u-boot/u-boot.inc
SUMMARY = "Universal Boot Loader for embedded devices"
HOMEPAGE = "http://www.denx.de/wiki/U-Boot/WebHome"
SECTION = "bootloaders"
PROVIDES = "virtual/bootloader"
LICENSE = "GPLv2+"
LIC_FILES_CHKSUM = "file://Licenses/README;md5=c7383a594871c03da76b3707929d2919"
SRC_URI = "git://git.denx.de/u-boot.git;branch=master"
S = "${WORKDIR}/git"
PACKAGE_ARCH = "${MACHINE_ARCH}"
inherit uboot-config deploy
EXTRA_OEMAKE = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS}" V=1'
# Allow setting an additional version string that will be picked up by the
# u-boot build system and appended to the u-boot version. If the .scmversion
# file already exists it will not be overwritten.
UBOOT_LOCALVERSION ?= ""
# Some versions of u-boot use .bin and others use .img. By default use .bin
# but enable individual recipes to change this value.
UBOOT_SUFFIX ??= "bin"
UBOOT_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.${UBOOT_SUFFIX}"
UBOOT_BINARY ?= "u-boot.${UBOOT_SUFFIX}"
UBOOT_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_SUFFIX}"
UBOOT_MAKE_TARGET ?= "all"
# Some versions of u-boot build an SPL (Second Program Loader) image that
# should be packaged along with the u-boot binary as well as placed in the
# deploy directory. For those versions they can set the following variables
# to allow packaging the SPL.
SPL_BINARY ?= ""
SPL_IMAGE ?= "${SPL_BINARY}-${MACHINE}-${PV}-${PR}"
SPL_SYMLINK ?= "${SPL_BINARY}-${MACHINE}"
# Additional environment variables or a script can be installed alongside
# u-boot to be used automatically on boot. This file, typically 'uEnv.txt'
# or 'boot.scr', should be packaged along with u-boot as well as placed in the
# deploy directory. Machine configurations needing one of these files should
# include it in the SRC_URI and set the UBOOT_ENV parameter.
UBOOT_ENV_SUFFIX ?= "txt"
UBOOT_ENV ?= ""
UBOOT_ENV_BINARY ?= "${UBOOT_ENV}.${UBOOT_ENV_SUFFIX}"
UBOOT_ENV_IMAGE ?= "${UBOOT_ENV}-${MACHINE}-${PV}-${PR}.${UBOOT_ENV_SUFFIX}"
UBOOT_ENV_SYMLINK ?= "${UBOOT_ENV}-${MACHINE}.${UBOOT_ENV_SUFFIX}"
do_compile () {
...
}
do_install () {
...
}
FILES_${PN} = "/boot ${sysconfdir}"
do_deploy () {
...
}
addtask deploy before do_build after do_compile
解析 addtask deploy before do_build after do_compile
Tasks are BitBake execution units that originate as functions and make up the steps that BitBake needs to run for given recipe.
Tasks are only supported in recipe (.bb or .inc) and class (.bbclass) files.
By convention, task names begin with the string "do_".
Any function can be promoted to a task by applying the addtask command.
The addtask command also describes inter-task dependencies.
Here is the function from the previous section but with the addtask command promoting it to a task and defining some dependencies:
python do_printdate () {
import time
print time.strftime('%Y%m%d', time.gmtime())
}
addtask printdate after do_fetch before do_build
In the example, the function is defined and then promoted as a task.
The do_printdate task becomes a dependency of the do_build task, which is the default task.
And, the do_printdate task is dependent upon the do_fetch task.
Execution of the do_build task results in the do_printdate task running first.
照樣造句 - addtask deploy before do_build after do_compile
The deploy
function is defined and then promoted as a task.
The deploy
task becomes a dependency of the do_build
task, which is the default task.
And, the deploy
task is dependent upon the do_compile
task.
Execution of the do_build
task results in the deploy
task running first.
依序執行
bitbake u-boot-imx -c clean
bitbake core-image-minimal
一閃而過的訊息中喵到
jeffrey@jeffrey-VirtualBox:~/M300/fsl-release-bsp/build_small$ bitbake core-image-minimal
...
Currently 1 running tasks (1565 of 1566):
0: u-boot-imx_2015.04-r0 do_xxx (pid xxxx)
我想我應該追蹤的是 <POKY_DIR>\meta-fsl-bsp-release\imx\meta-bsp\recipes-bsp\u-boot\u-boot-imx_2015.04.bb
<POKY_DIR>/meta-fsl-bsp-release/imx/meta-bsp
是 meta-bsp layer
'<POKY_DIR>/meta-fsl-bsp-release/imx/meta-bsp/recipes-bsp/u-boot/u-boot-imx_2015.04.bb是
u-boot-imx_2015.04 recipe`
# Copyright (C) 2013-2015 Freescale Semiconductor
DESCRIPTION = "U-Boot provided by Freescale with focus on i.MX reference boards."
require recipes-bsp/u-boot/u-boot.inc
PROVIDES += "u-boot"
LICENSE = "GPLv2+"
LIC_FILES_CHKSUM = "file://Licenses/gpl-2.0.txt;md5=b234ee4d69f5fce4486a80fdaf4a4263"
SRCBRANCH = "imx_v2015.04_3.14.52_1.1.0_ga"
UBOOT_SRC ?= "git://git.freescale.com/imx/uboot-imx.git;protocol=git"
SRC_URI = "${UBOOT_SRC};branch=${SRCBRANCH}"
SRCREV = "6cf684ae53011effa838ce2277fabfec4ae42ea0"
S = "${WORKDIR}/git"
inherit fsl-u-boot-localversion
LOCALVERSION ?= "-${SRCBRANCH}"
PACKAGE_ARCH = "${MACHINE_ARCH}"
COMPATIBLE_MACHINE = "(mx6|mx7|mx6ul)"
這邊的 require recipes-bsp/u-boot/u-boot.inc
便是 <POKY_DIR>/poky/meta/recipes-bsp/u-boot/u-boot.inc
可能是因為 <POKY_DIR>/poky/meta
是 meta layer
的關係
所以可以找到 <POKY_DIR>/poky/meta
下的 recipes-bsp/u-boot/u-boot.inc
u-boot-imx_2015.04 recipe
由下面這些 file 所構成
<POKY_DIR>/meta-fsl-bsp-release/imx/meta-bsp/recipes-bsp/u-boot/u-boot-imx_2015.04.bb
<POKY_DIR>/poky/meta/recipes-bsp/u-boot/u-boot.inc
直接看 M300/fsl-release-bsp/build_small/tmp/work/imx6ulevk-poky-linux-gnueabi/u-boot-imx/2015.04-r0/temp/log.task_order
就能知道發生甚麼事
do_populate_lic_setscene (4847): log.do_populate_lic_setscene.4847
do_fetch (4861): log.do_fetch.4861
do_unpack (4866): log.do_unpack.4866
do_patch (5090): log.do_patch.5090
do_configure (5092): log.do_configure.5092
do_compile (5097): log.do_compile.5097
do_deploy (8789): log.do_deploy.8789
do_install (8787): log.do_install.8787
do_populate_sysroot (8810): log.do_populate_sysroot.8810
do_package (8809): log.do_package.8809
do_packagedata (8940): log.do_packagedata.8940
do_package_qa (8974): log.do_package_qa.8974
do_package_write_rpm (8973): log.do_package_write_rpm.8973
頭暈腦脹了...
morris 表示明天料備齊後才會送去打件廠
至於打件廠甚麼時候上線打件就是未知數了
我們的量那麼少
下禮拜三回來就算快了
這張圖很清楚的讓我知道 bitbake u-boot-imx
是如何被下面這些 file 所影響
- M300/fsl-release-bsp/sources/meta-fsl-arm/conf/machine/imx6ulevk.conf
- M300/fsl-release-bsp/build_small/conf/local.conf
Chapter 20. A Closer Look at the Yocto Project Development Environment 的內容非常的豐富
不過自己實在能力有限... 消化不良阿...
總感覺掌握了 YOCTO 就能抓住什麼一樣