1

I am trying to build a raspberrypi image in yocto, and it builds the linux kernel 5.15 just fine.

But I want to build kernel 6.1.21, so this is my directory structure:

sources/meta-raspberrypi/recipes-kernel/linux
 + linux-raspberrypi_5.15.bb

sources/meta-mylayer/recipes-kernel/linux
 + linux-raspberrypi_6.1.bb

Where linux-raspberrypi_6.1.bb looks like this, basically a copy of linux-raspberrypi_5.15.bb with different LINUX_VERSION:

LINUX_VERSION ?= "6.1.21"
LINUX_RPI_BRANCH ?= "rpi-6.1.y"
LINUX_RPI_KMETA_BRANCH ?= "yocto-6.1"

SRCREV_machine = "${AUTOREV}"
SRCREV_meta = "${AUTOREV}"

KMETA = "kernel-meta"

SRC_URI = " \
    git://github.com/raspberrypi/linux.git;name=machine;branch=${LINUX_RPI_BRANCH};protocol=https \
    git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=${LINUX_RPI_KMETA_BRANCH};destsuffix=${KMETA} \
    file://powersave.cfg \
    file://android-drivers.cfg \
    "

require linux-raspberrypi.inc

KERNEL_DTC_FLAGS += "-@ -H epapr"

And in local.conf, I added these lines:

# KERNEL_VERSION_SANITY_SKIP="1"
PREFERRED_VERSION_linux-raspberrypi = "6.1.21"

But I get this warning and it does not find my recipe:

WARNING: preferred version 6.1.21 of linux-raspberrypi not available (for item kernel-image-image) WARNING: versions of linux-raspberrypi available: 1:5.10.110+gitAUTOINC+e1979ceb17_89c0af71c9 1:5.15.34+gitAUTOINC+e1b976ee4f_0086da6acd 1:6.1.21+gitAUTOINC+b358c237cf_4b60cbf014

However if I put my recipe in the folder

sources/meta-raspberrypi/recipes-kernel/linux

Then it builds the kernel I want: 6.1

How can I keep the recipe in my layer, and let it find it and not build 5.15?

rosewater
  • 604
  • 2
  • 8
  • 22
  • 1
    You can use the percentage wildcard in `PREFERRED_VERSION`, like so: `PREFERRED_VERSION_linux-raspberrypi = "6.1.21%"` - it will prefer versions starting with this string. – skandigraun Jun 23 '23 at 18:28
  • That was it. Thanks. If you convert your comment to an answer, I can accept it – rosewater Jun 23 '23 at 18:56

0 Answers0