簡體   English   中英

如何在yocto中為樹莓派使用自己的內核配置?

[英]How to use an own kernel configuration for a raspberry pi in yocto?

我想為RPI2 +自定義板刪除一些未使用的驅動程序。 為此,我通過以下方式創建自己的配置:

bitbake linux-raspberrypi -c menuconfig

並將新的內核預設保存到文件defconfig

之后,我為linux-raspberryp配方創建了一個附加文件。

所以我創建了文件

linux-raspberrypi%.bbappend

並填充:

FILESEXTRAPATHS_prepend := "${THISDIR}/linux-raspberrypi:"

SRC_URI += "file://defconfig"

PACKAGE_ARCH = "raspberrypi2"

我將defconfig文件放到:

<meta-mylayer>/recipes-kernel/linux/linux-raspberrypi/raspberrypi2/defconfig

通過以下方式重新編譯內核時:

bitbake linux-raspberrypi -c clean
bitbake linux-raspberrypi

采用標准RPI2配置。

任何想法如何克服這個問題? 我正在研究meta-raspberrypi和yocto的“實際” pyro分支。

好吧,不幸的是,最簡單的方法可能是修補內核源代碼……或者將defconfig復制到內核樹中。

meta-raspberrypi層在其內核配方中做了一些不幸的事情,盡管隨着時間的流逝它已經變得更好了,但它們仍然不是很好...

如果您看一下recipes-kernel/linux/linux-raspberrypi.inc ,以下幾行說明了這個問題:

KERNEL_DEFCONFIG_raspberrypi2 ?= "bcm2709_defconfig"

do_kernel_configme_prepend() {
    install -m 0644 ${S}/arch/${ARCH}/configs/${KERNEL_DEFCONFIG} ${WORKDIR}/defconfig || die "No default configuration for ${MACHINE} / ${KERNEL_DEFCONFIG} available."
}

因此,他們將樹內defconfig復制到${WORKDIR}/defconfig ,從而覆蓋您自己的defconfig。

您在.bbappend ,可以嘗試添加:

do_kernel_configme_prepend() {
    install -m 0644 ${WORKDIR}/defconfig ${S}/arch/${ARCH}/configs/${KERNEL_DEFCONFIG} || die "No default configuration for ${MACHINE} / ${KERNEL_DEFCONFIG} available."
}

因此,首先用您自己的defconfig覆蓋內核樹。

請看看如何使用devtool修改jethro的源代碼: http : //www.yoctoproject.org/docs/2.0/dev-manual/dev-manual.html#using-devtool-in-your-workflow

我將從在正在使用的git存儲庫中創建一個fork開始; http://git.yoctoproject.org/cgit/cgit.cgi/meta-raspberrypi/tree/recipes-kernel/linux/linux-raspberrypi_4.9.bb

在Yocto中使用devtool ; 在您的構建目錄中:創建一個my-linux-raspberry文件夾;

mkdir linux-raspberry-test
devtool modify -x linux-raspberry ./my-linux-raspberry

這會將源代碼解壓縮到my-linux-raspberry ,以供您修改; 它還在其中創建git存儲庫;

然后,修改my-linux-raspberry的代碼; 要測試構建,請運行devtool build linux-raspberry 滿意后,將此git倉庫添加到您的fork中;

git add .
git commit -m "my-linux-raspberry"
devtool update-recipe linux-raspberry

可選:運行devtool reset linux-raspberry raspberry來刪除bbappend文件;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM