【问题标题】:How to use an own kernel configuration for a raspberry pi in yocto?如何在 yocto 中为树莓派使用自己的内核配置?
【发布时间】:2018-01-16 07:18:26
【问题描述】:

我喜欢为我的 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 分支。

【问题讨论】:

    标签: linux linux-kernel raspberry-pi yocto


    【解决方案1】:

    不幸的是,最简单的方法可能是修补内核源代码...或者将您的 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 覆盖内核树中的那个。

    【讨论】:

    • 那行已经不存在了。
    【解决方案2】:

    请看一下如何使用 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 删除bbappend 文件;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-12-08
      • 2017-05-29
      • 1970-01-01
      • 2017-11-25
      • 1970-01-01
      • 1970-01-01
      • 2019-06-18
      • 2020-09-02
      相关资源
      最近更新 更多