I finally was able to compile the Android kernel on OSX, here are the steps as best I remember them:
1) You need to obtain a copy of elf.h because OSX uses Mach-O format, not Elf and therefore there is no elf header. 2) Comment out #include <features.h> because it is not needed and not available as well 3) Install an arm-elf toolchain, I used Macports to do this: sudo port install arm-elf-gcc 4) make goldfish_defconfig ARCH=arm # Copies goldfish config to your .config 5) make ARCH=arm CROSS_COMPILE=arm-elf- If you want to use 'make menuconfig': 1) Make sure ncurses library is installed (Can be done through Macports) 1) Comment out the "exit 1" in scripts/kconfig/lxdialog/check- lxdialog.sh so the ncurses check does not fail Build Errors: * If you get something about an error with i686 or x68, you probably forgot ARCH=arm * If you get the error NOT AN ELF FILE, then you are probably using the Apple GCC compile which outputs MACH-O files, and you should be using a ARM-ELF cross compiler instead. * Another potential problem is if you are not using a GCC compiler >3.3(?) Frank Maker Graduate Student Researcher University of California, Davis Micropower Circuits and Systems Group (MCSG) flma...@ece.ucdavis.edu On Dec 21, 2008, at 12:41 AM, FrankMaker wrote: > > Has anyone been able to do kernel development on OSX? I'm trying to > build a kernel with debugging enabled. The Android documentation makes > Darwin/OSX sound like it is fully supported, but I'm running into a > lot of problems that make me suspect either I'm doing this the hard > way or the rest of the Android kernel hackers are using Linux perhaps. > > When I tried to run 'make menuconfig" I received the following error: > > $ make menuconfig > *** Unable to find the ncurses libraries or the > *** required header files. > *** 'make menuconfig' requires the ncurses libraries. > *** > *** Install ncurses (ncurses-devel) and try again. > *** > make[1]: *** [scripts/kconfig/dochecklxdialog] Error 1 > make: *** [menuconfig] Error 2 > > This article http://lkml.org/lkml/2008/4/28/460 pointed out that OSX's > echo does not jive well with the kernel script: > > myandroid/kernel/scripts/kconfig/lxdialog > > After commenting out the error, I was able to get menuconfig to run: > > #exit 1 > > However, when I try to build the kernel I got another error about my > version of sed: > > sed: 4: "/^\#define/ { s/[^_]*__ ...": bad flag in substitute > command: '}' > > This I was able to avert by using Fink to install the GNU version of > sed. > > Now I'm stuck with the following build errors: > > In file included from include/linux/compiler-gcc4.h:6, > from include/linux/compiler.h:40, > from include/asm/atomic_32.h:4, > from include/asm/atomic.h:2, > from include/linux/crypto.h:20, > from arch/x86/kernel/asm-offsets_32.c:7, > from arch/x86/kernel/asm-offsets.c:2: > include/linux/compiler-gcc.h:36:1: warning: "__weak" redefined > <built-in>:1:1: warning: this is the location of the previous > definition > GEN include/asm-x86/asm-offsets.h > CALL scripts/checksyscalls.sh > sed: 4: "/^\#define/ { s/[^_]*__ ...": bad flag in substitute command: > '}' > CC scripts/mod/empty.o > HOSTCC scripts/mod/mk_elfconfig > scripts/mod/mk_elfconfig.c:4:17: error: elf.h: No such file or > directory > scripts/mod/mk_elfconfig.c: In function ‘main’: > scripts/mod/mk_elfconfig.c:9: error: ‘EI_NIDENT’ undeclared (first use > in this function) > scripts/mod/mk_elfconfig.c:9: error: (Each undeclared identifier is > reported only once > scripts/mod/mk_elfconfig.c:9: error: for each function it appears in.) > scripts/mod/mk_elfconfig.c:19: error: ‘ELFMAG’ undeclared (first use > in this function) > scripts/mod/mk_elfconfig.c:19: error: ‘SELFMAG’ undeclared (first use > in this function) > scripts/mod/mk_elfconfig.c:23: error: ‘EI_CLASS’ undeclared (first use > in this function) > scripts/mod/mk_elfconfig.c:24: error: ‘ELFCLASS32’ undeclared (first > use in this function) > scripts/mod/mk_elfconfig.c:27: error: ‘ELFCLASS64’ undeclared (first > use in this function) > scripts/mod/mk_elfconfig.c:33: error: ‘EI_DATA’ undeclared (first use > in this function) > scripts/mod/mk_elfconfig.c:34: error: ‘ELFDATA2LSB’ undeclared (first > use in this function) > scripts/mod/mk_elfconfig.c:37: error: ‘ELFDATA2MSB’ undeclared (first > use in this function) > scripts/mod/mk_elfconfig.c:9: warning: unused variable ‘ei’ > make[2]: *** [scripts/mod/mk_elfconfig] Error 1 > make[1]: *** [scripts/mod] Error 2 > make: *** [scripts] Error 2 > > > > --~--~---------~--~----~------------~-------~--~----~ unsubscribe: android-kernel+unsubscr...@googlegroups.com website: http://groups.google.com/group/android-kernel -~----------~----~----~----~------~----~------~--~---