FreeBSD and BeagleBone

Warner Losh imp at bsdimp.com
Thu Jan 26 08:07:27 UTC 2012


On Jan 25, 2012, at 10:34 PM, Tim Kientzle wrote:

> On Jan 25, 2012, at 2:06 PM, Rafal Jaworowski wrote:
>> On 2012-01-22, at 00:29, Tim Kientzle wrote:
>> 
>>> 
>>> P.S.  Is it worth trying to generalize the ubldr Makefile
>>> to accept some form of link address specification?
>> 
>> In general yes, the challenge is how to do this in a smart and flexible way: loader/ubldr is built as part of the world which you don't want to entagle with platform specific knobs. On the other hand a configurable like this is specific to some board (not even a chip, soc or a familiy, anybody can have their U-Boot configured differently underneath..), so the question is how to convey this knowledge.
> 
> I know Warner has some ideas for organizing the tree to include
> board information.  If each board has a directory, then
> you could build a custom ubldr for each board.  That
> feels a little heavyweight to me, though.

The basic idea I had was expanded from what Sam did originally with the Avila support.  Each SoC would have a directory and under that there'd be a 'boards' directory.  This directory would have a number of files.  Each file would have a structure that would link into a list of boards (or more than one).  This structure would contain a 'probe' or 'match' routine that would be called to discover which of these board structures matched.  The one that matched would then be used to fill in other details into the SoC's structure.  things like clock speed, pin wiring, etc.

Much of that is now covered by FDT, and one field could be a 'replacement fdt' file since most ARM boot loaders don't present a FDT to the kernel.

This would get away from having too many things hard-wired via #defines and move instead to having more computed at run time via a structure dereference, maybe with a little math.  This would also allow us to have one kernel that booted on all AT91RM9200 boards, or possibly all atmel ARM boards or maybe even all armv4, armv5 and armv6 boards depending on how far we take this idea.

> The closest thing to a board description we have is
> the kernel config.  That reflects the hardware and layout
> of the board being targeted.  Is there some way to have
> ubldr made by buildkernel instead of buildworld?

We already do that for aicasm unconditionally.  It might take a bit of tricky logic to do this conditionally.  Well, the unconditional stuff is just for modules, we do it conditionally based on what's in the kernel, so there's a path blazed there already since this utility wouldn't be needed to build a module.

> Another approach might be to provide a build script that
> accepts arguments and spits out a compiled ubldr to
> match those parameters.  Maybe something like:
> 
>    $ cd /usr/src/sys/tools/ubldr-build
>    $ ./ubldr-build arm.arm -l 0x80010000 -o ubldr.beagle

We already have makefile targets for compressed kernels, this could easily be another of them.

Warner



More information about the freebsd-arm mailing list