Digi CCWMX53

Tim Kientzle tim at kientzle.com
Sat Sep 27 19:14:17 UTC 2014


On Sep 26, 2014, at 10:38 PM, Russell Haley <russ.haley at gmail.com> wrote:

> 1) Can anyone give me the correct u-boot enviroment variables or reference
> to the u-boot process to boot the completed freebsd kernel. Specifically on
> a CCWMX53 if possible, but I have linux references to port from. Where
> would I look for an example?

There are two general approaches being used:

1) Have U-Boot load and boot the kernel directly.  This can sometimes be done with an unmodified Linux U-Boot.

2) Have U-Boot load FreeBSDs scriptable 'ubldr' and have that load the kernel.  This provides more flexibility in the boot process but usually requires rebuilding U-Boot.  In particular, you'll need to:
   * Add CONFIG_CMD_ELF option to U-Boot so it can load `ubldr' which is an ELF executable
   * Add CONFIG_CMD_API option to U-Boot so `ubldr' can access U-Boot's drivers for hardware access (`ubldr' itself has to be compiled for each board to adjust the load address but is otherwise completely generic).
   * Adjust the U-Boot startup scripts to set FDT environment variables and load ubldr.  You can look at the U-Boot patches for various boards supported by Crochet to see how this has been done elsewhere:
   github.com/kientlze/crochet-freebsd


> 2) Do I need to create a cross compiler? Reference 1 says yes, reference
> two says no. Help!

In most cases, the FreeBSD build system will build a cross-compiler for it's own use, so you generally don't need to install a cross compiler to cross-build FreeBSD proper.  However, U-Boot is not part of FreeBSD so you may need to install a separate cross-compiler to build that.

> 
> Ref.1 Build  a cross compiler
> https://wiki.freebsd.org/FreeBSD/arm/ArndaleBoard

This is using a cross-compiler from ports to build U-Boot.  It uses the FreeBSD build machinery to cross-build the FreeBSD kernel and world.  (When you specify TARGET_ARCH, FreeBSD's 'buildworld' target will build and use a suitable cross-compiler.  Also, 'buildkernel' will reuse the cross-compiler built by 'buildworld', so you do not need 'kernel-toolchain' as long as you 'buildworld' first.)

> 
> Ref 2. No cross compiler/ make toolchain
> https://wiki.freebsd.org/A_Brief_Guide_To_Cross_Compiling_FreeBSD

This example only talks about building *world*, and the 'buildworld' target builds the necessary cross-tools transparently.  In particular, since it doesn't talk about building out-of-tree boot loaders such as U-Boot, it does not need to talk about building/installing an explicit cross-compiler.

For cross-compilers, you have three options:
 * Ports.
 * After a successful buildworld, you can 'make TARGET=xyz ... buildenv'  to get a shell with suitable path settings to reuse the cross-tools from the buildworld stage.  Use 'buildenvvar' to just get the environment for use in scripts.
 * FreeBSD source has an 'xdev' target that builds and installs a set of cross-tools.  In particular, it can install cross-versions of the same GCC or clang used by the rest of FreeBSD.  This facility has changed a lot recently, so ask if you need the current command line.

Hope this clarifies things,

Tim



More information about the freebsd-arm mailing list