Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Sep 2014 11:53:35 -0700
From:      Tim Kientzle <tim@kientzle.com>
To:        Russell Haley <russ.haley@gmail.com>
Cc:        freebsd-arm@freebsd.org
Subject:   Re: Digi CCWMX53
Message-ID:  <A4CEAFC3-446E-4D14-8F3B-1CDC92C65829@kientzle.com>
In-Reply-To: <CABx9NuQr%2BdEb_yj3ypEe6Sb_qPY%2BqP74n0x1K5=_K6Zoio2vkw@mail.gmail.com>
References:  <CABx9NuQr%2BdEb_yj3ypEe6Sb_qPY%2BqP74n0x1K5=_K6Zoio2vkw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Sep 26, 2014, at 10:38 PM, Russell Haley <russ.haley@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.

>=20
> 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.)

>=20
> 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=3Dxyz ... =
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?A4CEAFC3-446E-4D14-8F3B-1CDC92C65829>