I have a Mac running Snow Leopard and I know that I cannot compile the Linux kernel. I have used a Linux VM (virtualbox) to compile the kernel but I was wondering if I could compile it on Eclipse (galileo).
The info saying you can't build the kernel in Mac is innacurate. One can set up a cross compiler and have x86 as target architecture or build a kernel for power pc as Yellowdog Linux Distro has done. A sample of a procedure to setup a cross compiler for ARM7:
I’m starting a new embedded project with ARM7 processor in March so I wanted to play around with the GNU ARM toolchain. Basically I’m interested in doing cross development on my Macbook Pro on Mac OS X, using a GCC cross compiler together with Eclipse CDT. We’ll see if that works out. ;-)
So as a first step, here is how I built a GNU ARM toolchain on Mac OS X (this should be no different than building the toolchain on Linux):
First download and unpack the necessary packages: binutils, gcc, newlib and gdb.
$ mkdir ~/crossgcc && cd ~/crossgcc $ wget ftp://sourceware.org/pub/binutils/snapshots/binutils-2.18.50.tar.bz2 $ tar jxf binutils-2.18.50.tar.bz2 $ wget http://ftp.gnu.org/pub/gnu/gcc/gcc-4.2.3/gcc-4.2.3.tar.bz2 $ tar jxf gcc-4.2.3.tar.bz2 $ wget ftp://sources.redhat.com/pub/newlib/newlib-1.16.0.tar.gz $ tar zxf newlib-1.16.0.tar.gz $ wget http://ftp.gnu.org/pub/gnu/gdb/gdb-6.6.tar.gz $ tar zxf gdb-6.6.tar.gz
The installation directory should be /usr/local/crossgcc.
$ sudo mkdir /usr/local/crossgcc $ sudo chmod 777 /usr/local/crossgcc
First we build the binutils:
$ mkdir build-binutils && cd build-binutils $ ../binutils-2.18.50/configure --target=arm-elf \ --prefix=/usr/local/crossgcc/ 2>&1 | tee configure.log $ make all install 2>&1 | tee make.log $ export PATH=$PATH:/usr/local/crossgcc/bin
Build the gcc compiler with C/C++ support:
$ cd ../gcc-4.2.3 $ ln -s ../newlib-1.16.0/newlib . $ ln -s ../newlib-1.16.0/libgloss . $ cd .. $ mkdir build-gcc && cd build-gcc $ ../gcc-4.2.3/configure --target=arm-elf \ --prefix=/usr/local/crossgcc/ --with-newlib \ --with-gnu-as --with-gnu-ld --enable-languages=c,c++ 2>&1 | tee configure.log $ make all install 2>&1 | tee make.log
Build the gdb debugger:
$ cd .. $ mkdir build-gdb && cd build-gdb $ ../gdb-6.6/configure --target=arm-elf --prefix=/usr/local/crossgcc/ $ make all install 2>&1 | tee make.log
In your case tou need a cross compiler to whatever target architecture you wan't your kernel to be. Notice as compilation will run nativelly in your machine it will be faster than building on VirtualBox.
As long as you have all of the headers and proper tools, Linux kernels can be compiled on other systems. Using Eclipse would not work well (if at all). In a Linux command-line, type "make config". Configure the options for your kernel that is to be made. Then, read the README file that comes with the source code. It will provide information on compiling and installing. For deep information on the kernel, read this article series (http://www.linux.org/threads/%EF%BB%BFthe-linux-kernel-introduction.4203/).