How to make a simple kernel patch with OE Bitbake / Recipe System
Linux - DistributionsThis forum is for Distribution specific questions.
Red Hat, Slackware, Debian, Novell, LFS, Mandriva, Ubuntu, Fedora - the list goes on and on...
Note: An (*) indicates there is no official participation from that distribution here at LQ.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.