Skip to contentSkip to conversation

Patch a kernel module out of tree / pathes?

DISCUSSION Steve 2 participants 3 messages Aug 31, 2022 – Sep 2, 2022

lore
Share & tools
lore

Steve

author
#0 lore raw

Hi, strange problem here. A recipe of a vendor (so not mine) builds a kernel module out of tree via Yocto
I need to patch that module, but I get error messages.

default "S" is:
S = "$WORKDIR/git/dir1/dir2"

The patch has to be applied to git

The patch is only applied if my bbappend file gets this line:
S = "$WORKDIR/git"

But in this case compilation goes wrong, which is clear as there is no Makefile in the new "S".

But if I leave it as it is, the patch will not applied. It complains about not find the file to patch.

So I modified my patchfile to be relative to the location of where the patch file is copied or relative to "S". In the later case it means I have to start with ../../ .
But non of the tests worked.

How can I at least find out what is the path while patching?

If you may I ask why to don't use the devtool? I did, but for some strange reason it doesn't create a recipe in the layer I want.
BTW: Is it right to do "devtool update-recipe -a >absolute path of layer< recipe ?
I would expect to give a relative name like "meta-mylayer"

Hope someone can give me a hint, spending already a day with that.

Thanks for your attention.

#1 lore raw
Quoted 11 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Steve
Sent: den 31 augusti 2022 15:20
To: [email protected]
Subject: [poky] Patch a kernel module out of tree / pathes?

Hi, strange problem here. A recipe of a vendor (so not mine) builds a kernel module out of tree via Yocto
I need to patch that module, but I get error messages.

Quoted 7 lines

default "S" is:
S = "$WORKDIR/git/dir1/dir2"

The patch has to be applied to git

The patch is only applied if my bbappend file gets this line:
S = "$WORKDIR/git"

You have a couple of options, depending on the patch file:

* If all the changes in the patch is contained within dir1/dir2, then you can add striplevel=3 to the URI for the patch, e.g., something like:

    SRC_URI += "file://my-changes.patch;striplevel=3"

* Otherwise you can add patchdir=../.. to the URI, e.g.:

    SRC_URI += "file://my-changes.patch;patchdir=../.."

* Or, if all else fails, you can override S for the patch task:

S:task-patch = "$WORKDIR/git"

The last option affects all patches, so if there already are other patches, it is not recommended.

Quoted 20 lines

But in this case compilation goes wrong, which is clear as there is no Makefile in the new "S".

But if I leave it as it is, the patch will not applied. It complains about not find the file to patch.

So I modified my patchfile to be relative to the location of where the patch file is copied or relative to "S". In the later case it means I have to start with ../../ .
But non of the tests worked.

How can I at least find out what is the path while patching?

If you may I ask why to don't use the devtool? I did, but for some strange reason it doesn't create a recipe in the layer I want.
BTW: Is it right to do "devtool update-recipe -a >absolute path of layer< recipe ?
I would expect to give a relative name like "meta-mylayer"

Quoted 3 lines

Hope someone can give me a hint, spending already a day with that.

Thanks for your attention.

//Peter

author
#2 lore raw

Am 01.09.22 um 15:24 schrieb Peter Kjellerstedt:

Quoted 58 lines
Quoted 11 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Steve
Sent: den 31 augusti 2022 15:20
To: [email protected]
Subject: [poky] Patch a kernel module out of tree / pathes?

Hi, strange problem here. A recipe of a vendor (so not mine) builds a kernel module out of tree via Yocto
I need to patch that module, but I get error messages.

Quoted 7 lines

default "S" is:
S = "$WORKDIR/git/dir1/dir2"

The patch has to be applied to git

The patch is only applied if my bbappend file gets this line:
S = "$WORKDIR/git"

You have a couple of options, depending on the patch file:

* If all the changes in the patch is contained within dir1/dir2, then you can add striplevel=3 to the URI for the patch, e.g., something like:

     SRC_URI += "file://my-changes.patch;striplevel=3"

* Otherwise you can add patchdir=../.. to the URI, e.g.:

     SRC_URI += "file://my-changes.patch;patchdir=../.."

* Or, if all else fails, you can override S for the patch task:

S:task-patch = "$WORKDIR/git"

The last option affects all patches, so if there already are other patches, it is not recommended.

Quoted 20 lines

But in this case compilation goes wrong, which is clear as there is no Makefile in the new "S".

But if I leave it as it is, the patch will not applied. It complains about not find the file to patch.

So I modified my patchfile to be relative to the location of where the patch file is copied or relative to "S". In the later case it means I have to start with ../../ .
But non of the tests worked.

How can I at least find out what is the path while patching?

If you may I ask why to don't use the devtool? I did, but for some strange reason it doesn't create a recipe in the layer I want.
BTW: Is it right to do "devtool update-recipe -a >absolute path of layer< recipe ?
I would expect to give a relative name like "meta-mylayer"

Quoted 6 lines
Quoted 3 lines

Hope someone can give me a hint, spending already a day with that.

Thanks for your attention.

//Peter

Thanks Peter,
it's quite amazing what you can get tweaked here!
I am wondering - would I have a chance to find that by myself (in the manual)? Once I know that keyword I found it in SRC_URI section... I did even find another option, wondering about the "quilt" message. I didn't know quilt before.
But git as a patch tool always starts down at git tree.
So I found that replace the patchtool by git helps with adding "PATCHTOOL = "git" to my bbappend file.
Maybe that is useful for someone else too.
//Arno