Of course, the first question is: why I'm doing this. Just for fun! I'm learning more about Linux kernels and I have a virtual machine that I can replace in 15 minutes.Getting to business, I don't know how to do this, so I went to trying to edit the makefile (trying to learn). So I started with the makefile in the path ubuntu-raring/Makefile, which is the main make file; can be found under this link:http://pastebin.com/ms2WpQi7And there I changed every gcc to icc, and every g++ to icpc, and every -O2 to -O3. The result is the following:http://pastebin.com/cSwTYJ9CI followed the instructions from this site, too:https://help.ubuntu.com/community/Kernel/CompileBut eventually, I'm getting weird errors that seem to be caused by using gcc/g++ rather than icc/icpc. For example, I got an error in the file ubuntu-raring/include/linux/compiler-gcc.h that some macros are already defined, while this file shouldn't be included in the first place! The macro that includes it is in the file ubuntu-raring/include/linux/compiler.h, and looks like:#ifdef __GNUC__#include <linux/compiler-gcc.h>#endif/* Intel compiler defines __GNUC__. So we will overwrite implementations * coming from above header files here */#ifdef __INTEL_COMPILER# include <linux/compiler-intel.h>#endifAnd while I don't understand the comment written above the Intel header (sounds weird... why would you define implementations then overwrite them? Never done that in C++!), removing the include of the gcc header manually solved the problem, but other problems came up, and I have no idea whether they're related.So now I'm confused! What did I do wrong? And should changing every gcc and g++ in the Makefile be sufficient to use a different compiler? Or are there other things to be changed that I overlooked?Thank you for any efforts.
Compile the Ubuntu Raring Kernel with the Intel Compiler
linux;ubuntu;compiling;linux kernel;gcc
First learn to walk, then learn to fly.If you want to learn, read. Have you read this instruction manual for building the kernel with the Intel C compiler? It's a rethorical question b/c this manual uses a different approach to choosing icc over gcc.You are doing three things at once:fiddle with some adopted and patched kernel to fit into the Ubuntu world (which is gcc)Up the optimization from -O2 to -O3.change the compilerStart out with a vanilla Linux kernel from kernel.org. Keep everything standard and figure out how to build a kernel that works for your computer. Build a kernel that has only the drivers your computer needs, nothing more. Once you can compile and boot into your own kernel, you can start changing the build environment.Going from -O2 to -O3 will probably never work. -O3 is like opening Pandora's box. If enabling -O3 was that easy, it would probably be the default!