

linux-yocto_4.19linux-yocto_5.4.bbSTAGING_KERNEL_DIR
poky/meta/recipes-kernel/linux
linux-dummy.bb에서 PROVIDES += "virtual/kernel"$ bitbake virtual/kernel하면 bitbake build된다.poky/meta-mylayer/recipes-example/images/core-image-minimal-tiny.bbcore-image-minimal-tiny.bb에PREFERRED_PROVIDER_virtual/kernel="linux-yocto" 명시

$ bitbake -e [my image] | egrep "^PREFERRED_PROVIDER_" 로 잘 먹혔는지 보자.$ bitbake -e core-image-minimal-tiny.bb | egrep "^PREFERRED_PROVIDER_virtual/kernel"
PREFERRED_PROVIDER_virtual/kernel="linux-yocto"

$ bitbake -e [my image] | egrep "^PREFERRED_VERSION_linux-yocto"$ bitbake -e core-image-minimal-tiny.bb | egrep "^PREFERRED_VERSION_linux-yocto"
PREFERRED_VERSION_linux-yocto="5.4%"


# ======== ${TOPDIR}/conf/local.conf ========= #
PREFERRED_VERSION_linux-yocto="4.19%" # 물론 4.19% 버전이 있어야겠지만
linux-yocto 사용kernel recipe fully custom 작성poky/meta/conf/machine/qemux86-64.confPREFERRED_PROVIDER_virtual/kernel은 보이지 않는데
여기서 찾아본다.poky/meta/conf/machine/include/qemu.inc
$ git cone https://git.yoctoproject.org/git/meta-raspberrypi
(poky/meta-raspberrypi) $ git checkout dunfell # poky dunfell 버전 사용하므로
${TOPDIR}/conf/bblayers.conf 에 추가
$ bitbake-layers show-layers
layer path priority
==========================================================================
meta /home/dhyang/poky/meta 5
meta-poky /home/dhyang/poky/meta-poky 5
meta-yocto-bsp /home/dhyang/poky/meta-yocto-bsp 5
meta-mylayer /home/dhyang/poky/meta-mylayer 6
meta-raspberrypi /home/dhyang/poky/meta-raspberrypi 9
poky/meta-raspberrypi/conf/machine
raspberrypi.conf' 파일을 보면,
include conf/machine/include/rpi-base.inc 라고 있음poky/meta-raspberrypi/conf/machine/include/rpi-base.inc 파일을 보면
아마 rpi-default-providers.inc에서 PROVIDES를 제공하는 듯 하다.poky/meta-raspberrypi/conf/machine/include/rpi-default-providers.inc
PREFERRED_PROVIDER_virtual/kernel ?= "linux-raspberrypi" PROVIDERS를 가진다.poky/meta-raspberrypi/recipes-kernel/linux 에 가보면 진짜 "linux-yocto"가 아닌,"linux-raspberrypi"가 있다.
SRC_URIpatches 명시S 변수 지정defconfig 파일 제공inherit kernel.bbclasskernel.bbclassbbclass
linux-dhyang_1.0.bb : 커널 레시피 작성recipes-kernel/linux/linux-dhyang_1.0.bb 작성

linux-dhyang_1.0.bb
$ bitbake linux-dhyang

local.conf 에 써넣자.# === local.conf === #
PREFERRED_PROVIDER_virtual/kernel = "linux-dhyang"$ bitbake linux-dhyang

linux-dhyang_1.0.bb 에, checksum을 넣자.
oldnoconfig다시 bitbake!
$ bitbake linux-dhyang


kernel.bbclass에, do_configure() 가 아래 처럼 정의 되어 있다.
즉 '${S}'에, .config 파일이 필요한데, 커널 소스만 있어서 문제가 생긴 것이다.
.config파일을 만들자$ wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.19.6.tar.xz
$ tar -Jxvf ./linux-5.19.6.tar.xz -C ./
+)
qemux86-64 not provided defconfig


.config를 만들어낸다.




~/workspace/poky/meta-raspberrypi/recipes-kernel/linux/files

-> defconfig 로 고친다.


meta-skeleton에서, hello-mod 커널 모듈 레시피의 예가 있다.
hello-mod_0.1.bb
RPROVIDES_${PN}+= "kernel-module-hello"
$ bitbake hello-mod
KERNEL_SRC_PATH$ bitbake hello-mod -e | grep "^KERNEL_SRC_PATH"

WORKDIR
${D}/lib/modules/<kernel>/extra/hello.ko
MACHINE_ESSENTIAL_EXTRA_RDEPENDScore-image-minimal도 해당 패키지 그룹을 include 하므로 영향을 받는다.)MACHINE_EXTRA_RRECOMMENDS += "kernel-module-mymodule"
packagegroup-core-boot.bb
$ runqemu qemux86-64 core-image-minimal slirp nographic
$ insmod /lib/modules/5.4.209-yocto-standard/extra/hello.ko

KERNEL_MODULE_AUTOLOAD 변수KERNEL_MODULE_AUTOLOAD 변수는 부트 때, 자동으로 로드된다.KERNEL_MODULE_AUTOLOAD += "module_name1 module_name2 .. "