Help Needed : Kernel rebuild
Hi,
I have added or integrated a patch in gpiolib.c. I am new to Driver Programming. I am extending a driver code for a wireless bridge device for which added few lines of code in existing gpiolib.c file. I want to re build my kernel. Can anyone help me with the steps I should follow in order to rebuild my kernel after adding/ modifying some code in one of the files like in my case gpiolib.c and some additional documentation that has also been updated for the changes done. I can also provide additional information related to kernel or anything else if required. Any kind of help would be appreciated. Thank You in advance. |
It sounds as if you've obtained a copy of the kernel source. Ideally this source matches the kernel you're using.
In the kernel source tree, the simplest actions to do are: Code:
make config The way to be able to tell whether it is a Module or Inline is to view your .config file. This is at the top level of your kernel source directory. You can view/edit that file and yes it does say that it is automatically generated and not to edit it. If you do manually edit the file, you're supposed to know what dangers you are risking. Viewing it of course perfectly fine. There are also varied ways to modify your config; not just manually editing, but also using a menu based modifier. When in the file, search for all instances of "gpio" and you're probably looking for CONFIG_GPIOLIB, if that says "=y" then it is INCLUDED in the kernel binary image and compiled Inline, if that says "=m" then it is a MODULE, therefore NOT included in the kernel binary image. It will be made by the make action, but it will become a load-able module; the benefit is that you can load or unload that during runtime, and you can also rebuild that module without performing a full kernel rebuild. There are other pros and cons which I'll skip right now. If it says something like "# CONFIG_GPIOLIB is not set" then it is NOT INCLUDED inline OR as a module, it's not included at all. Therefore change that line to say either "y" or "m" similar to how other lines show, via taking out the # comment and setting the text up appropriately by getting rid of the "is not set" part. Not completely sure on this one, 50% sure that if it is specified as a module, that you can go to your "drivers" directory and then type "make gpio" and that will make the GPIO library. They keyword may be "make gpiolib" I'm not sure this isn't configured for my particular kernel. The result is that the GPIO library .ko file will be remade and you can copy that file to the same location where it is on your system, reboot, and then you'll be using your newly built module. Some things to do to ensure you've got it right is to add a printk() in the init call to show something unique to indicate that you've not only entered the module, but also the rebuilt code you created is exactly what you're running. NOTE that if there are issues related to "different target" for the kernel other than the system you're running on; then this subject grows by way of things like "configuration for your compilation tools so that they're set up to compile properly for your target", stuff like that. Or if things like "make" don't even work at all, then you may need to install the basic build tools. The first assumption is that you're building the kernel on the system you're working with and that build tools as well as kernel source are all set up already. |
I do something like this:
It also helps to keep a journal of all changes ... which I do with a loose-leaf notebook and a number-two pencil. (Yes, the yellow sticks with a piece of rubber on one end.) |
All times are GMT -5. The time now is 09:08 AM. |