Date: Mon, 30 Jan 2012 00:40:41 +0100 From: Jeroen Hofstee <freebsd_arm@myspectrum.nl> To: freebsd-arm@freebsd.org Cc: tim@kientzle.com Subject: Re: FreeBSD and BeagleBone Message-ID: <4F25D8F9.8040108@myspectrum.nl> In-Reply-To: <AEF07CD1-6794-4F04-AF9C-938423FE919B@kientzle.com> References: <23CB6C35-9450-40BA-9FA3-37C44B328CA8@freebsd.org> <CABt%2Bj0mB4w==h_SQ4YyDM24_wGOjcdZDK9T1N3DqjSkap0VkQw@mail.gmail.com> <E8A24EBE-967D-44F8-A884-3207B3C6F0FE@bsdimp.com> <8042D895-3B3D-431E-ADCC-A150BDC838ED@kientzle.com> <CAGW5k5ahyaTest3L0NTe1t%2B%2BYBgpLMkWZNpp=GRyz%2Bg=nMcZLg@mail.gmail.com> <7E53112E-DE29-4145-B597-D39AA77252C5@kientzle.com> <E1RoGMT-000DkR-6a@groundzero.grondar.org> <AEF07CD1-6794-4F04-AF9C-938423FE919B@kientzle.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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__
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F25D8F9.8040108>