Howto boot FreeBSD on MPC8540EVAL

Jacques Fourie jacques.fourie at gmail.com
Thu Mar 13 13:56:54 UTC 2008


Hi,

For the benefit of the list I'll describe how I got FreeBSD current to
boot on a MPC8540EVAL platform. This basically consisted of installing
a newer version of u-boot onto the flash and some minor kernel
modifications (thanks for all the help Rafal).

u-boot installation
---------------------
The MPC8540EVAL ships with u-boot pre-installed. Unfortunately the
version on mine was too old to contain the api module used by the
FreeBSD bootloader. Here is a short summary of how I installed a newer
version:
* Downloaded a snapshot of u-boot 1.3.2 (Close to release at time of writing)
* Added the following to include/configs/MPC8540EVAL.h :

#define CONFIG_MII               1
#define CONFIG_API              1
#define CONFIG_CMD_ELF
#define CONFIG_CMD_CONSOLE
#define CONFIG_CMD_MII

* Compiled u-boot on a Linux box with the toolchain that ships with
the Metrowerks BSP for this platform. I tried to compile using the
FreeBSD cross compiler but ran into some problems with the binutils
and gcc combination.
* Setup a tftp server on a FreeBSD7.0 box by editing the appropriate
entry in inetd.conf (and starting inetd).
* Setup a dhcpd server
* Copy the new u-boot.bin to the tftp root directory
* Boot the MPC8540EVAL and write the new u-boot onto the flash :
  MPC8540EVAL=> tftpboot 0x100000 ubnew.bin
  MPC8540EVAL=> protect off 0xfff80000 0xffffffff
  MPC8540EVAL=> era 0xfff80000 0xffffffff
  MPC8540EVAL=> cp.b 0x100000 0xfff80000 ${filesize}
  MPC8540EVAL=> setenv filesize
  MPC8540EVAL=> saveenv
  MPC8540EVAL=> protect on 0xfff80000 0xffffffff
  MPC8540EVAL=> reset

FreeBSD
-----------
I performed the following steps on a FreeBSD 7.0-RELEASE installation.

* Checkout latest sources from -current
* Apply the following patch to src/sys/dev/tsec/if_tsec.c:

index a5aff35..bd3854b 100644
--- a/sys/dev/tsec/if_tsec.c
+++ b/sys/dev/tsec/if_tsec.c
@@ -1561,7 +1561,7 @@ tsec_miibus_readreg(device_t dev, int ph

        sc = device_get_softc(dev);

-       if (device_get_unit(dev) != phy)
+       if (phy != 4 && phy != 7)
                return (0);

        sc = tsec0_sc;

* Cross-compile FreeBSD powerpc world and kernel using MPC85XX kernel config
* Do a 'make installworld DESTDIR=/some/dir'
* Edit /some/dir/boot/loader.conf and add the line
'hw.uart.console="mm:0xfef04500"'
* NFS export /some/dir
* Added the 'root-path' option to the DHCP server to point to this directory.
* Copy ubldr from src/sys/boot/powerpc/uboot/ubldr to the tftp root directory
* Boot into new u-boot, download ubldr and execute it:
  MPC8540EVAL=> tftpboot 0x100000 ubldr
  MPC8540EVAL=> bootelf 0x100000

If all goes well you'll now see the boot loader loading and then
booting the kernel.

Jacques


More information about the freebsd-embedded mailing list