프로그래밍/YOCTO
[Development Tasks Manual] 3. Layer 이해 및 생성
연소민
2023. 7. 31. 15:50
728x90
반응형
Open Embedded Build 시스템은 Metadata를 여러개의 layer로 구성하는 것을 지원한다.
layers를 적절히 활용하면 서로 다른 타입의 customization들을 분리할 수 있다.
Yocto 프로젝트 layer 모델에 대한 자세한 정보는 “The Yocto Project Layer Model” 여기에 설명되어있다.
1. 이미 존재하는 layer는 사용하려는 경우,
기존에 존재하는 meta-layer를 yocto directory에 위치해두고, build/conf/bblayers.conf 를 수정하면 된다.
2. 새로 layer를 생성 및 추가하려는 경우,
yocto directory에 원하는 이름의 layer를 생성한다.
생성하는 방법은 두가지이다.
1) 직접 directory를 생성
$ mkdir meta-mylayer
$ cd meta-mylayer
$ mkdir conf
$ cd conf
$ vi 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 += "mylayer" #
BBFILE_PATTERN_mylayer = "^${LAYERDIR}/"
BBFILE_PRIORITY_mylayer = "1"
# This should only be incremented on significant changes that will
# cause compatibility issues with other layers
LAYERVERSION_mylayer = "1"
LAYERDEPENDS_mylayer = "core"
LAYERSERIES_COMPAT_mylayer = "dunfell"
-----------------------------------------------------------------------------
Build 디렉터리로 이동하여 bblayers.conf 파일에 BBLAYERS에 해당 레이어를 추가하여준다.
해당 레이어를 추가해주어야 yocto build system에 포함된다.
$ vi build/conf/bblayers.conf
$ cat build/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 ?= ""
BBLAYERS ?= " \
/home/user/yocto-tegra/poky/meta \
/home/user/yocto-tegra/poky/meta-poky \
/home/user/yocto-tegra/poky/meta-yocto-bsp \
/home/user/yocto-tegra/meta-tegra \
/home/user/yocto-tegra/meta-mylayer \
"
2) bitbake-layers로 layer 생성
$ cd build
$ bitbake-layers create-layer ../meta-mylayer
$ bitbake-layers add-layer ../meta-mylayer
$ cat build/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 ?= ""
BBLAYERS ?= " \
/home/user/yocto-tegra/poky/meta \
/home/user/yocto-tegra/poky/meta-poky \
/home/user/yocto-tegra/poky/meta-yocto-bsp \
/home/user/yocto-tegra/meta-tegra \
/home/user/yocto-tegra/meta-mylayer \
"
직접 디렉터리를 생성 및 추가하는 거보다는 yocto의 bitbake-layers를 사용하는 것이 훨씬 간편하다.
728x90
반응형