#!/bin/sh

source ../Config.sh

pp_clean_local () {
    pp_clean_default
    rm -f "${FW_TOPDIR}/bin/mkimage"
    return 0
}

pp_build_local () {
    # reconfiguration
    if [ "$PP_FORCE_FULL_BUILD" = "1" ]; then    
	if [ "$PP_BOARD" = "lara" ]; then
	    if [ "$PP_SUBBOARD" = "kacy" ]; then
		make kxgen2_config
	    else
		make PEPPERCON_config
	    fi
	elif [ "$PP_BOARD" = "kira" ]; then
	    make KIRA_config
	else
	    echo "Unknown PP_BOARD: '$PP_BOARD'"
	    return 1
	fi
    fi

    # make / install
    make install

    mkdir -p "${FW_TOPDIR}/bin"
    rm -f "${FW_TOPDIR}/bin/mkimage"
    ln -s "../u-boot/tools/mkimage" "${FW_TOPDIR}/bin/mkimage"
}

pp_do "$@"
