Search code examples
linuxyoctopatchbitbake

How to patch Linux kernel source code in yocto?


The part I'm working on is kernel-devsrc, which is in the recipe recipes-kernel.

I want to change one of the source .c files in drivers/usb/serial in kernal-devsrc. From some of the online materials, I need to:

  • Have my own layer
  • In the layer, need a recipe with the same name as recipes-kernel (and further more, recipes-kernel/linux)
  • Add the .bbappend file and patch file.

The problem is: to create a patch file I need to know the 2 git SHAs of before and after the change, but I don't have access to the third party recipes-kernel, how do I get the SHA?? OR, if that is the wrong way to do this, could you point out the right way to do it? Thanks!

NOTE: This is problem is not like this one: How patching works in yocto, which the author has access to the source code (.c and .h files). I DON'T have access to the source code, the yocto kernel I'm working on is from a public git repo, and I am not able to git commit to get the SHA, which is necessary to create the patch file.


Solution

  • So, the way I do it is to use Quilt, follow the steps there then good to go: https://www.yoctoproject.org/docs/1.8/dev-manual/dev-manual.html#using-a-quilt-workflow

    I don't need to know the SHA (though I still don't know why others in my organization end up writing SHAs in the patch files and how did they know the SHAs).