Hacking linux-kernel 2.6 ************************ Linux kernel 2.6 has decided to work around gcc weirdness and therefore it conflicts with ncc's nognu macros. You'll need to edit some files in include/linux. The following patch is to demonstrate the required changes (if you have gcc3. for another gcc edit the apropriate file(s)). It's best to apply the patch manually. ++++++++++++++++++++++++PATCH TO MAKE NCC WORKING+++++++++++++++ --- kernel.h.orig 2004-11-20 05:31:51.000000000 -0800 +++ kernel.h 2004-11-20 05:32:07.000000000 -0800 @@ -273,6 +273,9 @@ /* Trap pasters of __FUNCTION__ at compile-time */ #if __GNUC__ > 2 || __GNUC_MINOR__ >= 95 +#ifdef __NCC__ +#undef __FUNCTION__ +#endif #define __FUNCTION__ (__func__) #endif --- compiler-gcc3.h.orig 2004-11-20 05:33:41.000000000 -0800 +++ compiler-gcc3.h 2004-11-20 05:35:07.000000000 -0800 @@ -5,8 +5,15 @@ #if __GNUC_MINOR__ >= 1 # define inline inline __attribute__((always_inline)) -# define __inline__ __inline__ __attribute__((always_inline)) -# define __inline __inline __attribute__((always_inline)) +# ifdef __NCC__ +# undef __inline__ +# undef __inline +# define __inline__ inline __attribute__((always_inline)) +# define __inline inline __attribute__((always_inline)) +#else +# define __inline__ __inline__ __attribute__((always_inline)) +# define __inline __inline __attribute__((always_inline)) +#endif #endif #if __GNUC_MINOR__ > 0 ++++++++++++++++++++++++++++END PATCH+++++++++++++++++++++++++++++ Then edit the root Makefile to use ncc HOSTCC = ncc -ncgcc -ncfabs -ncld -ncspp CC = $(CROSS_COMPILE)ncc -ncspp -ncfabs -ncgcc -ncld AR = $(CROSS_COMPILE)nccar LD = $(CROSS_COMPILE)nccld and compile. If all goes well, the file vmlinux.nccout should appear. Then do nccnav vmlinux.nccout to hack it. There is no main in there though! Hacking linux-kernel (2.2.something): ************************************ make menuconfig and select the parts you're interested in, save in alternative makefile. In the top makefile, edit CC=$(CROSS_COMPILE)ncc -ncoo -ncfabs ----------------------------------------- [user @ host] script Script started, file is typescript [user @ host] make dep -f other_makefile; make clean -f other_makefile [user @ host] make -f other_makefile -i zImage [user @ host] exit Script done, file is typescript ----------------------------------------- see the typescript for errors of ncc (seach for 'ncc-error') The output .nccout will be incomplete for files where error occured. Currently there is a rare problem with one rarely used file. Feel free to ignore it as most data is still there. The output can be collected with: find . -name \*.nccout | xargs cat > code.map nccnav * If you use the -ncfabs option, you can write a small program to remove the sourcetree root from the paths in code.map. However, the paths of the header files which are absolute as set by -I options, do NOT use the current working directory, but PWD. The difference is that if the sourcetree is a symbolic link of the real kernel source, the header files have the absolute path of the symbolic link, while the source files the actual absolute path. Change TOPDIR:=$(shell pwd)