[meta-freescale] [fsl-community-bsp-platform][PATCH] setup-environment: add options for the script
Mahesh Mahadevan
Mahesh.Mahadevan at freescale.com
Mon May 20 21:32:57 PDT 2013
Add options to the script machine, below are the options added:
. ./setup-environment --help
Usage: source setup-environment build-dir
If build-dir is not specified the current directory is used.
By default the script will setup MACHINE to be imx6qsabresd.
Supported machines: imx23evk imx28evk imx31pdk imx35pdk imx51evk imx53ard imx53qsb imx6dlsabresd imx6qsabreauto imx6qsabresd imx6slevk cgtqmx6 imx233-olinuxino-maxi imx233-olinuxino-micro imx233-olinuxino-mini imx6qsabrelite nitrogen6x wandboard-dual wandboard-solo
To build for a machine listed above, run this script as:
MACHINE=<machine> source setup-environment build-dir
The script sets PARALLEL_MAKE & BB_NUMBER_THREADS to 4
Signed-off-by: Mahesh Mahadevan <Mahesh.Mahadevan at freescale.com>
---
setup-environment | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 64 insertions(+), 5 deletions(-)
diff --git a/setup-environment b/setup-environment
index 6aadbb4..a12c6b6 100644
--- a/setup-environment
+++ b/setup-environment
@@ -17,6 +17,58 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
+# Add options for the script
+# Copyright (C) 2013 Freescale Semiconductor, Inc.
+
+NCPU=`grep -c processor /proc/cpuinfo`
+CWD=`pwd`
+PROGNAME="setup-environment"
+
+usage()
+{
+ echo -e "\nUsage: source $PROGNAME build-dir\n"
+ echo -e -n "If build-dir is not specified the current directory is used.
+
+By default the script will setup MACHINE to be imx6qsabresd.
+
+Supported machines: `ls sources/*/conf/machine/*.conf \
+| sed s/\.conf//g | sed -r 's/^.+\///' | xargs echo`
+
+To build for a machine listed above, run this script as:
+MACHINE=<machine> source $PROGNAME build-dir
+
+The script sets PARALLEL_MAKE & BB_NUMBER_THREADS to $NCPU
+
+"
+}
+
+clean_up()
+{
+ unset EULA LIST_MACHINES VALID_MACHINE
+ unset NCPU CWD TEMPLATES SHORTOPTS LONGOPTS ARGS PROGNAME
+}
+
+# get command line options
+SHORTOPTS="h"
+LONGOPTS="help"
+
+ARGS=$(getopt --options $SHORTOPTS \
+ --longoptions $LONGOPTS --name $PROGNAME -- "$@" )
+eval set -- "$ARGS"
+while true;
+do
+ case $1 in
+ -h|--help)
+ usage
+ clean_up
+ return 0
+ ;;
+ *)
+ shift
+ break
+ ;;
+ esac
+done
if [ "$(whoami)" = "root" ]; then
echo "ERROR: do not use the BSP as root. Exiting..."
@@ -26,6 +78,17 @@ if [ -z "$MACHINE" ]; then
MACHINE='imx6qsabresd'
fi
+# Check the machine type specified
+LIST_MACHINES=`ls $CWD/sources/*/conf/machine`
+VALID_MACHINE=`echo -e "$LIST_MACHINES" | grep ${MACHINE}.conf$ | wc -l`
+if [ "x$MACHINE" = "x" ] || [ "$VALID_MACHINE" = "0" ]; then
+ echo -e "\nSPECIFIED AN INVALID MACHINE TYPE !"
+ usage && clean_up
+ return 1
+else
+ echo "Configuring for ${MACHINE}"
+fi
+
if [ -z "$SDKMACHINE" ]; then
SDKMACHINE='i686'
fi
@@ -39,8 +102,6 @@ if [ -e sources/oe-core ]; then
OEROOT=sources/oe-core
fi
-CWD=`pwd`
-
# Ensure all files in sources/base are kept in sync with project root
updated=
for f in $CWD/sources/base/*; do
@@ -74,7 +135,6 @@ if [ ! -e conf/local.conf.sample ]; then
# Generate the local.conf based on the Yocto defaults
TEMPLATES=$CWD/sources/base/conf
- NCPU=`grep -c processor /proc/cpuinfo`
grep -v '^#\|^$' conf/local.conf.sample > conf/local.conf
cat >> conf/local.conf <<EOF
@@ -167,5 +227,4 @@ else
echo "Your configuration files at $1 has not been touched."
fi
-# Force the question if setting a new build directory
-unset EULA
+clean_up
--
1.8.0
More information about the meta-freescale
mailing list