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 <javier.viguera@digi.com>
This commit is contained in:
Javier Viguera 2013-05-09 13:19:20 +02:00
parent 80f7892306
commit 69afa07596
1 changed files with 15 additions and 5 deletions

View File

@ -35,9 +35,14 @@ Usage: source ${SCRIPTNAME} [OPTIONS]
-l list available platforms
-p <platform> select platform for the project
-v <variant> 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/<platform>.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
@ -118,4 +128,4 @@ 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