LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Shortcut to compile kernel file ? (https://www.linuxquestions.org/questions/linux-newbie-8/shortcut-to-compile-kernel-file-842515/)

mehdi141 11-05-2010 05:46 AM

Shortcut to compile kernel file ?
 
Dear All,
I hope you all are fine ad doing well,

I become successful to download kernel, compile it and run it.

BUT
When i modify tcp.c file or any other file in this /usr/src/linux/net/ipv4 location, (just modifying c files) i have to compile the complete kernel every time, which is very time consuming procedure.

So Please help, How to compile that net/ipv4 package or etc...

I will be very very thankful to you all... please please guide me..

Mehdi

aluser 11-06-2010 12:53 PM

If you just want to syntax-check your .c file, it looks like you can go to the top of the tree (i.e., /usr/src/linux) and say
Code:

make net/ipv4/tcp.o
I'm not sure what is the minimum you need to do to actually run the code, though.

mehdi141 11-07-2010 05:27 AM

Hello Sir,
First of all Thank you very much for reply. As you mention to compile the tcp.c file like make net/ipv4/tcp.o after modification, Which is working fine and new tcp.o file is created in net/ipv4 location.

But when i run my user level normal server client application [where client sent just hello to server after connecting to server].

So our changes are not effective in the kernel level modification which we have done in net/ipv4/tcp.c file, i verified through printk. But it does not effect.


And when i recompile the whole kernel using [oldconfig , make; make modules; make modules_install; make install and restart of system] so our changes are effective.

My question,is there anyway to just compile the required kernel files which are relevant to network level. net/ipv4

Because proper kernel compilation procedure is to lengthy and time consuming and i am not able to develop any thing...

Please sir, guide me or send me some links or reference. Linux is very new to me...

It will be really highly appericated for guide... Thanks

Mehdi

mehdi141 11-08-2010 12:09 PM

Hello,
Any one who help me ????

theNbomr 11-08-2010 01:23 PM

If the Makefile is set up correctly, it will already do exactly what you are asking for. Make, according to the rules in a Makefile, figures out what does and does not need to be recompiled to build the target(s). In the case of a kernel build, it does have to inspect a lot of stuff to make the determination of what needs to be done to rebuild a kernel. You should be able to use the recursive make structure to build only the kernel module(s) of interest in their own directories, but if the modules affected are built-in modules, you will still have to let make run its course over the whole kernel directory structure.

Once you have built the kernel once, you don't have to repeat the whole configuration process. If you are just modifying modules, then simply do 'make modules', and 'make modules_install'. That's why those targets are in the Makefile.

--- rod.

aluser 11-08-2010 08:02 PM

If the code you're working on is part of a module, you can make just the .ko file, as theNbomr points out, and then rmmod and insmod it. I'm not sure if it's possible to configure tcp.o to land in a module, though.


All times are GMT -5. The time now is 10:06 AM.