From 69afa07596bb12e937ed54ede08eec2a12d71cd2 Mon Sep 17 00:00:00 2001 From: Javier Viguera Date: Thu, 9 May 2013 13:19:20 +0200 Subject: [PATCH] mkproject: add support for platform variants This commit adds basic support for platform variants. The script does not make any sanity check on the variant name. It's user's responsibility to use the correct variant for the platform. https://jira.digi.com/browse/DEL-435 Signed-off-by: Javier Viguera --- sdk/mkproject.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/sdk/mkproject.sh b/sdk/mkproject.sh index e5a03b0fc..7c8bb2220 100755 --- a/sdk/mkproject.sh +++ b/sdk/mkproject.sh @@ -35,9 +35,14 @@ Usage: source ${SCRIPTNAME} [OPTIONS] -l list available platforms -p select platform for the project + -v select platform variant Available platforms: ${AVAILABLE_PLATFORMS} +See platform include files for supported variant names: + +${SCRIPTPATH}/sources/meta-digi/meta-digi-arm/conf/machine/include/.inc + EOF } @@ -72,6 +77,10 @@ do_mkproject() { sed -i -e "/^#BB_NUMBER_THREADS =/cBB_NUMBER_THREADS = \"${NCPU}\"" \ -e "/^#PARALLEL_MAKE =/cPARALLEL_MAKE = \"-j ${NCPU}\"" \ ${PROJECTPATH}/conf/local.conf + if [ -n "${variant}" ]; then + sed -i -e "/^MACHINE_VARIANT =/cMACHINE_VARIANT = \"${variant}\"" \ + ${PROJECTPATH}/conf/local.conf + fi unset NCPU fi } @@ -94,10 +103,11 @@ AVAILABLE_PLATFORMS="$(echo $(ls -1 ${CONFIGPATH}/*/local.conf.sample | sed -e ' # The script needs to be sourced (not executed) so make sure to # initialize OPTIND variable for getopts. OPTIND=1 -while getopts "lp:" c; do +while getopts "lp:v:" c; do case "${c}" in l) list_platforms="y";; p) platform="${OPTARG}";; + v) variant="${OPTARG}";; esac done @@ -107,15 +117,15 @@ if [ "${BASH_SOURCE}" = "${0}" ]; then elif [ ${#} -eq 0 ] ; then usage elif [ -n "${list_platforms}" ]; then - echo ${AVAILABLE_PLATFORMS} + echo ${AVAILABLE_PLATFORMS} elif [ -z "${platform}" ]; then - error "-p option is required" + error "-p option is required" elif ! check_selected_platform; then - error "the selected platform \"${platform}\" is not available" + error "the selected platform \"${platform}\" is not available" else do_mkproject fi # clean-up all variables (so the script can be re-sourced) unset AVAILABLE_PLATFORMS GREEN NONE OLD_PROJECT PROJECTPATH RED SCRIPTNAME SCRIPTPATH -unset list_platforms platform +unset list_platforms platform variant