Author: stepan Date: 2007-07-17 00:42:21 +0200 (Tue, 17 Jul 2007) New Revision: 456
Modified: LinuxBIOSv3/HACKING LinuxBIOSv3/Makefile LinuxBIOSv3/util/dtc/data.c LinuxBIOSv3/util/dtc/dtc.h LinuxBIOSv3/util/dtc/flattree.c LinuxBIOSv3/util/dtc/ftdump.c LinuxBIOSv3/util/dtc/libdt.c LinuxBIOSv3/util/kconfig/Makefile LinuxBIOSv3/util/xcompile/xcompile Log: This patch fixes compilation on OS X
Signed-off-by: Stefan Reinauer stepan@coresystems.de Acked-by: Uwe Hermann uwe@hermann-uwe.de
Modified: LinuxBIOSv3/HACKING =================================================================== --- LinuxBIOSv3/HACKING 2007-07-16 20:34:47 UTC (rev 455) +++ LinuxBIOSv3/HACKING 2007-07-16 22:42:21 UTC (rev 456) @@ -32,7 +32,19 @@ * dot (>= 1.8.10) http://www.graphviz.org/
+Building on Mac OS X +-------------------
+You have to install MacPorts (tried with 1.4). + +Then you go + + $ sudo port install gettext + $ sudo port install bison + $ sudo port install i386-elf-binutils + $ sudo port install i386-elf-gcc + $ rehash + Third-party Code and License Overview -------------------------------------
Modified: LinuxBIOSv3/Makefile =================================================================== --- LinuxBIOSv3/Makefile 2007-07-16 20:34:47 UTC (rev 455) +++ LinuxBIOSv3/Makefile 2007-07-16 22:42:21 UTC (rev 456) @@ -96,6 +96,8 @@ AS := $(AS_$(ARCH)) LD := $(LD_$(ARCH)) OBJCOPY := $(OBJCOPY_$(ARCH)) +AR := $(AR_$(ARCH)) + CFLAGS += $(CFLAGS_$(ARCH))
CPPFLAGS := $(LINUXBIOSINCLUDE) @@ -144,7 +146,7 @@ $(Q)printf "#define LINUXBIOS_COMPILE_TIME "`LANG= date +%T`"\n" >> $(obj)/build.h $(Q)printf "#define LINUXBIOS_COMPILE_BY "$(shell PATH=$$PATH:/usr/ucb whoami)"\n" >> $(obj)/build.h $(Q)printf "#define LINUXBIOS_COMPILE_HOST "$(shell hostname)"\n" >> $(obj)/build.h - $(Q)printf "#define LINUXBIOS_COMPILE_DOMAIN "$(shell which dnsdomainname 1>/dev/null && dnsdomainname || domainname)"\n" >> $(obj)/build.h + $(Q)printf "#define LINUXBIOS_COMPILE_DOMAIN "$(shell test `uname -s` == "Linux" && dnsdomainname || domainname)"\n" >> $(obj)/build.h
clean: $(Q)printf " CLEAN $(subst $(shell pwd)/,,$(obj))\n"
Modified: LinuxBIOSv3/util/dtc/data.c =================================================================== --- LinuxBIOSv3/util/dtc/data.c 2007-07-16 20:34:47 UTC (rev 455) +++ LinuxBIOSv3/util/dtc/data.c 2007-07-16 22:42:21 UTC (rev 456) @@ -237,7 +237,7 @@
struct data data_append_align(struct data d, int align) { - int newlen = ALIGN(d.len, align); + int newlen = DALIGN(d.len, align); return data_append_zeroes(d, newlen - d.len); }
Modified: LinuxBIOSv3/util/dtc/dtc.h =================================================================== --- LinuxBIOSv3/util/dtc/dtc.h 2007-07-16 20:34:47 UTC (rev 455) +++ LinuxBIOSv3/util/dtc/dtc.h 2007-07-16 22:42:21 UTC (rev 456) @@ -90,7 +90,7 @@ #define streq(a, b) (strcmp((char *)(a), (char *)(b)) == 0) #define strneq(a, b, n) (strncmp((char *)(a), (char *)(b), (n)) == 0)
-#define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1)) +#define DALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1)) #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
/* Data blobs */
Modified: LinuxBIOSv3/util/dtc/flattree.c =================================================================== --- LinuxBIOSv3/util/dtc/flattree.c 2007-07-16 20:34:47 UTC (rev 455) +++ LinuxBIOSv3/util/dtc/flattree.c 2007-07-16 22:42:21 UTC (rev 456) @@ -960,7 +960,7 @@ bph->last_comp_version = cpu_to_be32(vi->last_comp_version);
/* Reserve map should be doubleword aligned */ - reserve_off = ALIGN(vi->hdr_size, 8); + reserve_off = DALIGN(vi->hdr_size, 8);
bph->off_mem_rsvmap = cpu_to_be32(reserve_off); bph->off_dt_struct = cpu_to_be32(reserve_off + reservesize); @@ -1395,7 +1395,7 @@ { int off = inb->ptr - inb->base;
- inb->ptr = inb->base + ALIGN(off, align); + inb->ptr = inb->base + DALIGN(off, align); if (inb->ptr > inb->limit) die("Premature end of data parsing flat device tree\n"); }
Modified: LinuxBIOSv3/util/dtc/ftdump.c =================================================================== --- LinuxBIOSv3/util/dtc/ftdump.c 2007-07-16 20:34:47 UTC (rev 455) +++ LinuxBIOSv3/util/dtc/ftdump.c 2007-07-16 22:42:21 UTC (rev 456) @@ -25,8 +25,8 @@ #define be64_to_cpu(x) bswap_64(x) #endif
-#define ALIGN(x, a) (((x) + ((a) - 1)) & ~((a) - 1)) -#define PALIGN(p, a) ((void *)(ALIGN((unsigned long)(p), (a)))) +#define DALIGN(x, a) (((x) + ((a) - 1)) & ~((a) - 1)) +#define PALIGN(p, a) ((void *)(DALIGN((unsigned long)(p), (a)))) #define GET_CELL(p) (p += 4, *((uint32_t *)(p-4)))
static int is_printable_string(const void *data, int len)
Modified: LinuxBIOSv3/util/dtc/libdt.c =================================================================== --- LinuxBIOSv3/util/dtc/libdt.c 2007-07-16 20:34:47 UTC (rev 455) +++ LinuxBIOSv3/util/dtc/libdt.c 2007-07-16 22:42:21 UTC (rev 456) @@ -23,8 +23,8 @@
#include "flat_dt.h"
-#define ALIGN(x, a) (((x) + ((a) - 1)) & ~((a) - 1)) -#define PALIGN(p, a) ((void *)(ALIGN((unsigned long)(p), (a)))) +#define DALIGN(x, a) (((x) + ((a) - 1)) & ~((a) - 1)) +#define PALIGN(p, a) ((void *)(DALIGN((unsigned long)(p), (a)))) #define GET_CELL(p) (p += 4, *((uint32_t *)(p-4)))
static char *skip_name(char *p)
Modified: LinuxBIOSv3/util/kconfig/Makefile =================================================================== --- LinuxBIOSv3/util/kconfig/Makefile 2007-07-16 20:34:47 UTC (rev 455) +++ LinuxBIOSv3/util/kconfig/Makefile 2007-07-16 22:42:21 UTC (rev 456) @@ -102,7 +102,7 @@
$(obj)/util/kconfig/mconf: $(patsubst %,$(obj)/util/kconfig/%,$(mconf-objects)) $(Q)printf " HOSTCC $(subst $(shell pwd)/,,$(@))\n" - $(Q)$(HOSTCC) $(CURSESLIBS) -o $@ $^ + $(Q)$(HOSTCC) $(CURSESLIBS) $(INTLLIBS) -o $@ $^
$(obj)/util/kconfig/conf: $(patsubst %,$(obj)/util/kconfig/%,$(conf-objects)) $(Q)printf " HOSTCC $(subst $(shell pwd)/,,$(@))\n" @@ -121,17 +121,17 @@ $(obj)/util/kconfig/mconf.o: $(src)/util/kconfig/mconf.c $(Q)mkdir -p $(obj)/util/kconfig $(Q)printf " HOSTCC $(subst $(shell pwd)/,,$(@))\n" - $(Q)$(HOSTCC) -I$(src)/util/kconfig -c -o $@ $< + $(Q)$(HOSTCC) $(HOSTCFLAGS) $(INTLCFLAGS) -I$(src)/util/kconfig -c -o $@ $<
$(obj)/util/kconfig/conf.o: $(src)/util/kconfig/conf.c $(Q)mkdir -p $(obj)/util/kconfig $(Q)printf " HOSTCC $(subst $(shell pwd)/,,$(@))\n" - $(Q)$(HOSTCC) -I$(src)/util/kconfig -c -o $@ $< + $(Q)$(HOSTCC) $(HOSTCFLAGS) -I$(src)/util/kconfig -c -o $@ $<
$(obj)/util/kconfig/kconfig_load.o: $(src)/util/kconfig/kconfig_load.c $(Q)mkdir -p $(obj)/util/kconfig $(Q)printf " HOSTCC $(subst $(shell pwd)/,,$(@))\n" - $(Q)$(HOSTCC) -I$(obj)/util/kconfig -I$(src)/util/kconfig -c -o $@ $< + $(Q)$(HOSTCC) $(HOSTCFLAGS) -I$(obj)/util/kconfig -I$(src)/util/kconfig -c -o $@ $<
$(obj)/util/kconfig/qconf.o: $(src)/util/kconfig/qconf.cc $(obj)/util/kconfig/qconf.moc $(obj)/util/kconfig/lkc_defs.h $(Q)mkdir -p $(obj)/util/kconfig @@ -142,7 +142,7 @@ $(obj)/util/kconfig/gconf.o: $(src)/util/kconfig/gconf.c $(obj)/util/kconfig/lkc_defs.h $(Q)mkdir -p $(obj)/util/kconfig $(Q)printf " HOSTCC $(subst $(shell pwd)/,,$(@))\n" - $(Q)$(HOSTCC) `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ + $(Q)$(HOSTCC) $(HOSTCFLAGS) `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ -D LKC_DIRECT_LINK -I$(obj) -I$(src)/util/kconfig -c -o $@ $<
$(obj)/util/kconfig/%.moc: $(src)/util/kconfig/%.h @@ -158,7 +158,7 @@ $(obj)/util/kconfig/zconf.tab.o: $(obj)/util/kconfig/zconf.tab.c $(obj)/util/kconfig/zconf.hash.c $(obj)/util/kconfig/lex.zconf.c $(Q)mkdir -p $(obj)/util/kconfig $(Q)printf " HOSTCC $(subst $(shell pwd)/,,$(@))\n" - $(Q)$(HOSTCC) -I$(src)/util/kconfig -c -o $@ $(obj)/util/kconfig/zconf.tab.c + $(Q)$(HOSTCC) $(HOSTCFLAGS) $(INTLCFLAGS) -I$(src)/util/kconfig -c -o $@ $(obj)/util/kconfig/zconf.tab.c
$(obj)/util/kconfig/lex.zconf.c: $(src)/util/kconfig/lex.zconf.c_shipped $(Q)mkdir -p $(obj)/util/kconfig
Modified: LinuxBIOSv3/util/xcompile/xcompile =================================================================== --- LinuxBIOSv3/util/xcompile/xcompile 2007-07-16 20:34:47 UTC (rev 455) +++ LinuxBIOSv3/util/xcompile/xcompile 2007-07-16 22:42:21 UTC (rev 456) @@ -25,6 +25,8 @@ -e s/s390x/s390/ -e s/parisc64/parisc/ \ -e s/ppc.*/powerpc/ -e s/mips.*/mips/`
+OS=`uname -s` + testcc() { TMP=".$$$$.tmp" @@ -56,22 +58,40 @@ echo "CC_x86 := gcc -m32" CC="gcc -m32"
+ searchgnu ar >/dev/null && echo "AR_x86 := $(searchgnu ar)" searchgnu as >/dev/null && echo "AS_x86 := $(searchgnu as) --32" searchgnu ld >/dev/null && echo "LD_x86 := $(searchgnu ld) -b elf32-i386 -melf_i386" searchgnu objcopy >/dev/null && echo "OBJCOPY_x86 := $(searchgnu objcopy)" ;; "x86") - echo "CC_x86 := gcc" - CC="gcc" + if [ "$OS" != "Darwin" ]; then + echo "CC_x86 := gcc" + CC="gcc"
- searchgnu as >/dev/null && echo "AS_x86 := $(searchgnu as)" - searchgnu ld >/dev/null && echo "LD_x86 := $(searchgnu ld)" - searchgnu objcopy >/dev/null && echo "OBJCOPY_x86 := $(searchgnu objcopy)" + searchgnu ar >/dev/null && echo "AR_x86 := $(searchgnu ar)" + searchgnu as >/dev/null && echo "AS_x86 := $(searchgnu as)" + searchgnu ld >/dev/null && echo "LD_x86 := $(searchgnu ld)" + searchgnu objcopy >/dev/null && echo "OBJCOPY_x86 := $(searchgnu objcopy)" + else + CC=`find /opt/local/bin/ -name "i386-elf-gcc-*"` + if [ "$CC" == "" ]; then + echo "ERROR: Please install i386-elf-gcc from MacPorts" >&2 + exit 1 + fi + echo "CC_x86 := $CC" + echo "AR_x86 := i386-elf-ar" + echo "AS_x86 := i386-elf-as" + echo "LD_x86 := i386-elf-ld" + echo "OBJCOPY_x86 := i386-elf-objcopy" + echo "INTLCFLAGS := -I/opt/local/include" + echo "INTLLIBS := -L/opt/local/lib -lintl" + fi ;; *) # FIXME: This should be detected. CC="i386-linux-gcc" echo "CC_x86 := i386-linux-gcc" + echo "AR_x86 := i386-linux-ar" echo "AS_x86 := i386-linux-as" echo "LD_x86 := i386-linux-ld" echo "OBJCOPY_x86 := i386-linux-objcopy"