Patch applying failed on linux kernel

Hi all,
I have tried to applying patch on kernel defconfig file and I did something like this for that:
Steps:

  1. recipes-kernel/linux/linux-toradex-4.1/defconfig file
    diff -Naur linux-toradex-4.1/defconfig defconfig > mypatch.patch
    mypatch.patch file has been created successfully.

  2. Then I have added that patch file path in my linux-toradex_4.1.bb file.see the below information:
    FILESEXTRAPATHS_prepend := “${THISDIR}/linux-toradex-4.1:” FILESEXTRAPATHS_prepend := “${THISDIR}/${PN}:”

    require recipes-kernel/linux/linux-imx.inc require recipes-kernel/linux/linux-dtb.inc

    SUMMARY = “Linux kernel for Toradex Colibri VFxx Computer on Modules”

    SRC_URI = "git://git.toradex.com/linux-toradex.git;protocol=git;branch=${SRCBRANCH} \ file://defconfig \ " SRC_URI_append = “file://mypatch.patch”

    LOCALVERSION = “-v2.5b1.1” SRCBRANCH = “toradex_vf_4.1” SRCREV = “326879dda277c0b85f64bf66e071745b63c0f658” DEPENDS += “lzop-native bc-native” COMPATIBLE_MACHINE = “(vf)”

  3. bitbake -c clean virtual/kernel bitbake virtual/kernel

  4. Check patch applied successfully or not /oe-core/build/out-glibc/work/colibri_vf-angstrom-linux-gnueabi/linux-toradex/4.1-r0 → defconfig file is there and mypatch.patch file also there but it was not applied on defconfig.

Can you share helpful though on this issue?It will be helpful for me.

Thank you. BR, Kanji Viroja.

Hi

I’m astonished that you did not get an error in the do_patch task. Patches are applied relative to the source directory ${S}. Thus ${WORKDIR}/defconfig is not easily reachable.

Rather than trying to fix this I would recommend a different approach.

  • Either directly change recipes-kernel/linux/linux-toradex-4.1/defconfig to your needs
    or
  • create your own layer, add a bbappend file which prepends the lookup path with a directory containing your defconfig.
    The bbappend could have the following content, the defconfig would then be in a subdirectory ‘linux-toradex-4.1’ of were the bbappend is.
    FILESEXTRAPATHS_prepend := “${THISDIR}/linux-toradex-4.1:”
    An example of this concept can be found here:
    http://git.toradex.com/cgit/meta-toradex.git/tree/recipes-bsp/alsa-state?h=V2.5
    With the additional subdirectories named after the machine bitbake will only take these files when building for said machines.

Max

Yes.You are right. If we can add extra recipes or .bbappend file then it works fine.

Actually, I want to test how to add patch for linux-kernel without using the menuconfig option and I seen there was many recipes added patch files applied using SRC_URI.

do_patch = parsed .patch or .diff
That was not giving any warning or error.but when I checked patch is applied or not.there was I seen my patch file also placed there without applying on defconfig. so am I thinking about the patch file?it may getting wrong path or something.

Kanji.

Reference: https://www.yoctoproject.org/sites/default/files/kernel-lab-1.4.pdf