--- elwix/build_kernel.sh 2021/03/11 13:59:50 1.8 +++ elwix/build_kernel.sh 2021/09/14 12:00:33 1.8.4.2 @@ -5,7 +5,7 @@ # (C) AITNET ltd - Sofia/Bulgaria # by Michael Pounov # -# $Id: build_kernel.sh,v 1.8 2021/03/11 13:59:50 misho Exp $ +# $Id: build_kernel.sh,v 1.8.4.2 2021/09/14 12:00:33 misho Exp $ # [ -r ./config/rc.elwix ] && . ./config/rc.elwix @@ -45,7 +45,7 @@ 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 \ + ${PARALLEL_BUILD} SRCCONF=${SRCCONF} __MAKE_CONF=${MAKECONF} \ buildkernel KERNCONF=$2 if [ $? -eq 0 ]; then cd - @@ -71,26 +71,45 @@ install_kernel() ### main() if [ -n "${1}" ]; then - rm ${KERN_ROOTFS}/elwix.ver + case "${1}" in + rootfs) + rm ${KERN_ROOTFS}/elwix.ver + ;; + base) + rm ${KERN}/elwix.ver + ;; + both) + rm ${KERN_ROOTFS}/elwix.ver + rm ${KERN}/elwix.ver + ;; + *) + echo "Error:: unknown argument. Please, choose which kind of kernel [base|rootfs|both]?" + exit 1 + ;; + esac +else + echo "Error:: missing argument. Please, choose which kind of kernel [base|rootfs|both]?" + exit 1 fi -if [ -n "${2}" ]; then - rm ${KERN}/elwix.ver -fi -if ! SnitVer ${KERN}/elwix.ver; then - clean_kernel ${KERN} ${KERNCONF} - build_kernel ${KERN} ${KERNCONF} - install_kernel ${KERN} ${KERNCONF} -else - echo "Skipped ELWIX Kernel build ..." +if [ "${1}" = "base" -o "${1}" = "both" ]; then + 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 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 ..." +if [ "${1}" = "rootfs" -o "${1}" = "both" ]; then + 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 fi -echo "+++ Complete build ELWIX Kernels" +echo "+++ Complete build ELWIX Kernels ${1}"