make.sh 2.95 KB
#!/bin/bash

if [ -z "${FA_PRODUCT}" ]
then
    echo ""
    echo "Check environment variables..."
    echo "  $> source ../../env-4.9.4.env"
    echo ""
    exit 1
fi

DEFCONFIG_FILE=${FA_CHIPSET}_${FA_PRODUCT}_defconfig
DEFCONFIG_FILE=${DEFCONFIG_FILE/-/_}

TOOLCHAIN_DEFCONFIG_FILE=${FA_CHIPSET}_${FA_PRODUCT}_toolchain_defconfig
TOOLCHAIN_DEFCONFIG_FILE=${TOOLCHAIN_DEFCONFIG_FILE/-/_}

QT4_GST_DEFCONFIG_FILE=${FA_CHIPSET}_${FA_PRODUCT}_qt4_gst_defconfig
QT4_GST_DEFCONFIG_FILE=${QT4_GST_DEFCONFIG_FILE/-/_}

QT5_DEFCONFIG_FILE=${FA_CHIPSET}_${FA_PRODUCT}_qt5_defconfig
QT5_DEFCONFIG_FILE=${QT4_GST_DEFCONFIG_FILE/-/_}


OUTPUT_DIR=../output-buildroot-2016.08.1

VERSION_DIR="board/falinux/prime_oven/rootfs_overlay/root/."${FA_PRODUCT}
VERSION_FILE=".buildroot_version"

case $1 in
	help)
		echo ""
		echo "[Help]"
		echo " ssh-key       : generate ssh key"
		echo " defconfig     : reload config"
		echo " toolchain     : apply config file for toolchain"
		echo " qt4_gst       : apply config file for QT4/Gstreamer"
		echo " qt5           : apply config file for QT5"		
		echo " image         : generate ramdisk image file"
		echo " clean-target  : clean target directory"
		echo " distclean     : delete all non-source files (.config)"
		echo " savedefconfig : Save current config to BR2_DEFCONFIG (minimal config)"
		echo ""
		;;
	ssh-key)
		board/falinux/common/mk-ssh-key.sh
		;;
	toolchain)
                echo CONFIG: ${TOOLCHAIN_DEFCONFIG_FILE}
		make O=${OUTPUT_DIR} ${TOOLCHAIN_DEFCONFIG_FILE}
		;;
	qt4_gst)
                echo CONFIG: ${QT4_GST_DEFCONFIG_FILE}
		make O=${OUTPUT_DIR} ${QT4_GST_DEFCONFIG_FILE}
		;;
	qt5)
                echo CONFIG: ${QT5_DEFCONFIG_FILE}
		make O=${OUTPUT_DIR} ${QT5_DEFCONFIG_FILE}
		;;
	defconfig)
                echo CONFIG: ${DEFCONFIG_FILE}
		make O=${OUTPUT_DIR} ${DEFCONFIG_FILE}
		;;
	image)
		shift
		board/falinux/common/generate-image.sh O=${OUTPUT_DIR} $@
		;;
	clean-target)
		rm -Rf ${OUTPUT_DIR}/target
		find ${OUTPUT_DIR}/build -name ".stamp_target_installed" -exec rm {} \;
		find ${OUTPUT_DIR}/build -name ".stamp_staging_installed" -exec rm {} \;
		;;
	distclean)
		rm -rf ${OUTPUT_DIR}
		;;
	*)
		if [ ! -f ${OUTPUT_DIR}/.config ];
		then
		echo ""
		echo "[Help]"
		echo " ssh-key       : generate ssh key"
		echo " defconfig     : reload config"
		echo " toolchain     : apply config file for toolchain"
		echo " qt4_gst       : apply config file for QT4/Gstreamer"
		echo " qt5_gst       : apply config file for QT5/Gstreamer"		
		echo " image         : generate ramdisk image file"
		echo " clean-target  : clean target directory"
		echo " distclean     : delete all non-source files (.config)"
		echo " savedefconfig : Save current config to BR2_DEFCONFIG (minimal config)"
		echo ""
		exit
		fi

		if [ ! -d $VERSION_DIR ]; then
			mkdir -p ${VERSION_DIR}
		fi

		if [ -d ${VERSION_DIR}/${VERSION_FILE} ]; then
			rm ${VERSION_DIR}/${VERSION_FILE}
		fi

		date > ${VERSION_DIR}/${VERSION_FILE}

		make -j 4 O=${OUTPUT_DIR} $@
		;;
esac