#!/bin/sh # # ELWIX build script for kernel # # (C) AITNET ltd - Sofia/Bulgaria # by Michael Pounov # # $Id: build_kernel.sh,v 1.7 2017/02/13 16:52:46 misho Exp $ # [ -r ./config/rc.elwix ] && . ./config/rc.elwix if [ X"${ELWIX_IS_CONFIGURED}" != X"YES" ]; then echo echo "ELWIX project is not configured !?!" echo exit 1 fi if [ ! -d $BSDSRC -o ! -d ${BSDKERNCONF} ]; then echo echo "ELWIX project is not configured - missing BSD sources !?!" echo exit 1 fi if [ "${USER}" != "root" ]; then echo echo "ELWIX project is not configured - BSD kernel must compile under root !?!" echo exit 1 fi clean_kernel() { echo "+++ Clean ELWIX Kernel $2 ... $1" rm -rf $1 mkdir -p $1 ln -sf ${CFGDIR}/$2 ${BSDKERNCONF} ln -sf ${CFGDIR}/${KERNHINT:=$KERNCONF.hints} ${BSDKERNCONF} } build_kernel() { echo "+++ Build ELWIX Kernel $2 ... $1" cd $BSDSRC env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ ${PARALLEL_BUILD} SRCCONF=${SRCCONF} __MAKE_CONF=${MAKECONF} DESTDIR=$1 \ buildkernel KERNCONF=$2 if [ $? -eq 0 ]; then cd - else exit 1 fi } install_kernel() { echo "+++ Install ELWIX Kernel $2 ... $1" cd $BSDSRC env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ SRCCONF=${SRCCONF} __MAKE_CONF=${MAKECONF} DESTDIR=$1 installkernel KERNCONF=$2 cd - if [ $? -eq 0 ]; then echo "ELWIX Platform:${PLATFORM} Version:${VERSION} TargetArch:${TARGET_ARCH}" >$1/elwix.ver fi echo "+++ Completed ELWIX Kernel $2 ... $1" } ### main() if ! SnitVer ${KERN}/elwix.ver; then clean_kernel ${KERN} ${KERNCONF} build_kernel ${KERN} ${KERNCONF} install_kernel ${KERN} ${KERNCONF} else echo "Skipped ELWIX Kernel build ..." fi if ! SnitVer ${KERN_ROOTFS}/elwix.ver; then clean_kernel ${KERN_ROOTFS} ${KERNCONF_ROOTFS} build_kernel ${KERN_ROOTFS} ${KERNCONF_ROOTFS} install_kernel ${KERN_ROOTFS} ${KERNCONF_ROOTFS} else echo "Skipped ELWIX rootfs Kernel build ..." fi echo "+++ Complete build ELWIX Kernels"