Annotation of elwix/build_kernel.sh, revision 1.4

1.1       misho       1: #!/bin/sh
                      2: #
                      3: # ELWIX build script for kernel
                      4: #
                      5: # (C) AITNET ltd - Sofia/Bulgaria <office@aitnet.org>
                      6: #    by Michael Pounov <misho@elwix.org>
                      7: #
1.4     ! misho       8: # $Id: build_kernel.sh,v 1.3.6.3 2013/08/02 09:32:14 misho Exp $
1.1       misho       9: #
                     10: 
                     11: [ -r ./config/rc.elwix ] && . ./config/rc.elwix
                     12: if [ X"${ELWIX_IS_CONFIGURED}" != X"YES" ]; then
                     13:        echo
                     14:        echo "ELWIX project is not configured !?!"
                     15:        echo
                     16:        exit 1
                     17: fi
                     18: 
                     19: if [ ! -d $BSDSRC -o ! -d ${BSDKERNCONF} ]; then
                     20:        echo
                     21:        echo "ELWIX project is not configured - missing BSD sources !?!"
                     22:        echo
                     23:        exit 1
                     24: fi
                     25: 
                     26: if [ "${USER}" != "root" ]; then
                     27:        echo
                     28:        echo "ELWIX project is not configured - BSD kernel must compile under root !?!"
                     29:        echo
                     30:        exit 1
                     31: fi
                     32: 
                     33: clean_kernel()
                     34: {
                     35:        echo "+++ Clean ELWIX Kernel ..."
1.4     ! misho      36:        rm -rf $1
        !            37:        mkdir -p $1
1.1       misho      38: 
1.4     ! misho      39:        ln -sf ${CFGDIR}/$2 ${BSDKERNCONF}
        !            40:        ln -sf ${CFGDIR}/${KERNHINT:=$KERNCONF.hints} ${BSDKERNCONF}
1.1       misho      41: }
                     42: 
                     43: build_kernel()
                     44: {
                     45:        echo "+++ Build ELWIX Kernel ..."
                     46:        cd $BSDSRC
                     47:        env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
1.4     ! misho      48:                -j${PARALLEL_BUILD} buildkernel KERNCONF=$2 DESTDIR=$1
1.3       misho      49:        if [ $? -eq 0 ]; then
                     50:                cd -
                     51:        else
1.2       misho      52:                exit 1
                     53:        fi
1.1       misho      54: }
                     55: 
                     56: install_kernel()
                     57: {
                     58:        echo "+++ Install ELWIX Kernel ..."
                     59:        cd $BSDSRC
                     60:        env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
1.4     ! misho      61:                installkernel KERNCONF=$2 DESTDIR=$1
1.1       misho      62:        cd -
                     63: 
1.3       misho      64:        if [ $? -eq 0 ]; then
1.4     ! misho      65:                echo "ELWIX Platform:${PLATFORM} Version:${VERSION} TargetArch:${TARGET_ARCH}" >$1/elwix.ver
1.3       misho      66:        fi
1.1       misho      67: }
                     68: 
                     69: ### main()
                     70: if ! SnitVer ${KERN}/elwix.ver; then
1.4     ! misho      71:        clean_kernel ${KERN} ${KERNCONF}
        !            72:        build_kernel ${KERN} ${KERNCONF}
        !            73:        install_kernel ${KERN} ${KERNCONF}
1.1       misho      74: else
                     75:        echo "Skipped ELWIX Kernel build ..."
                     76: fi
                     77: 
1.4     ! misho      78: if ! SnitVer ${KERN_ROOTFS}/elwix.ver; then
        !            79:        clean_kernel ${KERN_ROOTFS} ${KERNCONF_ROOTFS}
        !            80:        build_kernel ${KERN_ROOTFS} ${KERNCONF_ROOTFS}
        !            81:        install_kernel ${KERN_ROOTFS} ${KERNCONF_ROOTFS}
        !            82: else
        !            83:        echo "Skipped ELWIX rootfs Kernel build ..."
        !            84: fi
        !            85: 
        !            86: echo "+++ Complete build ELWIX Kernels"

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>