LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Distributions (https://www.linuxquestions.org/questions/linux-distributions-5/)
-   -   How to make a simple kernel patch with OE Bitbake / Recipe System (https://www.linuxquestions.org/questions/linux-distributions-5/how-to-make-a-simple-kernel-patch-with-oe-bitbake-recipe-system-842152/)

leiphasw 11-03-2010 12:58 PM

How to make a simple kernel patch with OE Bitbake / Recipe System
 
I am able to build an Angstrom distribution based on OpenEmbedded using the supplied Recipe files and Bitbake. When I move the built image to an SD card, it boots my BeagleBoard uImage file and I see my version information displayed on the TTY monitor as it boots and everything works fine.

However, I want to make a new build, specifically removing a patch to alignment.c that displays Kernel Alignment trap messages on the TTY mainly to prove to myself I can do it. My patch is simply to change the text of the trap message and rebuild. However, I have done that, but the rebuild never recompiles alignment.c. I have removed the associated alignment.o and rerun bitbake multiple times. The uImage is recreated each time, but I don't know where it is finding the code to link in. The Recipe files and work folders, cache, folders, etc. are so voluminous, that I spend hours grep'ing for files containing scraps of what may be a clue.

The Bitbake docs say it works based on makefiles. I have looked at the many makefiles and can't find a clue about how the uImage file is built. I would assume that a correct make file would notice the fact that I edited a source file and rebuild everything downstream.

I even edited the patch that was applied to create the trap message I ultimately want to remove, and that is ignored too.

Does anyone have an idea of how this system works? I just want to know how this works so I can make 'real' patches in the future for a project I am working on.

Thanks,
Steve.

business_kid 11-07-2010 03:25 AM

Here's how the system works. Presume you're root, and in the directory holding the sources.

diff -Naur source-vanilla source-modified > some.patch #makes a patch. original & modified source needed
To apply a patch, you leave it in the directory holding the sources, and cd into the topdir (e.g. linux-2.6.36.1)

patch -Nnp1 ../some.patch
The patch made in the paragraph above will have filenames line linux-2.6.36.1-modified/somedir/somefile. What the p1 option does is strip off everything left of the first /. So now it will simply be looking for somedir/somefile.

Read man patch. Patch -r reverses a patch. To make a patch, you need the vanilla source. To remove a patch, you need the patch and the patched source. That gives you the vanilla source. I would
1. remove the patch entirely
2. copy alignment.c in it's directory, and name the copy alignment.c-vanilla
3. Patch the vanilla source
4. delete alignment.c and replace it with alignment.c-vanilla
Clumsy, but sure.


All times are GMT -5. The time now is 03:01 PM.