Installing FreeBSD On U-Boot based PowerPC Targets

Some install notes from building and installing on AmigaOne A1222 and AmigaOne X5000, but should be relevant to most U-Boot PowerPC targets.

Easiest way is to start with NetBooting.

Extra Packages Needed

On the build system you'll need

Building the World and Kernel

The targets tested with are:

Example with 64-bit target:

make -s -j3 buildworld buildkernel TARGET_ARCH=powerpc64 KERNCONF=QORIQ64
make -s installworld DESTDIR=/path/to/netboot
make -s installkernel DESTDIR=/path/to/netboot
make -s distribution DESTDIR=/path/to/netboot
readelf -h /path/to/netboot/boot/kernel/kernel | grep "Entry point address"
mkimage -A powerpc -C none -a 0x3ffffc0 -e <entrypoint adjusted> -O linux -T kernel -n "FreeBSD QorIQ64" -d /path/to/netboot/boot/kernel/kernel /path/to/netboot-tftp/kernel.uImage

Notes:

  1. You need to specify "linux" as the OS type (-O argument). u-boot on the boards I've tested with don't recognize FreeBSD OS.
  2. Entry point (-e): Check entry point from readelf, dropping the 0xc, and adding 0x4000000. For example, on my powerpc64 build it has an entry point of 0xc000000000003000, so drop the load address of 0xc000000000000000, and add 0x4000000, yielding 0x4003000.
  3. Load address (-a) is 0x3ffffc0, because the kernel must be loaded at a 64MB boundary, with a 64 byte u-boot header. I don't know how to make it load or copy from an arbitrary address, so I just load to the target address.

Finally, at the u-boot CLI:

setenv loadaddr 0x3ffffc0
setenv bootfile kernel.uImage
saveenv

Once booted to netboot, you can rebuild and install to local. On Freescale hardware with SATA, you can install to SATA for local booting. This includes the AmigaOne A1222 and X5000 I tested. Notes for this are:

  1. SATA disk needs to be partitioned MBR, with a FAT volume for booting. I make this 128MB, so there's plenty of space for kernels, the dtb, and any other needed files.
  2. If you plan to only use FreeBSD, dedicate slice 2 to FreeBSD.

My GEOM map:

# gpart show ada0
=>       63  234441585  ada0  MBR  (112G)
         63          1        - free -  (512B)
         64     262144     1  fat16  (128M)
     262208  234179432     2  freebsd  (112G)
  234441640          8        - free -  (4.0K)

=>        0  234179432  ada0s2  BSD  (112G)
          0   41943040       1  freebsd-ufs  (20G)
   41943040    8388608       2  freebsd-swap  (4.0G)
   50331648  183847784       4  freebsd-zfs  (88G)

Once FreeBSD is installed, set bootargs in ubldr, and set SATA boot:

setenv bootargs vfs.root.mountfrom=ufs:/dev/ada0s2a kernelname=/boot/kernel/kernel
setenv bootcmd_sata 'sata start; fatload sata 0:1 ${loadaddr} ${bootfile}; fatload sata 0:1 ${fdtaddr} ${fdtfile}; bootm ${loadaddr} - ${fdtaddr}'
setenv bootcmd_old ${bootcmd}
setenv bootcmd run bootcmd_sata
saveenv

Be sure to use single quotes when setting bootcmd_sata, so the environment variables aren't expanded immediately, and can be updated later if needed.

powerpc/UBoot-Install (last edited 2018-04-13 03:22:05 by JustinHibbits)