#!/bin/sh
# $Id: 4.kernel.sh,v 1.8 2004/03/10 17:01:43 dave Exp $

set -e -u

. ./config.sh

echo "Copying FreeSBIE configuration file in /usr/src/sys/i386/conf"
if [ "$RELEASE" = "5" ];
then
    cp $LOCALDIR/files/FREESBIE.5 /usr/src/sys/i386/conf/FREESBIE
    cp /usr/src/sys/i386/conf/GENERIC.hints $FREESBIEBASEDIR/boot/device.hints
    echo hint.psm.0.flags=\"0x1000\" >> $FREESBIEBASEDIR/boot/device.hints
else
    cp $LOCALDIR/files/FREESBIE /usr/src/sys/i386/conf/
fi
echo "Building FreeSBIE kernel..."
sleep 1
export __MAKE_CONF=$LOCALDIR/files/make.conf # Redefine make.conf path

cd /usr/src && $MAKE kernel DESTDIR=$FREESBIEBASEDIR $MAKEOPT

rm -f /usr/src/sys/i386/conf/FREESBIE

if [ "$RELEASE" = "5" ];
then
    cd $FREESBIEBASEDIR/boot/kernel && gzip kernel
fi
