From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeroen Hofstee Date: Tue, 10 Feb 2015 00:20:49 +0100 Subject: [U-Boot] sandbox on FreeBSD In-Reply-To: References: <54D27501.7040304@myspectrum.nl> <54D3C9D1.6030905@myspectrum.nl> <54D51C5F.7090500@myspectrum.nl> <54D526DB.6080303@googlemail.com> <54D5E332.50401@myspectrum.nl> Message-ID: <54D940D1.1050507@myspectrum.nl> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hello Simon, On 02/07/15 16:10, Simon Glass wrote: > >> >> I am not giving up, I think it is sane if a tool which adds a header and >> a checksum does not use linker magic. Sandbox biggest problem is >> not the linking, but the fact that linux headers and std* are included, >> it is a different topic. > This should be easy to fix in os.c since all the inclusions are > isolated to there. I'd been keen to see a patch for that. Also if you > want LCD support, sdl.c. I had a look at this and hacked my way through and linked it with a GNU ld (GNU Binutils) 2.25. So at least I have a binary, but unfortunately it doesn't work, and errors out with: Fatal error 'Can't allocate initial thread' at line 350 in file /usr/src/lib/libthr/thread/thr_init.c (errno = 2) The reason for this seems to be void _thread_init_hack(void) __attribute__ ((constructor)); which calls _libpthread_init -> _thr_alloc -> calloc and that calls the version in u-boots version of dl-malloc which is not initialized yet. Did you encounter such problems on linux as well? Or does libpthread simply not allocate memory before reaching main? Regards, Jeroen ldd ../u-boot-build/u-boot ../u-boot-build/u-boot: librt.so.1 => /usr/lib/librt.so.1 (0x800896000) libSDL-1.2.so.0 => /usr/local/lib/libSDL-1.2.so.0 (0x800a9c000) libthr.so.3 => /lib/libthr.so.3 (0x800d02000) libc.so.7 => /lib/libc.so.7 (0x800f27000) libm.so.5 => /lib/libm.so.5 (0x8012d0000) libvgl.so.6 => /usr/lib/libvgl.so.6 (0x8014f8000) libaa.so.1 => /usr/local/lib/libaa.so.1 (0x801701000) libusbhid.so.4 => /usr/lib/libusbhid.so.4 (0x801919000) libncurses.so.8 => /lib/libncurses.so.8 (0x801b1d000)