Patchwork [fsl-community-bsp-platform] setup-environment: add options for the script

login
register
mail settings
Submitter Mahesh Mahadevan
Date May 21, 2013, 2:01 p.m.
Message ID <1369144872-23861-1-git-send-email-Mahesh.Mahadevan@freescale.com>
Download mbox | patch
Permalink /patch/50255/
State Accepted
Delegated to: Otavio Salvador
Headers show

Comments

Mahesh Mahadevan - May 21, 2013, 2:01 p.m.
Add options to the script machine, below are the options added:

. ./setup-environment

Usage: source setup-environment <build-dir>
    <build-dir>: required option; specifies build directory location

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@freescale.com>
---
 setup-environment | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 69 insertions(+), 5 deletions(-)
Otavio Salvador - May 22, 2013, 1:19 p.m.
On Tue, May 21, 2013 at 11:01 AM, Mahesh Mahadevan <
Mahesh.Mahadevan@freescale.com> wrote:

> Add options to the script machine, below are the options added:
>
> . ./setup-environment
>
> Usage: source setup-environment <build-dir>
>     <build-dir>: required option; specifies build directory location
>
> 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@freescale.com>
>

Applied to master.
Mahadevan Mahesh-R9AADQ - May 22, 2013, 2:09 p.m.
Thanks Otavio. Could you apply to Dylan branch as well please.

Best regards,
-Mahesh

From: otavio.salvador@gmail.com [mailto:otavio.salvador@gmail.com] On Behalf Of Otavio Salvador
Sent: Wednesday, May 22, 2013 8:20 AM
To: Mahadevan Mahesh-R9AADQ
Cc: meta-freescale@yoctoproject.org
Subject: Re: [meta-freescale] [fsl-community-bsp-platform][PATCH] setup-environment: add options for the script



On Tue, May 21, 2013 at 11:01 AM, Mahesh Mahadevan <Mahesh.Mahadevan@freescale.com<mailto:Mahesh.Mahadevan@freescale.com>> wrote:
Add options to the script machine, below are the options added:

. ./setup-environment

Usage: source setup-environment <build-dir>
    <build-dir>: required option; specifies build directory location

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@freescale.com<mailto:Mahesh.Mahadevan@freescale.com>>

Applied to master.

--
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://projetos.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
Otavio Salvador - May 22, 2013, 2:53 p.m.
On Wed, May 22, 2013 at 11:09 AM, Mahadevan Mahesh-R9AADQ <
r9aadq@freescale.com> wrote:

>  Thanks Otavio. Could you apply to Dylan branch as well please.
>

I'd prefer to way some days as this might break in different shell or
something. Otherwise please ping me again next week and we apply it.
Mahadevan Mahesh-R9AADQ - May 22, 2013, 3:23 p.m.
Thanks, sounds good.

Best regards,
-Mahesh

From: otavio.salvador@gmail.com [mailto:otavio.salvador@gmail.com] On Behalf Of Otavio Salvador
Sent: Wednesday, May 22, 2013 9:53 AM
To: Mahadevan Mahesh-R9AADQ
Cc: meta-freescale@yoctoproject.org
Subject: Re: [meta-freescale] [fsl-community-bsp-platform][PATCH] setup-environment: add options for the script



On Wed, May 22, 2013 at 11:09 AM, Mahadevan Mahesh-R9AADQ <r9aadq@freescale.com<mailto:r9aadq@freescale.com>> wrote:
Thanks Otavio. Could you apply to Dylan branch as well please.

I'd prefer to way some days as this might break in different shell or something. Otherwise please ping me again next week and we apply it.

--
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://projetos.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
Mahadevan Mahesh-R9AADQ - May 30, 2013, 7:16 p.m.
Hi Otavio,
Do you think it is safe to get this patch to the Dylan branch.

Best regards,
-Mahesh

From: otavio.salvador@gmail.com [mailto:otavio.salvador@gmail.com] On Behalf Of Otavio Salvador
Sent: Wednesday, May 22, 2013 8:20 AM
To: Mahadevan Mahesh-R9AADQ
Cc: meta-freescale@yoctoproject.org
Subject: Re: [meta-freescale] [fsl-community-bsp-platform][PATCH] setup-environment: add options for the script



On Tue, May 21, 2013 at 11:01 AM, Mahesh Mahadevan <Mahesh.Mahadevan@freescale.com<mailto:Mahesh.Mahadevan@freescale.com>> wrote:
Add options to the script machine, below are the options added:

. ./setup-environment

Usage: source setup-environment <build-dir>
    <build-dir>: required option; specifies build directory location

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@freescale.com<mailto:Mahesh.Mahadevan@freescale.com>>

Applied to master.

--
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://projetos.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
Otavio Salvador - May 31, 2013, 12:41 p.m.
On Thu, May 30, 2013 at 4:16 PM, Mahadevan Mahesh-R9AADQ <
r9aadq@freescale.com> wrote:

>  Hi Otavio,****
>
> Do you think it is safe to get this patch to the Dylan branch. ****
>
>
> Yes; nobody found issues in master for a while. Applied to dylan.

Thanks for pinging me about it.

Patch

diff --git a/setup-environment b/setup-environment
index 6aadbb4..fcc8f9f 100644
--- a/setup-environment
+++ b/setup-environment
@@ -17,6 +17,63 @@ 
 # 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>
+    <build-dir>: required option; specifies build directory location
+
+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 -- "$@" )
+# Print the usage menu if invalid options are specified
+if [ $? != 0 -o $# -lt 1 ]; then
+   usage && clean_up
+   return 1
+fi
+
+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 +83,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 +107,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 +140,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 +232,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