LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Kernel Compilation (https://www.linuxquestions.org/questions/linux-newbie-8/kernel-compilation-790977/)

ravishekhar.82 02-23-2010 05:39 AM

Kernel Compilation
 
Hi,

I am using Fedora 11 and recently I compiled kernel 2.6.32.8. I was trying to make some change in the kernel and I have included #include<linux/mmzone.h. file . But when I tried to compile it gives "No such file or directory". I checked that this file is not in /usr/include/linux but it is there in /usr/src/linux-2.6.32.8/include/linux. I getting same error for some other header file too.
I have not idea what to do it to make. I do not want to give full path. Suggest what to do.

shpenat 02-23-2010 05:44 AM

please indicate where did you included that file (which file you modified).

generally #include<file> will search for file in standard directories whereas #include"file" will start from current directory

ravishekhar.82 02-23-2010 05:54 AM

I have created a new directory in "/usr/src/linux-2.6.32.8/lib/new". In this directory my header file is there which is using the header files
<asm/types.h>, <linux/init.h>, <linux/kmemtrace.h> etc ...

shpenat 02-23-2010 09:50 AM

I still dont understand what you are trying to do. When you unpack kernel tarball you get linux-2.6.x.x directory with lots of stuff in it. Makefile then expects to find files in exactly same position as they were unpacked. So if you move some of the files or modified them the build process will ultimately fail. You need to modify makefile accordingly. That if work for Linux gurus which I am definitely not.

So please indicate what exactly you want to do and maybe someone will be able to help.

ravishekhar.82 02-24-2010 12:47 AM

Okay let me put the question in this way.

When there is a header file say <linux/xyz.h> then how system finds the header file.

My problem is that this header file <linux/xyz.h> is not in original /usr/include/linux but it is present at /usr/src/linux-2.6.32.8/include/linux. I want header files to be taken from the new location too.

In which all files I have to make changes. Do I have to create certain rule for this.

Please suggest.

shpenat 02-24-2010 03:00 AM

Which headers are included is influenced by parameters during compilation. Parameter -I followed by path specify, where gcc looks for header files before it searches standard path.

So check your makefile. If it contains -I./include parameter then it first searches "/usr/src/linux-2.6.32.8/include" and then "/usr/include"
But I am sure kernel developers are not stupid and included this parameter into compilation process, so the headers provided alongside with kernel are used.

i92guboj 02-24-2010 03:15 AM

Since the linux kernel is based on Makefiles, that's what you should be looking at. As someone else said above. I can't say much more without knowing what are you exactly doing and what exact changes did you do to the kernel source tree.

However, instead of modifying the well probed and studied kernel tree structure, I'd rather suggest you to copy the full tree to a given alternate location, and work on that separate tree, instead of doing overly complicated things or nesting trees like I think you are doing. That will also allow you to easily make a diff later if you want to make a patch.


All times are GMT -5. The time now is 11:06 PM.