[U-Boot] recent tools on FreeBSD

Simon Glass sjg at chromium.org
Sat Feb 7 16:10:30 CET 2015


Hi Jeroen,

On 7 February 2015 at 03:04, Jeroen Hofstee <jeroen at myspectrum.nl> wrote:
> Hi Simon,
>
> On 06-02-15 22:00, Simon Glass wrote:
>>
>> Hi,
>>
>> On 6 February 2015 at 13:40, Andreas Bießmann
>> <andreas.devel at googlemail.com> wrote:
>>>
>>> Hi,
>>>
>>> On 06.02.15 20:56, Jeroen Hofstee wrote:
>>>>
>>>> Hello Simon, +Andreas,
>>>>
>>>> On 06-02-15 04:05, Simon Glass wrote:
>>>>>
>>>>> Hi Jeroen,
>>>>>
>>>>> On 5 February 2015 at 12:51, Jeroen Hofstee<jeroen at myspectrum.nl>
>>>>> wrote:
>>>>>>
>>>>>> Hello Guilherme,
>>>>>>
>>>>>> Thanks for commenting on this,
>>>>>>
>>>>>> On 02/05/15 13:27, Guilherme Maciel Ferreira wrote:
>>>>>>>
>>>>>>> Hi Jeroen,
>>>>>>>
>>>>>>> My apologies, I didn't test the tools on BSD. The answers are inline.
>>>>>>>
>>>>>>> Best regards,
>>>>>>> Guilherme
>>>>>>>
>>>>>>> Am 04.02.2015 19:37 schrieb "Jeroen Hofstee"<jeroen at myspectrum.nl>:
>>>>
>>>> Regarding the linking problem, there is nothing special about FreeBSD
>>>> ld,
>>>> it just is based on a version which has no idea what INSERT BEFORE .data
>>>> means.
>>>>
>>>> there are several option I guess (not tested):
>>>> 1) include a complete linker script so INSERT BEFORE .data is not needed
>>>> 2) teach FreeBSD ld what INSERT BEFORE .data is supposed to mean
>>>> 3) don't use linker magic in tools (and use a linux box for sandbox, at
>>>> least for now)
>>>>
>>>> 1) sounds like a bad idea, the target/host might be any arch e.g.
>>>> 2) won't magically fix problems as well, even if FreeBSD trunk can be
>>>> teached to understand
>>>> this, things will still be broken on releases. And u-boot tools work on
>>>> more host systems,
>>>> Andreas, can you check if Darwin is still able to compile tools from
>>>> u-boot master?
>>>
>>> unfortunately it does not.
>>>
>>> ---8<---
>>> andreas at imac % git describe
>>> v2015.04-rc1-4-g7f641d5
>>> andreas at imac %
>>> PATH=/Volumes/crosstool-ng/arm-unknown-linux-uclibcgnueabi/bin:$PATH
>>> make CROSS_COMPILE=arm-unknown-linux-uclibcgnueabi- V=1
>>> ...
>>>     gcc  -T ./tools/imagetool.lds -o tools/envcrc tools/envcrc.o
>>> tools/lib/crc32.o tools/common/env_embedded.o tools/lib/sha1.o
>>> ld: unknown option: -T
>>> collect2: error: ld returned 1 exit status
>>> make[1]: *** [tools/envcrc] Error 1
>>> make: *** [tools] Error 2
>>> andreas at imac % gcc --version
>>> gcc (MacPorts gcc49 4.9.2_1) 4.9.2
>>> Copyright (C) 2014 Free Software Foundation, Inc.
>>> This is free software; see the source for copying conditions.  There is
>>> NO
>>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
>>> PURPOSE.
>>> --->8---
>>>
>>>> 3) the option I would be tempted to choose, just don't do linker magic
>>>> for tools. This would
>>>> make sure at least mkimage etc can be build everywhere. sandbox won't
>>>> build, but as said
>>>> it is already broken because of other issues. (and I doubt there is even
>>>> an single user around
>>>> besides me to even try to build sandbox on FreeBSD).
>>>>
>>>> So as far as I am concerned we go for option 3.
>>>
>>> +1
>>>
>>> Dynamic list-sections is in general a good thing. But beside the linker
>>> problem here we will get another problem on darwin hosts when we want to
>>> read the sections. I added a patch to linux kernel to get around [1].
>>>
>>> So I have another option here:
>>>
>>> 4) setup the lists sections in code, add the magic handling for Mach-O
>>> binaries and remove the linker foo.
>>
>> The lower-common-denominator approach is a bit frustrating. How does
>> FreeBSD compile U-Boot?
>
>
> I guess I am missing the point here. U-boot v2015.01 builds fine
> on FreeBSD and as far as I know on a mac as well. It is v2015.04-rc1
> which no longer builds mkimage on FreeBSD and Darwin.
>
>> What are you actually using that system for if
>> it cannot build U-Boot?
>
>
> I am missing the point, u-boot and its tools build fine until v2015.04-rc1
> on FreeBSD and a mac. And this is easily fixed by not using linker magic
> for tools. (and yes sandbox likely fails to build, but I don't care that
> much)

How do you build U-Boot for any of the boards supported? What I mean
is that if you can't handle linker scripts in FreeBSD how do you build
anything beyond the 'tools' build?

The docs for 'ld' seem to indicate that if the -T option is not used
the file is treated as a link script addendum rather than replacing it
entirely. Is that what we want?

>>
>> Re 1) I found an open in ld to produce the standard link script. I
>> actually used that before I found INSERT BEFORE.
>>
>> Before giving up I think it would be worth exploring 1). It should
>> then be possible to make sandbox work also.
>
>
> 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.

>> Finally, please point me to how I can install FreeBSD in viritualbox
>> or similar. I'm interested in that...
>
>
> Just download an install image and start it in virtualbox, see 1.
> You might need to change the motherboard type.
>
> doc/README.clang explains how to use the host compiler to cross build
> u-boot (for some boards). You can install a gcc cross compiler as well.
>
> [1] https://www.freebsd.org/releases/10.1R/announce.html
>

I tried this out and I have a prompt but I'm not sure how to install
git or anything else 'pkg install git' tells me there are no packages
available to install matching 'git'. pkg_add seems to be missing. I am
none the wiser after some web searching.

Regards,
Simon


More information about the U-Boot mailing list