#!/bin/sh
set -e
# https://wiki.freebsd.org/FreeBSD/arm/crossbuild
# https://wiki.freebsd.org/FreeBSDMarvell
export BASEDIR=/usr/src/freebsd_dreamplug
export MAKEOBJDIRPREFIX=$BASEDIR/obj
MAKE_JOBS="-j 4"
cd $BASEDIR/src
make ${MAKE_JOBS} buildworld TARGET_ARCH=arm UBLDR_LOADADDR=0x6400000 __MAKE_CONF=/dev/null srcconf=/dev/null
make ${MAKE_JOBS} buildkernel TARGET_ARCH=arm KERNCONF=DREAMPLUG-1001 __MAKE_CONF=/dev/null srcconf=/dev/null
make installworld TARGET_ARCH=arm DESTDIR=$BASEDIR/dist __MAKE_CONF=/dev/null srcconf=/dev/null
make distribution TARGET_ARCH=arm DESTDIR=$BASEDIR/dist __MAKE_CONF=/dev/null srcconf=/dev/null
make installkernel TARGET_ARCH=arm KERNCONF=DREAMPLUG-1001 DESTDIR=$BASEDIR/dist __MAKE_CONF=/dev/null srcconf=/dev/null