20160719_jeffrey - silenceuncrio/diary GitHub Wiki
-
0930 -
bitbake.conf
在<POKY_DIR>/poky/meta/conf
目錄 -
1050 -
core-image-minimal
是個recipe
- 1115 - From Bitbake Hello World to an Image
- 1310 - The Linux Command Line: A Complete Introduction
- 1725 - review M300 web
- 1815 - 異種國度 - Alienation
- 1825 - The Linux Command Line: A Complete Introduction
review 先
試著用昨天學到的 BitBake 知識來 trace M300
bitbake.conf
在 <POKY_DIR>/poky/meta/conf
目錄下
##################################################################
# General work and output directories for the build system.
##################################################################
TMPDIR ?= "${TOPDIR}/tmp"
CACHE = "${TMPDIR}/cache${@['', '/' + str(d.getVar('MACHINE', True))][bool(d.getVar('MACHINE', True))]}${@['', '/' + str(d.getVar('SDKMACHINE', True))][bool(d.getVar('SDKMACHINE', True))]}"
# The persistent cache should be shared by all builds
PERSISTENT_DIR = "${TOPDIR}/cache"
LOG_DIR = "${TMPDIR}/log"
CO_DIR = "${DL_DIR}"
CVSDIR = "${CO_DIR}/cvs"
SVNDIR = "${CO_DIR}/svn"
GITDIR = "${CO_DIR}/git2"
BZRDIR = "${CO_DIR}/bzr"
HGDIR = "${CO_DIR}/hg"
STAMPS_DIR ?= "${TMPDIR}/stamps"
STAMP = "${STAMPS_DIR}/${MULTIMACH_TARGET_SYS}/${PN}/${EXTENDPE}${PV}-${PR}"
STAMPCLEAN = "${STAMPS_DIR}/${MULTIMACH_TARGET_SYS}/${PN}/*-*"
BASE_WORKDIR ?= "${TMPDIR}/work"
WORKDIR = "${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}/${PN}/${EXTENDPE}${PV}-${PR}"
T = "${WORKDIR}/temp"
D = "${WORKDIR}/image"
S = "${WORKDIR}/${BP}"
B = "${S}"
bblayers.conf
在 /home/jeffrey/M300/fsl-release-bsp/build_small/conf
LCONF_VERSION = "6"
BBPATH = "${TOPDIR}"
BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}"
BBFILES ?= ""
BBLAYERS = " \
${BSPDIR}/sources/poky/meta \
${BSPDIR}/sources/poky/meta-yocto \
\
${BSPDIR}/sources/meta-openembedded/meta-oe \
\
${BSPDIR}/sources/meta-fsl-arm \
${BSPDIR}/sources/meta-fsl-arm-extra \
"
##Freescale Yocto Release layer
BBLAYERS += " ${BSPDIR}/sources/meta-fsl-bsp-release/imx/meta-bsp "
BBLAYERS += " ${BSPDIR}/sources/meta-fsl-bsp-release/imx/meta-sdk "
BBLAYERS += " ${BSPDIR}/sources/meta-openembedded/meta-networking "
BBLAYERS += " ${BSPDIR}/sources/meta-openembedded/meta-python "
BBLAYERS += " ${BSPDIR}/sources/meta-openembedded/meta-ruby "
BBLAYERS += " ${BSPDIR}/sources/meta-openembedded/meta-filesystems "
BBLAYERS += " ${BSPDIR}/sources/meta-proscend "
這裡可以看到 BBLAYERS
的定義
BitBake 會依照這些 layer list 去找個別的 layer.conf
<POKY_DIR>/poky/meta/conf/layer.conf
<POKY_DIR>/poky/meta-yocto/conf/layer.conf
<POKY_DIR>/meta-openembedded/meta-oe/conf/layer.conf
<POKY_DIR>/meta-fsl-arm/conf/layer.conf
<POKY_DIR>/meta-fsl-arm-extra/conf/layer.conf
<POKY_DIR>/meta-fsl-bsp-release/imx/meta-bsp/conf/layer.conf
<POKY_DIR>/meta-fsl-bsp-release/imx/meta-sdk/conf/layer.conf
<POKY_DIR>/meta-openembedded/meta-networking/conf/layer.conf
<POKY_DIR>/meta-openembedded/meta-python/conf/layer.conf
<POKY_DIR>/meta-openembedded/meta-ruby/conf/layer.conf
<POKY_DIR>/meta-openembedded/meta-filesystems/conf/layer.conf
<POKY_DIR>/meta-proscend/conf/layer.conf
以 <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"
BitBake 從 BBFILES
可以找到屬於該 layer 的 recipe
jeffrey@jeffrey-VirtualBox:~/M300/fsl-release-bsp/sources/poky/meta$ ls recipes-*/*/*.bb
recipes-bsp/acpid/acpid_2.0.23.bb
recipes-bsp/alsa-state/alsa-state.bb
...
一大堆...
以 bitbake core-image-minimal
為例
core-image-minimal
就是個 recipe
recipe file 在 <POKY_DIR>/poky/meta/recipes-core/images/core-image-minimal.bb
由 bitbake core-image-minimal -c devshell
得知 source code 在
<BUILD_DIR>/tmp/work/imx6ulevk-poky-linux-gnueabi/core-image-minimal/1.0-r0/core-image-minimal-1.0
先利用 inherit
關鍵字把相關的 *.bbclass
追出來
<POKY_DIR>/poky/meta/recipes-core/images/core-image-minimal.bb
...
inherit core-image
...
<POKY_DIR>/poky/meta/classes/core-image.bbclass
...
inherit image
...
<POKY_DIR>/poky/meta/classes/image.bbclass
參考 From Bitbake Hello World to an Image
實在很不容易 trace...
不過我知道了最後一階段做的事叫做 do_rootfs()
log 在 <BUILD_DIR>/tmp/work/imx6ulevk-poky-linux-gnueabi/core-image-minimal/1.0-r0/temp/log.do_rootfs.pid
之前一直想知道 所謂的 *.sdcard image 到底是怎麼 build 出來的
秘密就在 log 裡面
...
NOTE: Running image creation script for sdcard: /home/jeffrey/M300/fsl-release-bsp/build_small/tmp/work/imx6ulevk-poky-linux-gnueabi/core-image-minimal/1.0-r0/temp/create_image.sdcard ...
...
不過要花時間去挖 <BUILD_DIR>/tmp/work/imx6ulevk-poky-linux-gnueabi/core-image-minimal/1.0-r0/temp/create_image.sdcard
#!/bin/sh
# Emit a useful diagnostic if something fails:
bb_exit_handler() {
...
}
...
img_creation_func() {
...
}
bberror() {
echo "ERROR: $*"
}
generate_imx_sdcard() {
...
}
img_creation_func
看來要把 YOCTO 弄熟
shell script 的功力不能省
意外的發現自己有這一本 amazon 上賣得相當好的 The Linux Command Line: A Complete Introduction
當初從 http://www.it-eboot.info 下載... 目前已經關站了
下午 ariel 找我跟 jammy 開了個會 review 一下 M300 希望的 web 長相
其實也是 review 一下 M300 要做多少功能
今天下班要買 異種國度 - Alienation
這就是由 dead nation 班底打造的最新作品
我想這就是我一直在期待可以和老婆一起玩的遊戲
- 類似 Diablo 視角 - hell driver 也是採用類似設計
- 單機雙人
- 中文 - 目前 dead nation 是英文就玩得很爽了
The Linux Command Line: A Complete Introduction 這本書從下午看到現在
還沒看到 shell script
不過這本書的節奏真的很不錯