From owner-freebsd-arm@FreeBSD.ORG Mon Jan 30 00:07:25 2012 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E36A106566C for ; Mon, 30 Jan 2012 00:07:25 +0000 (UTC) (envelope-from freebsd_arm@myspectrum.nl) Received: from mail.virtualhost.nl (mail.virtualhost.nl [89.200.201.133]) by mx1.freebsd.org (Postfix) with ESMTP id A096C8FC0A for ; Mon, 30 Jan 2012 00:07:24 +0000 (UTC) Received: (qmail 62419 invoked by uid 1141); 30 Jan 2012 00:40:42 +0100 Received: from ip120-12-208-87.adsl2.static.versatel.nl (HELO [192.168.0.6]) (87.208.12.120) (smtp-auth username freebsd_arm@myspectrum.nl, mechanism plain) by mail.virtualhost.nl (qpsmtpd/0.84) with (CAMELLIA256-SHA encrypted) ESMTPSA; Mon, 30 Jan 2012 00:40:42 +0100 Message-ID: <4F25D8F9.8040108@myspectrum.nl> Date: Mon, 30 Jan 2012 00:40:41 +0100 From: Jeroen Hofstee User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:9.0) Gecko/20111229 Thunderbird/9.0 MIME-Version: 1.0 To: freebsd-arm@freebsd.org References: <23CB6C35-9450-40BA-9FA3-37C44B328CA8@freebsd.org> <8042D895-3B3D-431E-ADCC-A150BDC838ED@kientzle.com> <7E53112E-DE29-4145-B597-D39AA77252C5@kientzle.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: tim@kientzle.com Subject: Re: FreeBSD and BeagleBone X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jan 2012 00:07:25 -0000 Hi Tim, On 01/21/12 07:34, Tim Kientzle wrote: > To actually get it to build, I've had to make two changes to U-Boot sources: > * In config.mk, remove "-nostdinc" from CPPFLAGS > * In Makefile, add /usr/arm-freebsd/usr/lib/libc.a to PLATFORM_LIBS > > The first fixes missing stddef.h, stdarg.h headers. (I'm not > sure why the -nostdinc works on Linux.) First of all, the standard c calls are excluded by u-boot on purpose since these might call the operating system which is not there yet... However some macro's, typedefs etc from the headers are of interest (like stdargs, types etc etc). Das U-boot resolves this by including gcc -print-file-name=include (when really needed?) The FreeBSD bootstrap gcc is simply too old to support this command, hence the missing includes. I don't know a workaround for it. > The second is needed to resolve __umodsi3, __udivsi3, etc, > functions. (These might be defined in libgcc on Linux, and > there's some logic here to try to locate libgcc.) I don't know the exact reason for this: - it could be as you suggested, it is in a different lib with GNU libc - or it could be that the FreeBSD bootstrap loader removes it on purpose, for the same reason as u-boot excludes it. FreeBSD provides libc.a afaik, it might therefore exclude it from linking against it from the gcc intended to build the kernel. But as with the includes, only use it to statically link to function which don't use system calls.. Hope this clears things up a bit, Regards, Jeroen patch closer to the GNU/Linux build diff --git a/Makefile b/Makefile index 36246b6..1ec3de3 100644 --- a/Makefile +++ b/Makefile @@ -326,7 +326,7 @@ else PLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc endif else -PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc +PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc -lc endif PLATFORM_LIBS += $(PLATFORM_LIBGCC) export PLATFORM_LIBS diff --git a/config.mk b/config.mk index ddaa477..d6fef21 100644 --- a/config.mk +++ b/config.mk @@ -183,7 +183,8 @@ OPTFLAGS= -Os #-fomit-frame-pointer OBJCFLAGS += --gap-fill=0xff -gccincdir := $(shell $(CC) -print-file-name=include) +# FreeBSD xdev compiler is too old to report include dir.. hardcode instead +gccincdir := "/usr/arm-freebsd/usr/include" CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS) \ -D__KERNEL__