layer を追加する
blog
2019-4-1 12:42 JST

layer をつくる

Yocto では yocto-layer create で雛形を作ってくれるので、これを利用します。つくってくれる雛形は layer.conf だけですので、Yocto に頼らず手で作っても構いません。

$ yocto-layer create sby-zynq
Please enter the layer priority you'd like to use for the layer: [default: 6]
Would you like to have an example recipe created? (y/n) [default: n]
Would you like to have an example bbappend file created? (y/n) [default: n]

New layer created in meta-sby-zynq.

Don't forget to add it to your BBLAYERS (for details see meta-sby-zynqREADME).
$ ls
meta-sby-zynq

できた layer.conf は次のように recipes ディレクトリの bb や bbappend を読み込む設定になっています。

$ cat meta-sby-zynq/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 
        ${LAYERDIR}/recipes-*/*/*.bbappend"

BBFILE_COLLECTIONS += "sby-zynq"
BBFILE_PATTERN_sby-zynq = "^${LAYERDIR}/"
BBFILE_PRIORITY_sby-zynq = "6"

BBFILE_COLLECTIONS の "sby-zynq" というキーワードから変数を設定(?)するようだ。

マニュアルから以下引用

In the previous example, the recipes for the layers are added to BBFILES. The BBFILE_COLLECTIONS variable is then appended with the layer name. The BBFILE_PATTERN variable immediately expands with a regular expression used to match files from BBFILES into a particular layer, in this case by using the base pathname. The BBFILE_PRIORITY variable then assigns different priorities to the files in different layers. Applying priorities is useful in situations where the same package might appear in multiple layers and allows you to choose what layer should take precedence.

meta-skelton

poky の下には meta-skelton なるものがあります。これを参考にしてメタデータ(レシピ)を作成することが可能です。ここには、恐らく多くの人が行いたいと思う、busybox の変更と kernel の変更のサンプルが納めれられています。

Freescale の MIRRORS

Freescale の meta-fsl-arm/conf/layer.conf では MIRRORS が追加されています。このように提供する側がソースをダウンロードする URL を追加しておくと便利になります。

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      
"