[PLUG] Linux clinic Sun - kernel hacking?
Wayne E. Van Loon Sr.
wevl at pacifier.com
Thu Dec 17 05:09:03 UTC 2009
Mike Connors wrote:
> Carlos Konstanski wrote:
>
>> Sure does. The first step is to get the kernel source. Most binary
>> distros don't give you this by default. Many distros have their own
>> kernel patchsets which alter the kernel from its original form. I
>> suggest going to http://www.kernel.org/ and downloading a vanilla
>> kernel, at least as an initial exercise. Then run "make menuconfig"
>> and browse through the entire tree of configuration options.
>> Familiarity with this layout is a must if you want to build your own
>> kernel.
>>
I am not an expert, but something I have found handy as a starting point
is /proc/config.gz.
If you have a running kernel that you want to modify AND
If it was compiled with a few flags enabled...
CONFIG_PROC_FS=y
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
Your kernel will produce a proc pseudo filesystem where there will be a
/proc/config.gz file.
This is a compressed record of the configuration that the kernel was
compiled with.
zcat /proc/config.gz > somefile
will get you a copy of the configuration in somefile.
If you zcat /proc/config.gz > .config
in the /usr/src/linux directory, the .config file will be in the right
location for "make menuconfig" or "make xconfig". I prefer xconfig. You
can also examine and edit the .config file with your favorite editor.
I recommend this as a good place to start and can save a beginner many
attempts to get everything needed to boot and run. You can then
experiment and change a few things at a time. Kind of like wading in
from the shallow end.
Wayne
More information about the PLUG
mailing list