...making Linux just a little more fun!
Good day!
I am adding new variables to the tcp header(tcp.h) of the linux kernel and reflect this changes to the source code .Kindly shed light to my confusions below:
1. Do I have to recompile the whole kernel to reflect the changes in the header files and source code(i.e., tcp.c, tcp_input.c, etc)?
2. If so, what are the necessary steps involved( i.e., re-compile process) to reflect the new variables I added to the header file and the source codes?
3. Thank you very much in advance for the support.
Cheers,
Dom
René Pfeiffer [lynx at luchs.at]
Hello, Domingo!
On Jun 11, 2008 at 1523 +0930, Ignacio, Domingo Jr Ostria - igndo001 appear= ed and said:
> [...] > I am adding new variables to the tcp header(tcp.h) of the linux > kernel and reflect this changes to the source code .Kindly shed light > to my confusions below: > 1. Do I have to recompile the whole kernel to reflect the changes > in the header files and source code(i.e., tcp.c, tcp_input.c, etc)? > 2. If so, what are the necessary steps involved( i.e., re-compile > process) to reflect the new variables I added to the header file and > the source codes?
The Linux kernel has its own build system which takes care of all the dependencies. I usually do the following:
1. Get the source and unpack it. 2. Enter the top level directory of the source tree. 3. "make mrproper" (only if you use the tree for the first time or want to reset everything) 4. "make oldconfig" (this checks your current kernel configuration against updated settings, probably only availabe when you have the config... files for your running kernel in /boot/). 5. "make menuconfig" or "make xconfig" - this presents you with the dependency menu where you can tell the build process what to include and what to leave out. 6. make
Since the steps up to 4 are only necessary when you start, the make at step 6 will always build everything that needs to be rebuild.
Installing is done by:
7. make modules_install 8. make install
Step 7 will copy all modules to /lib/modules/, step 8 will copy everything into /boot/. Make sure you adjust your bootloader configuration to use the new kernel (either /etc/lilo.conf or /boot/grub/menu.lst).
Best, René.
Hi Rene,
Thank you very much for the response. I already installed the rpm kernel source and build it(when I asked before how to get the .c files). My kernel is already up and running. My problem now is that I added a specific variable into the tcp.h header file and I wanted it to be reflected and saved into the kernel. I saved the changes but is it enough process or do I need to do other things like rebuilding the kernel, etc. for this change to be saved into my kernel so that the next time I run it, the new tcp.h header file will be used instead of the old one.
Thank you very much in advance for the help.
Cheers,
Dom
Ben Okopnik [ben at linuxgazette.net]
On Wed, Jun 11, 2008 at 03:23:44PM +0930, Ignacio, Domingo Jr Ostria - igndo001 wrote:
> Hello guys, > > Good day! > > I am adding new variables to the tcp header(tcp.h) of the linux kernel > and reflect this changes to the source code .Kindly shed light to my > confusions below: > > 1. Do I have to recompile the whole kernel to reflect the changes in > the header files and source code(i.e., tcp.c, tcp_input.c, etc)?
Some modules are essentially "stand-alone" - e.g., they don't require any changes to be made in the kernel - and can be recompiled simply by changing the code in the source file and running 'make' in the directory where they live. 'tcp.c' is usually not such a module - it would make no sense to have it as insertable code rather than being compiled into the kernel - and so the answer is yes, you do need to recompile the kernel. Fortunately, if you're only changing that one bit of code, that recompilation should be relatively short.
> 2. If so, what are the necessary steps involved( i.e., re-compile > process) to reflect the new variables I added to the header file and the > source codes?
This is documented in your '/usr/src/linux/README' (there's a reason that file has that name... in the 'COMPILING the kernel' section. In short, you need to run some of the following:
make dep # If you're not sure that all the dependencies are right make clean # If you want to start from scratch - which you don't make bzImage # This is the place to start for you! make modules # Fairly obvious... make install # This will install the new kernel; options for 'lilo', etc.
-- * Ben Okopnik * Editor-in-Chief, Linux Gazette * http://LinuxGazette.NET *
Hello guys,
Thank you for the response.
I already read the "README" file and follow it to recompile the tcp_input.c code with changes in it. I went to the specified directory and do the recompiling there. I followed the recompiling steps and when I typed: MAKE, I received an error saying " make: * No targets. Stop". I don't know if I missed something out here. Please help... Note: Only the makefile and the kconfig file is within the directory..
Thank you very much in advance.
Cheers,
dom
Ben Okopnik [ben at linuxgazette.net]
On Thu, Jun 12, 2008 at 04:12:10PM +0930, Ignacio, Domingo Jr Ostria - igndo001 wrote:
>[ snipping the part where Dom quotes my entire reply, headers and all ]
> Hello guys, > > Thank you for the response. > I already read the "README" file and follow it to recompile the > tcp_input.c code with changes in it. I went to the specified directory > and do the recompiling there. I followed the recompiling steps and when > I typed: MAKE, I received an error saying " make: * No targets. Stop".
In fact, you did not type 'MAKE'. If you had, you'd get an error saying "MAKE: command not found". Perhaps you typed 'make'? (Hint: quoting the exact input that you entered and the exact errors you received - hopefully by copying and pasting - is the Right Thing. Retyping them and allowing transcription errors to happen is the Wrong Thing.)
> I don't know if I missed something out here. Please help... Note: Only > the makefile and the kconfig file is within the directory.. > > Thank you very much in advance.
1) Please don't quote the entire email you're responding to. We all know what we've said, and if we happen to forget, then archives exist for a reason.
2) Please READ the replies sent to you instead of just blindly banging on the keyboard and then asking questions that have just been answered. In particular, I suggest that you re-read the reply that I sent you and that you have just replied to: it covers the exact situation you're asking about.
-- * Ben Okopnik * Editor-in-Chief, Linux Gazette * http://LinuxGazette.NET *