You need to find where MacOSX has their elf defs, on OpenBSD it is elf_abi.h, and then you need to get som machdep relocs defined as well.
i can show my kludgey current patches (not of quality i'd normally submit, but since you seem to be in urgent need..) Let's hope this web form mailer does not destroy the diff. Just tell me to resend it from my normal mail program otherwise. niklas project kernel/ diff --git a/Makefile b/Makefile index 39516bf..7d160da 100644 --- a/Makefile +++ b/Makefile @@ -863,7 +863,7 @@ $(vmlinux-dirs): prepare scripts pattern = ".*/localversion[^~]*" string = $(shell cat /dev/null \ - `find $(objtree) $(srctree) -maxdepth 1 -regex $(pattern) | sort - u`) + `find $(objtree) $(srctree) -maxdepth 1 | grep $(pattern) | sort - u`) localver = $(subst $(space),, $(string) \ $(patsubst "%",%,$(CONFIG_LOCALVERSION))) diff --git a/scripts/mod/mk_elfconfig.c b/scripts/mod/mk_elfconfig.c index db3881f..10164ae 100644 --- a/scripts/mod/mk_elfconfig.c +++ b/scripts/mod/mk_elfconfig.c @@ -1,7 +1,11 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#ifdef __OpenBSD__ +#include <elf_abi.h> +#else #include <elf.h> +#endif int main(int argc, char **argv) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 110cf24..f6afca3 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -1286,6 +1286,7 @@ static int addend_386_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) unsigned int *location = reloc_location(elf, sechdr, r); switch (r_typ) { +#if 0 case R_386_32: r->r_addend = TO_NATIVE(*location); break; @@ -1295,6 +1296,7 @@ static int addend_386_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) if (elf->hdr->e_type == ET_EXEC) r->r_addend += r->r_offset; break; +#endif } return 0; } @@ -1327,10 +1329,13 @@ static int addend_mips_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) unsigned int *location = reloc_location(elf, sechdr, r); unsigned int inst; +#if 0 if (r_typ == R_MIPS_HI16) return 1; /* skip this */ +#endif inst = TO_NATIVE(*location); switch (r_typ) { +#if 0 case R_MIPS_LO16: r->r_addend = inst & 0xffff; break; @@ -1340,6 +1345,7 @@ static int addend_mips_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) case R_MIPS_32: r->r_addend = inst; break; +#endif } return 0; } diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h index 09f58e3..f44702e 100644 --- a/scripts/mod/modpost.h +++ b/scripts/mod/modpost.h @@ -7,10 +7,39 @@ #include <sys/mman.h> #include <fcntl.h> #include <unistd.h> +#ifdef __OpenBSD__ +#if KERNEL_ELFCLASS == ELFCLASS32 +#define ELFSIZE 32 +#else +#define ELFSIZE 64 +#endif +#include <elf_abi.h> +/* Processor specific relocation types */ + +#define R_ARM_NONE 0 +#define R_ARM_PC24 1 +#define R_ARM_ABS32 2 +#define R_ARM_REL32 3 +#define R_ARM_PC13 4 +#define R_ARM_ABS16 5 +#define R_ARM_ABS12 6 +#define R_ARM_THM_ABS5 7 +#define R_ARM_ABS8 8 +#define R_ARM_SBREL32 9 +#define R_ARM_THM_PC22 10 +#define R_ARM_THM_PC8 11 +#define R_ARM_AMP_VCALL9 12 +#define R_ARM_SWI24 13 +#define R_ARM_THM_SWI8 14 +#define R_ARM_XPC25 15 +#define R_ARM_THM_XPC22 16 +#else #include <elf.h> +#endif #include "elfconfig.h" +#ifndef __OpenBSD__ #if KERNEL_ELFCLASS == ELFCLASS32 #define Elf_Ehdr Elf32_Ehdr @@ -42,6 +71,15 @@ #define ELF_R_SYM ELF64_R_SYM #define ELF_R_TYPE ELF64_R_TYPE #endif +#else +#if KERNEL_ELFCLASS == ELFCLASS32 +#define Elf_Section Elf32_Half +#define Elf_Rela Elf32_Rela +#else +#define Elf_Section Elf64_Half +#define Elf_Rela Elf64_Rela +#endif +#endif /* The 64-bit MIPS ELF ABI uses an unusual reloc format. */ typedef struct diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c index d9cc690..95a7a00 100644 --- a/scripts/mod/sumversion.c +++ b/scripts/mod/sumversion.c @@ -1,3 +1,4 @@ +#include <sys/types.h> #include <netinet/in.h> #ifdef __sun__ #include <inttypes.h> On Dec 21, 9:41 am, FrankMaker <frank.ma...@gmail.com> 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 articlehttp://lkml.org/lkml/2008/4/28/460pointed 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 -~----------~----~----~----~------~----~------~--~---