0

My question is a variation of this one. In fact, this one is also related expect he is actually farther along than I am. From what I can tell, I cannot get buildroot to find and apply any of my patches.

I've followed the formatting instructions to create my patch file, which now lives here:

./buildroot/board/mycompany/myboard/patches/myprogram/myversion/myprogram-0-fix.patch

From what I can tell I have setup the path and file name correctly following these instructions. I have also set BR2_GLOBAL_PATCH_DIR to:

"board/mycompany/myboard/patches"

I made an assumption that after doing all of this, loading my config file (the one pointing to the "myboard" folder and with the global patch dir set) - and then running a make that my patches would be applied automatically during the process. However, it doesn't appear to pick up the patches at all.

I believe I am missing some step(s) to apply the patches. This section of the documentation describes how patches are applied but I'm struggling to understand it. How would I run the <packagename>_PRE_PATCH_HOOKS command? Can this be performed automatically for me when I run a make ?

For reference, myprogram starts out as a downloaded tarball in the dl/ folder - it is later extracted and then compiled. My hope was to not have to modify the contents of the this tarball and be able to use the buildroot patching mechanism to apply the patch after the contents are extracted but before the package is built. Is this even a valid manner of applying a patch in buildroot?

1 Answer 1

2

The steps you describe are correct, so there is probably one of them that you didn't apply correctly.

You must have set BR2_GLOBAL_PATCH_DIR correctly because buildroot errors out if it doesn't exist. As a sanity check, change it into some non-existent directory and observe that you get an error.

So most likely there is something wrong in your directory names.

As a first step, I would leave out the version part of the path - it is only useful if you want to support several versions of myprogram. So put your patch in board/mycompany/myboard/patches/myprogram/0-fix.patch.

Also, check the spelling of myprogram.

Failing that, run:

make myprogram-dirclean
make myprogram-patch V=1

This will show you the exact steps that buildroot performs. You should first see a download step that does nothing, then an extract step that extracts the tarball, and then a patch step with a long and complicated shell command that looks for patches in several places. Copy and paste this shell command into your shell and start stripping it down to find where it goes wrong.

Regarding MYPROGRAM_PRE_PATCH_HOOKS, that's something that you would put in your myprogram.mk file. It can be used for instance when the patches to apply are part of the tarball itself.

1
  • A little late getting back with my response - but your answer led me to discover that the branch I was working with (2013.02) did not yet have the BR2_GLOBAL_PATCH_DIR feature added. This is the commit where the feature was added. Based on a brief lookup - it would have first been available in 2013.05.
    – dtmland
    May 27, 2015 at 20:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.