[U-Boot] Latest u-boot release on BeagleBone Black for FreeBSD

Ian Lepore ian at FreeBSD.org
Tue Apr 8 15:00:37 CEST 2014


On Mon, 2014-04-07 at 15:16 +0800, Xuebing Wang wrote:
> Hi u-boot community,
> 
> I am trying to port u-boot (release u-boot-2014.04-rc3.tar.bz2) to 
> FreeBSD on BeagleBone Black.
> 
> In FreeBSD, there is a u-boot loader (named ubldr), which can call 
> u-boot API to get fdt (Flat Device Tree) data. Example is:
> -- fdt header
> 
> I have to comment out below 3 lines, in order to get correct fdt data in 
> FreeBSD ubldr from u-boot. Would you please advice what is the best way 
> to fix this?
> 
> In file common/env_common.c:
> const uchar *env_get_addr(int index)
> {
> //      if (gd->env_valid)
> //              return (uchar *)(gd->env_addr + index);
> //      else
>                  return &default_environment[index];
> }
> 

Are you using a fairly recent ubldr on the freebsd side?  I made some
changes around March 1st on how ubldr finds / loads fdt data...

It first looks for env vars named fdtaddr then fdt_addr in the u-boot
environment.  If the variable exists it tries to validate the data at
that address as a valid dtb header and if it is, that's the data that is
passed to the kernel.  Otherwise it next it looks for env vars named
fdtfile then fdt_file.  If one of those exists it tries to load that
filename from the freebsd filesystem in the usual places where kernel
and modules are located (/boot/kernel, /boot/modules).

It seems strange to me that things work only if you comment out the
dynamic environment in u-boot.  You said "in order to get the correct
fdt data" and I wonder what you mean by that.  Do you mean that the
u-boot script stuff is loading fdt data, but it's not the freebsd data
but rather the linux data?

Unfortunately, freebsd isn't able to use linux or vendor-supplied dtb
files yet.  We're working towards using only documented bindings but
right now we still need freebsd-specific extra properties in the dtb.

I added the support for fdtfile/fdt_file specifically to handle this
situation until we're able to handle the vendor dtb files.  If you
manipulate your u-boot environment so that fdtaddr and fdt_addr are
unset and fdtfile is the name of the appropriate freebsd dtb file (which
you must install on your freebsd image along with the kernel), then
everything should work out properly.

Of course an alternative is to install the freebsd dtb files onto the
msdos partition along with u-boot and let u-boot load them and set
fdtaddr.  If this is what you're doing and it still isn't working, I
suspect the problem is in ubldr, not u-boot itself.  We'll have to turn
on some debugging in sys/boot/fdt/fdt_loader_cmd.c to track that down.

-- Ian




More information about the U-Boot mailing list