0

I want to build my own yocto image for a raspberry (cm3). I use the meta-raspberry (dunfell) layer and poky dunfell-23.0.0.

For installing the microchip wilc3000 module I have to modify the kernel following this guide. In that way, I change the kernel conf (Kconfig) to add the mchp driver in the menu and later selecting it.

I have generated a patch to the kernel using this guide (Patch-based workflow). After generating the patch, I have modified and generated a new kernel config (defconfig). All the changes are applied in my own layer with this recipe (linux-raspberrypi_%.bbappend):

FILESEXTRAPATHS_prepend := "${THISDIR}/patchs:"

SRC_URI += "file://0001-Add-wilc3000-driver.patch \
            file://defconfig_my \
            "
PACKAGE_ARCH = "${MACHINE_ARCH}"

# PR="r2"

INTREE_DEFCONFIG_pn-linux-ti = "defconfig_my"

kmoddir = "/lib/modules/${KERNEL_VERSION}/kernel/drivers/net/wireless/mchp"

# do_configure_append() {
#     cat ${WORKDIR}/*.cfg >> ${B}/.config
# }

do_install_append() {
  install -d ${D}${kmoddir}
  install -m 0755 ${WORKDIR}/wilc-spi.ko ${D}${kmoddir}
}


FILES_${PN}_append += " \
  ${kmoddir}/wilc-spi.ko \
"

The patchs folder contains the patch for the kernel and the new kernel configuration generated

When I generate the image:

bitbake -v core-image-base

The generation fails in do_install task when it tries to copy wilc-spi.ko, which is not generated.

Which is the way to compile and deploy the kernel with my own configuration? if I download and compile the kernel in a separate folder, it successfully generates the wilc-spi.ko, but inside build folder in yocto there is no trace of the file generation.

Please, help me to add this driver to the kernel, Thanks a lot.

esguti
  • 234
  • 4
  • 11
  • 1
    Where is this `INTREE_DEFCONFIG` coming from? I'm pretty sure that's the incorrect part in your recipe. I would rename your file to `defconfig` only and from what I read quickly in kernel-yocto.bbclass (inherited by linux-yocto.inc, required by linux-raspberrypi) that should do it. No need for `INTREE_DEFCONFIG`. Also I'm very unsure about taking the kernel module directly from `${WORKDIR}` that seems like a mistake, at worst it should be in `${B}`. Anyway you shouldn't need to install the module anywhere nor add it to a package, a `kernel-module-wilc-spi` package should be there for you. – qschulz Sep 24 '20 at 19:38
  • I have tried with this solution https://stackoverflow.com/questions/45573078/how-to-use-an-own-kernel-configuration-for-a-raspberry-pi-in-yocto (do_kernel_configme_prepend) and it works, but I will try with your suggestions, it looks like a cleaner solution – esguti Sep 25 '20 at 07:20
  • I guess you can also set this variable so that it doesnt fail when trying to copy the package(as it will be inbuilt into Kernel) MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "wilc-spi" – Naveen Sep 28 '20 at 20:53

1 Answers1

0

As @qschulz pointed out, the solution was to change defconfig_my to defconfig and remove all the extra code. Finally, the code looks like this:

FILESEXTRAPATHS_prepend := "${THISDIR}/patchs:"

SRC_URI += "file://0001-Add-wilc3000-driver.patch \
            file://defconfig \
            "
PACKAGE_ARCH = "${MACHINE_ARCH}"

PR="r3"
    
FILES_${PN}_append += " \
  ${kmoddir}/wilc-spi.ko \
"

KERNEL_MODULE_AUTOLOAD += "wilc-spi.ko"

And add in the layer.conf the instruction to load the module:

MACHINE_EXTRA_RDEPENDS += " kernel-module-wilc-spi "
esguti
  • 234
  • 4
  • 11