All of lore.kernel.org
 help / color / mirror / Atom feed
* [fsl-community-bsp-platform][PATCH] setup-environment: add options for the script
@ 2013-05-21 14:01 Mahesh Mahadevan
  2013-05-22 13:19 ` Otavio Salvador
  0 siblings, 1 reply; 17+ messages in thread
From: Mahesh Mahadevan @ 2013-05-21 14:01 UTC (permalink / raw)
  To: meta-freescale

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(-)

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
-- 
1.8.0




^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [fsl-community-bsp-platform][PATCH] setup-environment: add options for the script
  2013-05-21 14:01 [fsl-community-bsp-platform][PATCH] setup-environment: add options for the script Mahesh Mahadevan
@ 2013-05-22 13:19 ` Otavio Salvador
  2013-05-22 14:09   ` Mahadevan Mahesh-R9AADQ
  2013-05-30 19:16   ` Mahadevan Mahesh-R9AADQ
  0 siblings, 2 replies; 17+ messages in thread
From: Otavio Salvador @ 2013-05-22 13:19 UTC (permalink / raw)
  To: Mahesh Mahadevan; +Cc: meta-freescale

[-- Attachment #1: Type: text/plain, Size: 1138 bytes --]

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.

-- 
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

[-- Attachment #2: Type: text/html, Size: 1739 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [fsl-community-bsp-platform][PATCH] setup-environment: add options for the script
  2013-05-22 13:19 ` Otavio Salvador
@ 2013-05-22 14:09   ` Mahadevan Mahesh-R9AADQ
  2013-05-22 14:53     ` Otavio Salvador
  2013-05-30 19:16   ` Mahadevan Mahesh-R9AADQ
  1 sibling, 1 reply; 17+ messages in thread
From: Mahadevan Mahesh-R9AADQ @ 2013-05-22 14:09 UTC (permalink / raw)
  To: Otavio Salvador; +Cc: meta-freescale

[-- Attachment #1: Type: text/plain, Size: 1585 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 5221 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [fsl-community-bsp-platform][PATCH] setup-environment: add options for the script
  2013-05-22 14:09   ` Mahadevan Mahesh-R9AADQ
@ 2013-05-22 14:53     ` Otavio Salvador
  2013-05-22 15:23       ` Mahadevan Mahesh-R9AADQ
  0 siblings, 1 reply; 17+ messages in thread
From: Otavio Salvador @ 2013-05-22 14:53 UTC (permalink / raw)
  To: Mahadevan Mahesh-R9AADQ; +Cc: meta-freescale

[-- Attachment #1: Type: text/plain, Size: 505 bytes --]

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.

-- 
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

[-- Attachment #2: Type: text/html, Size: 1188 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [fsl-community-bsp-platform][PATCH] setup-environment: add options for the script
  2013-05-22 14:53     ` Otavio Salvador
@ 2013-05-22 15:23       ` Mahadevan Mahesh-R9AADQ
  0 siblings, 0 replies; 17+ messages in thread
From: Mahadevan Mahesh-R9AADQ @ 2013-05-22 15:23 UTC (permalink / raw)
  To: Otavio Salvador; +Cc: meta-freescale

[-- Attachment #1: Type: text/plain, Size: 893 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 4604 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [fsl-community-bsp-platform][PATCH] setup-environment: add options for the script
  2013-05-22 13:19 ` Otavio Salvador
  2013-05-22 14:09   ` Mahadevan Mahesh-R9AADQ
@ 2013-05-30 19:16   ` Mahadevan Mahesh-R9AADQ
  2013-05-31 12:41     ` Otavio Salvador
  1 sibling, 1 reply; 17+ messages in thread
From: Mahadevan Mahesh-R9AADQ @ 2013-05-30 19:16 UTC (permalink / raw)
  To: Otavio Salvador; +Cc: meta-freescale

[-- Attachment #1: Type: text/plain, Size: 1597 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 5378 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [fsl-community-bsp-platform][PATCH] setup-environment: add options for the script
  2013-05-30 19:16   ` Mahadevan Mahesh-R9AADQ
@ 2013-05-31 12:41     ` Otavio Salvador
  0 siblings, 0 replies; 17+ messages in thread
From: Otavio Salvador @ 2013-05-31 12:41 UTC (permalink / raw)
  To: Mahadevan Mahesh-R9AADQ; +Cc: meta-freescale

[-- Attachment #1: Type: text/plain, Size: 494 bytes --]

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.

-- 
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

[-- Attachment #2: Type: text/html, Size: 1367 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [fsl-community-bsp-platform][PATCH] setup-environment: add options for the script
  2013-05-21  4:32 Mahesh Mahadevan
@ 2013-05-21  4:38 ` Otavio Salvador
  0 siblings, 0 replies; 17+ messages in thread
From: Otavio Salvador @ 2013-05-21  4:38 UTC (permalink / raw)
  To: Mahesh Mahadevan; +Cc: meta-freescale

[-- Attachment #1: Type: text/plain, Size: 4700 bytes --]

On Tue, May 21, 2013 at 1:32 AM, Mahesh Mahadevan <
Mahesh.Mahadevan@freescale.com> wrote:

> 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.
>

I think build dir should be required; in case someone does not provide it
I'd expect it to output 'usage' so user can learn how to use it.

Aside from that, it is very good! :-)


> 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 | 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
>
>
> _______________________________________________
> meta-freescale mailing list
> meta-freescale@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/meta-freescale
>



-- 
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

[-- Attachment #2: Type: text/html, Size: 6162 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [fsl-community-bsp-platform][PATCH] setup-environment: add options for the script
@ 2013-05-21  4:32 Mahesh Mahadevan
  2013-05-21  4:38 ` Otavio Salvador
  0 siblings, 1 reply; 17+ messages in thread
From: Mahesh Mahadevan @ 2013-05-21  4:32 UTC (permalink / raw)
  To: meta-freescale

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@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




^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [fsl-community-bsp-platform][PATCH] setup-environment: add options for the script
  2013-05-20 19:26 Mahesh Mahadevan
@ 2013-05-20 19:41 ` Otavio Salvador
  0 siblings, 0 replies; 17+ messages in thread
From: Otavio Salvador @ 2013-05-20 19:41 UTC (permalink / raw)
  To: Mahesh Mahadevan; +Cc: meta-freescale

[-- Attachment #1: Type: text/plain, Size: 5791 bytes --]

On Mon, May 20, 2013 at 4:26 PM, Mahesh Mahadevan <
Mahesh.Mahadevan@freescale.com> wrote:

> Add options to the script machine, below are the options added:
>
> Usage: source ./setup-environment <-b build-path>
>
>     * [-b build-path]: build dir location
>     * [-h or --help]: help
>
> 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 <-b build-path>
>
> Signed-off-by: Mahesh Mahadevan <Mahesh.Mahadevan@freescale.com>
>

This one is much better but I still does not like to need of using '-b' for
build dir when it is the *only* known option. I'd much prefer the way it
was and been in use for quite some time (since denzil) so I don't think we
should change it without a strong reason.


>  setup-environment | 86
> +++++++++++++++++++++++++++++++++++++++++++++++++++----
>  1 file changed, 80 insertions(+), 6 deletions(-)
>
> diff --git a/setup-environment b/setup-environment
> index 6aadbb4..72e83b6 100644
> --- a/setup-environment
> +++ b/setup-environment
> @@ -17,15 +17,93 @@
>  # 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`
> +
> +usage()
> +{
> +    echo -e "\nUsage: source ${BASH_SOURCE[0]} <-b build-path>"
> +    echo "
> +    * [-b build-path]: build dir location
>

I'd drop this option.


> +    * [-h or --help]: help
> +"
> +    echo -e -n "By default the script will setup MACHINE to be
> imx6qsabresd.
>

I think you could give some examples about variables commonly overriden as
MACHINE, PARALLEL_MAKE and so on. This would justify the existence of the
'help' option and does make improve the user experience.



> +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 ${BASH_SOURCE[0]} <-b build-path>
> +"
>

Use $0 as this needs to be portable for other shells (I personally use zsh
for example) and we shouldn't depend on bash specific features.


> +}
> +
> +clean_up()
> +{
> +   unset EULA MACHINE LIST_MACHINES VALID_MACHINE BUILD_DIR
> +   unset NCPU CWD TEMPLATES SHORTOPTS LONGOPTS ARGS
> +}
> +
> +# get command line options
> +SHORTOPTS="b:h"
> +LONGOPTS="help"
> +
> +ARGS=$(getopt --options $SHORTOPTS  \
> +  --longoptions $LONGOPTS --name ${BASH_SOURCE[0]} -- "$@" )
> +eval set -- "$ARGS"
> +while true;
> +do
> +    case $1 in
> +        -b)
> +           shift
> +           BUILD_DIR=$1;
> +           shift
> +           ;;
>

Drop please.


> +        -h|--help)
> +           usage
> +           clean_up
> +           return 0
> +           ;;
> +        --)
> +           usage
> +           clean_up
> +           return 1
> +           ;;
> +        *)
> +           shift
> +           break
> +           ;;
> +    esac
> +    shift
> +done
>
>  if [ "$(whoami)" = "root" ]; then
>      echo "ERROR: do not use the BSP as root. Exiting..."
>  fi
>
> +if [ -z "$BUILD_DIR" ]; then
> +    echo "Please provide a name for the build directory!"
> +    usage && clean_up
> +    return 1
> +fi
> +
>  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 +117,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
> @@ -62,7 +138,7 @@ fi
>
>  cd $OEROOT
>
> -. ./oe-init-build-env $CWD/$1 > /dev/null
> +. ./oe-init-build-env $CWD/$BUILD_DIR > /dev/null
>
>  # Clean up PATH, because if it includes tokens to current directories
> somehow,
>  # wrong binaries can be used instead of the expected ones during task
> execution
> @@ -74,7 +150,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 +242,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
>

In general I like the changes except the '-b' option as it is not really
required and change the way people been using since its creation. Let's
avoid user changes without strong need.

Regards,

-- 
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

[-- Attachment #2: Type: text/html, Size: 7785 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [fsl-community-bsp-platform][PATCH] setup-environment: add options for the script
@ 2013-05-20 19:26 Mahesh Mahadevan
  2013-05-20 19:41 ` Otavio Salvador
  0 siblings, 1 reply; 17+ messages in thread
From: Mahesh Mahadevan @ 2013-05-20 19:26 UTC (permalink / raw)
  To: meta-freescale

Add options to the script machine, below are the options added:

Usage: source ./setup-environment <-b build-path>

    * [-b build-path]: build dir location
    * [-h or --help]: help

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 <-b build-path>

Signed-off-by: Mahesh Mahadevan <Mahesh.Mahadevan@freescale.com>
---
 setup-environment | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 80 insertions(+), 6 deletions(-)

diff --git a/setup-environment b/setup-environment
index 6aadbb4..72e83b6 100644
--- a/setup-environment
+++ b/setup-environment
@@ -17,15 +17,93 @@
 # 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`
+
+usage()
+{
+    echo -e "\nUsage: source ${BASH_SOURCE[0]} <-b build-path>"
+    echo "
+    * [-b build-path]: build dir location
+    * [-h or --help]: help
+"
+    echo -e -n "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 ${BASH_SOURCE[0]} <-b build-path>
+"
+}
+
+clean_up()
+{
+   unset EULA MACHINE LIST_MACHINES VALID_MACHINE BUILD_DIR
+   unset NCPU CWD TEMPLATES SHORTOPTS LONGOPTS ARGS
+}
+
+# get command line options
+SHORTOPTS="b:h"
+LONGOPTS="help"
+
+ARGS=$(getopt --options $SHORTOPTS  \
+  --longoptions $LONGOPTS --name ${BASH_SOURCE[0]} -- "$@" ) 
+eval set -- "$ARGS"
+while true;
+do
+    case $1 in
+        -b)
+           shift 
+           BUILD_DIR=$1;
+           shift
+           ;;
+        -h|--help)
+           usage
+           clean_up
+           return 0
+           ;;
+        --)
+           usage
+           clean_up
+           return 1 
+           ;;
+        *)
+           shift
+           break
+           ;;
+    esac
+    shift
+done
 
 if [ "$(whoami)" = "root" ]; then
     echo "ERROR: do not use the BSP as root. Exiting..."
 fi
 
+if [ -z "$BUILD_DIR" ]; then
+    echo "Please provide a name for the build directory!"
+    usage && clean_up
+    return 1
+fi
+
 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 +117,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
@@ -62,7 +138,7 @@ fi
 
 cd $OEROOT
 
-. ./oe-init-build-env $CWD/$1 > /dev/null
+. ./oe-init-build-env $CWD/$BUILD_DIR > /dev/null
 
 # Clean up PATH, because if it includes tokens to current directories somehow,
 # wrong binaries can be used instead of the expected ones during task execution
@@ -74,7 +150,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 +242,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




^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [fsl-community-bsp-platform][PATCH] setup-environment: add options for the script
  2013-05-19  2:04   ` Mahadevan Mahesh-R9AADQ
@ 2013-05-19 19:43     ` Otavio Salvador
  0 siblings, 0 replies; 17+ messages in thread
From: Otavio Salvador @ 2013-05-19 19:43 UTC (permalink / raw)
  To: Mahadevan Mahesh-R9AADQ; +Cc: meta-freescale

On Sat, May 18, 2013 at 11:04 PM, Mahadevan Mahesh-R9AADQ
<r9aadq@freescale.com> wrote:
> On Fri, May 17, 2013 at 10:02 PM, Mahesh Mahadevan
> <Mahesh.Mahadevan@freescale.com> wrote:
>> From: Mahesh Mahadevan <mahesh.mahadevan@freescale.com>
>>
>> Add options to help specify the machine, below are the options added:
>> Usage: source ./setup-environment <-m machine>
>>     Optional parameters: [-j jobs] [-t tasks] [-h]
>>
>>  Supported machines: imx23evk imx28evk imx31pdk imx35pdk imx51evk imx53ard imx53qsb imx6dlsabresd imx6qsabreauto imx6qsabresd imx6slevk
>
> The meta-fsl-arm-extra machines are missing.
>
> [Mahadevan Mahesh-R9AADQ] Sure, will look into adding.

Good.

>>     * [-j jobs]: number of jobs for make to spawn during compile; default=4
>>     * [-t tasks]: number of bitbake tasks that can be issued in parallel; default=4
>
> I understand the need for it but I am a little concerned about using
> command line options. bitbake use environment to override things, so
> you can:
>
> MACHINE=wandboard-dual bitbake core-image-base
>
> and with the default local.conf, it will respect the environment
> variable. So we could support same thing, as:
>
> BB_NUMBER_THREADS=8 PARALLEL_MAKE='-j 12' source ./setup-environment <builddir>
>
> [Mahadevan Mahesh-R9AADQ] That's correct, but the idea behind doing this is to make it simpler for the user with some check for valid machine type.

The problem I see is not the machine validation (which can be done)
but the different way of work. If people use:

MACHINE=<machine> source ./setup-environment build

It will be natural for them to use:

MACHINE=<another machine> bitbake ...

So we're consistent on how to use things. You can validate the used
machine for setup-environment but using two ways for same thing is
confusing.

>>     * [-b path]: non-default build dir location; default location is /home/r9aadq/yocto/build
>
> This one I disagree; I think we always should pass build dir so user
> know where he is going.
>
> [Mahadevan Mahesh-R9AADQ] I can make the -b option mandatory
>
>>     * [-h]: help
>
> ok; please support --help here as well.
>
> [Mahadevan Mahesh-R9AADQ] Sure will do.

Ok

>> Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@freescale.com>
>> ---
>>  setup-environment |   91 +++++++++++++++++++++++++++++++++++++++++++++++------
>>  1 file changed, 81 insertions(+), 10 deletions(-)
>>
>> diff --git a/setup-environment b/setup-environment
>> index 6aadbb4..96b1e26 100644
>> --- a/setup-environment
>> +++ b/setup-environment
>> @@ -17,13 +17,88 @@
>>  # 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`
>> +
>> +usage()
>> +{
>> +    echo -e "\nUsage: source ${BASH_SOURCE[0]} <-m machine>
>> +    Optional parameters: [-j jobs] [-t tasks] [-h]"
>> +    echo -e -n "\n Supported machines: `ls $CWD/sources/meta-fsl-arm/conf/machine \
>> +    | grep -v "^include" | sed s/\.conf//g | xargs echo`"
>> +echo "
>
> Check other layers; you could:
>
> ls $CWD/sources/*/conf/machine/*.conf
>
> [Mahadevan Mahesh-R9AADQ] Thanks, will look into using this

Ok

>> +    * [-j jobs]: number of jobs for make to spawn during compile; default=$NCPU
>> +    * [-t tasks]: number of bitbake tasks that can be issued in parallel; default=$NCPU
>> +    * [-b path]: non-default build dir location; default location is $CWD/build
>> +    * [-h]: help
>
> Was commented above.
>
>> +}
>> +
>> +clean_up()
>> +{
>> +   unset EULA MACHINE JOBS THREADS LIST_MACHINES VALID_MACHINE BUILD_DIR
>> +   unset NCPU CWD TEMPLATES
>> +   unset imx_poky_setup_j imx_poky_setup_t imx_poky_setup_help imx_poky_setup_error
>
> Please drop imx prefix here; use fslc so it does not restrict to imx.
>
> [Mahadevan Mahesh-R9AADQ] Isn't this script intended for imx targets, or would you prefer I use fsl instead?

No; it is intended for use with fsl-community-bsp and we can have more
than i.MX here. Better to avoid 'imx' when something is not really
specific and this script has nothing specific.

--
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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [fsl-community-bsp-platform][PATCH] setup-environment: add options for the script
  2013-05-18  1:33 ` John Weber
@ 2013-05-19  2:05   ` Mahadevan Mahesh-R9AADQ
  0 siblings, 0 replies; 17+ messages in thread
From: Mahadevan Mahesh-R9AADQ @ 2013-05-19  2:05 UTC (permalink / raw)
  To: John Weber; +Cc: meta-freescale

[-- Attachment #1: Type: text/plain, Size: 5625 bytes --]

Sure, will add meta-fsl-arm-extra as well.

From: meta-freescale-bounces@yoctoproject.org [mailto:meta-freescale-bounces@yoctoproject.org] On Behalf Of John Weber
Sent: Friday, May 17, 2013 8:34 PM
Cc: meta-freescale@yoctoproject.org
Subject: Re: [meta-freescale] [fsl-community-bsp-platform][PATCH] setup-environment: add options for the script

Is it possible to also include machines in the other layers?   For example meta-fsl-arm-extra?


On Friday, May 17, 2013, Mahesh Mahadevan wrote:
From: Mahesh Mahadevan <mahesh.mahadevan@freescale.com<javascript:;>>

Add options to help specify the machine, below are the options added:
Usage: source ./setup-environment <-m machine>
    Optional parameters: [-j jobs] [-t tasks] [-h]

 Supported machines: imx23evk imx28evk imx31pdk imx35pdk imx51evk imx53ard imx53qsb imx6dlsabresd imx6qsabreauto imx6qsabresd imx6slevk
    * [-j jobs]: number of jobs for make to spawn during compile; default=4
    * [-t tasks]: number of bitbake tasks that can be issued in parallel; default=4
    * [-b path]: non-default build dir location; default location is /home/r9aadq/yocto/build
    * [-h]: help

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@freescale.com<javascript:;>>
---
 setup-environment |   91 +++++++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 81 insertions(+), 10 deletions(-)

diff --git a/setup-environment b/setup-environment
index 6aadbb4..96b1e26 100644
--- a/setup-environment
+++ b/setup-environment
@@ -17,13 +17,88 @@
 # 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`
+
+usage()
+{
+    echo -e "\nUsage: source ${BASH_SOURCE[0]} <-m machine>
+    Optional parameters: [-j jobs] [-t tasks] [-h]"
+    echo -e -n "\n Supported machines: `ls $CWD/sources/meta-fsl-arm/conf/machine \
+    | grep -v "^include" | sed s/\.conf//g | xargs echo`"
+echo "
+    * [-j jobs]: number of jobs for make to spawn during compile; default=$NCPU
+    * [-t tasks]: number of bitbake tasks that can be issued in parallel; default=$NCPU
+    * [-b path]: non-default build dir location; default location is $CWD/build
+    * [-h]: help
+"
+}
+
+clean_up()
+{
+   unset EULA MACHINE JOBS THREADS LIST_MACHINES VALID_MACHINE BUILD_DIR
+   unset NCPU CWD TEMPLATES
+   unset imx_poky_setup_j imx_poky_setup_t imx_poky_setup_help imx_poky_setup_error
+}
+
+# get command line options
+OLD_OPTIND=$OPTIND
+while getopts "m:r:t:b:h" imx_poky_setup_flag
+do
+    case $imx_poky_setup_flag in
+        m) MACHINE="$OPTARG";
+           ;;
+        j) imx_poky_setup_j="$OPTARG";
+           ;;
+        t) imx_poky_setup_t="$OPTARG";
+           ;;
+        b) BUILD_DIR="$CWD/$OPTARG";
+           ;;
+        h) imx_poky_setup_help='true';
+           ;;
+        ?) imx_poky_setup_error='true';
+           ;;
+    esac
+done
+OPTIND=$OLD_OPTIND

 if [ "$(whoami)" = "root" ]; then
     echo "ERROR: do not use the BSP as root. Exiting..."
 fi

-if [ -z "$MACHINE" ]; then
-    MACHINE='imx6qsabresd'
+# check the "-h" and other not supported options
+if test $imx_poky_setup_error || test $imx_poky_setup_help; then
+    usage && clean_up && return 1
+fi
+
+# Check the machine type specified
+LIST_MACHINES=`ls $CWD/sources/meta-fsl-arm/conf/machine`
+VALID_MACHINE=`echo -e "$LIST_MACHINES" | grep ${MACHINE}.conf$ | wc -l`
+if [ "x$MACHINE" = "x" ] || [ "$VALID_MACHINE" = "0" ]; then
+    echo "Invalid machine type!"
+    usage && clean_up
+    return 1
+else
+    echo "Configuring for ${MACHINE}"
+fi
+
+if [ -n "$imx_poky_setup_j" ] && [[ "$imx_poky_setup_j" =~ ^[0-9]+$ ]]; then
+    JOBS=$imx_poky_setup_j
+else
+    JOBS=$NCPU
+fi
+
+if [ -n "$fsl_poky_setup_t" ] && [[ "$fsl_poky_setup_t" =~ ^[0-9]+$ ]]; then
+    THREADS=$imx_poky_setup_t
+else
+    THREADS=$NCPU
+fi
+
+if [ -z "$BUILD_DIR" ]; then
+    BUILD_DIR=$CWD/build
 fi

 if [ -z "$SDKMACHINE" ]; then
@@ -39,8 +114,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
@@ -62,7 +135,7 @@ fi

 cd $OEROOT

-. ./oe-init-build-env $CWD/$1 > /dev/null
+. ./oe-init-build-env $BUILD_DIR > /dev/null

 # Clean up PATH, because if it includes tokens to current directories somehow,
 # wrong binaries can be used instead of the expected ones during task execution
@@ -74,12 +147,11 @@ 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

-BB_NUMBER_THREADS = '$NCPU'
-PARALLEL_MAKE = '-j $NCPU'
+BB_NUMBER_THREADS = '$THREADS'
+PARALLEL_MAKE = '-j $JOBS'
 EOF
     # Change settings according environment
     sed -e "s,MACHINE ??=.*,MACHINE ??= '$MACHINE',g" \
@@ -167,5 +239,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.7.10.4


_______________________________________________
meta-freescale mailing list
meta-freescale@yoctoproject.org<javascript:;>
https://lists.yoctoproject.org/listinfo/meta-freescale

[-- Attachment #2: Type: text/html, Size: 10992 bytes --]

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [fsl-community-bsp-platform][PATCH] setup-environment: add options for the script
  2013-05-18 14:15 ` Otavio Salvador
@ 2013-05-19  2:04   ` Mahadevan Mahesh-R9AADQ
  2013-05-19 19:43     ` Otavio Salvador
  0 siblings, 1 reply; 17+ messages in thread
From: Mahadevan Mahesh-R9AADQ @ 2013-05-19  2:04 UTC (permalink / raw)
  To: Otavio Salvador; +Cc: meta-freescale

Hi Otavio, 
Replies interspersed below.

Best regards,
-Mahesh

-----Original Message-----
From: otavio.salvador@gmail.com [mailto:otavio.salvador@gmail.com] On Behalf Of Otavio Salvador
Sent: Saturday, May 18, 2013 9:15 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 Fri, May 17, 2013 at 10:02 PM, Mahesh Mahadevan
<Mahesh.Mahadevan@freescale.com> wrote:
> From: Mahesh Mahadevan <mahesh.mahadevan@freescale.com>
>
> Add options to help specify the machine, below are the options added:
> Usage: source ./setup-environment <-m machine>
>     Optional parameters: [-j jobs] [-t tasks] [-h]
>
>  Supported machines: imx23evk imx28evk imx31pdk imx35pdk imx51evk imx53ard imx53qsb imx6dlsabresd imx6qsabreauto imx6qsabresd imx6slevk

The meta-fsl-arm-extra machines are missing.

[Mahadevan Mahesh-R9AADQ] Sure, will look into adding.

>     * [-j jobs]: number of jobs for make to spawn during compile; default=4
>     * [-t tasks]: number of bitbake tasks that can be issued in parallel; default=4

I understand the need for it but I am a little concerned about using
command line options. bitbake use environment to override things, so
you can:

MACHINE=wandboard-dual bitbake core-image-base

and with the default local.conf, it will respect the environment
variable. So we could support same thing, as:

BB_NUMBER_THREADS=8 PARALLEL_MAKE='-j 12' source ./setup-environment <builddir>

[Mahadevan Mahesh-R9AADQ] That's correct, but the idea behind doing this is to make it simpler for the user with some check for valid machine type.

>     * [-b path]: non-default build dir location; default location is /home/r9aadq/yocto/build

This one I disagree; I think we always should pass build dir so user
know where he is going.

[Mahadevan Mahesh-R9AADQ] I can make the -b option mandatory

>     * [-h]: help

ok; please support --help here as well.

[Mahadevan Mahesh-R9AADQ] Sure will do.

> Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@freescale.com>
> ---
>  setup-environment |   91 +++++++++++++++++++++++++++++++++++++++++++++++------
>  1 file changed, 81 insertions(+), 10 deletions(-)
>
> diff --git a/setup-environment b/setup-environment
> index 6aadbb4..96b1e26 100644
> --- a/setup-environment
> +++ b/setup-environment
> @@ -17,13 +17,88 @@
>  # 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`
> +
> +usage()
> +{
> +    echo -e "\nUsage: source ${BASH_SOURCE[0]} <-m machine>
> +    Optional parameters: [-j jobs] [-t tasks] [-h]"
> +    echo -e -n "\n Supported machines: `ls $CWD/sources/meta-fsl-arm/conf/machine \
> +    | grep -v "^include" | sed s/\.conf//g | xargs echo`"
> +echo "

Check other layers; you could:

ls $CWD/sources/*/conf/machine/*.conf

[Mahadevan Mahesh-R9AADQ] Thanks, will look into using this

> +    * [-j jobs]: number of jobs for make to spawn during compile; default=$NCPU
> +    * [-t tasks]: number of bitbake tasks that can be issued in parallel; default=$NCPU
> +    * [-b path]: non-default build dir location; default location is $CWD/build
> +    * [-h]: help

Was commented above.

> +}
> +
> +clean_up()
> +{
> +   unset EULA MACHINE JOBS THREADS LIST_MACHINES VALID_MACHINE BUILD_DIR
> +   unset NCPU CWD TEMPLATES
> +   unset imx_poky_setup_j imx_poky_setup_t imx_poky_setup_help imx_poky_setup_error

Please drop imx prefix here; use fslc so it does not restrict to imx.

[Mahadevan Mahesh-R9AADQ] Isn't this script intended for imx targets, or would you prefer I use fsl instead?

...

I didn't review the other change as many are dependent from the above
ones. What you think?

--
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




^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [fsl-community-bsp-platform][PATCH] setup-environment: add options for the script
  2013-05-18  1:02 Mahesh Mahadevan
  2013-05-18  1:33 ` John Weber
@ 2013-05-18 14:15 ` Otavio Salvador
  2013-05-19  2:04   ` Mahadevan Mahesh-R9AADQ
  1 sibling, 1 reply; 17+ messages in thread
From: Otavio Salvador @ 2013-05-18 14:15 UTC (permalink / raw)
  To: Mahesh Mahadevan; +Cc: meta-freescale

On Fri, May 17, 2013 at 10:02 PM, Mahesh Mahadevan
<Mahesh.Mahadevan@freescale.com> wrote:
> From: Mahesh Mahadevan <mahesh.mahadevan@freescale.com>
>
> Add options to help specify the machine, below are the options added:
> Usage: source ./setup-environment <-m machine>
>     Optional parameters: [-j jobs] [-t tasks] [-h]
>
>  Supported machines: imx23evk imx28evk imx31pdk imx35pdk imx51evk imx53ard imx53qsb imx6dlsabresd imx6qsabreauto imx6qsabresd imx6slevk

The meta-fsl-arm-extra machines are missing.

>     * [-j jobs]: number of jobs for make to spawn during compile; default=4
>     * [-t tasks]: number of bitbake tasks that can be issued in parallel; default=4

I understand the need for it but I am a little concerned about using
command line options. bitbake use environment to override things, so
you can:

MACHINE=wandboard-dual bitbake core-image-base

and with the default local.conf, it will respect the environment
variable. So we could support same thing, as:

BB_NUMBER_THREADS=8 PARALLEL_MAKE='-j 12' source ./setup-environment <builddir>

>     * [-b path]: non-default build dir location; default location is /home/r9aadq/yocto/build

This one I disagree; I think we always should pass build dir so user
know where he is going.

>     * [-h]: help

ok; please support --help here as well.

> Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@freescale.com>
> ---
>  setup-environment |   91 +++++++++++++++++++++++++++++++++++++++++++++++------
>  1 file changed, 81 insertions(+), 10 deletions(-)
>
> diff --git a/setup-environment b/setup-environment
> index 6aadbb4..96b1e26 100644
> --- a/setup-environment
> +++ b/setup-environment
> @@ -17,13 +17,88 @@
>  # 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`
> +
> +usage()
> +{
> +    echo -e "\nUsage: source ${BASH_SOURCE[0]} <-m machine>
> +    Optional parameters: [-j jobs] [-t tasks] [-h]"
> +    echo -e -n "\n Supported machines: `ls $CWD/sources/meta-fsl-arm/conf/machine \
> +    | grep -v "^include" | sed s/\.conf//g | xargs echo`"
> +echo "

Check other layers; you could:

ls $CWD/sources/*/conf/machine/*.conf

> +    * [-j jobs]: number of jobs for make to spawn during compile; default=$NCPU
> +    * [-t tasks]: number of bitbake tasks that can be issued in parallel; default=$NCPU
> +    * [-b path]: non-default build dir location; default location is $CWD/build
> +    * [-h]: help

Was commented above.

> +}
> +
> +clean_up()
> +{
> +   unset EULA MACHINE JOBS THREADS LIST_MACHINES VALID_MACHINE BUILD_DIR
> +   unset NCPU CWD TEMPLATES
> +   unset imx_poky_setup_j imx_poky_setup_t imx_poky_setup_help imx_poky_setup_error

Please drop imx prefix here; use fslc so it does not restrict to imx.

...

I didn't review the other change as many are dependent from the above
ones. What you think?

--
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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [fsl-community-bsp-platform][PATCH] setup-environment: add options for the script
  2013-05-18  1:02 Mahesh Mahadevan
@ 2013-05-18  1:33 ` John Weber
  2013-05-19  2:05   ` Mahadevan Mahesh-R9AADQ
  2013-05-18 14:15 ` Otavio Salvador
  1 sibling, 1 reply; 17+ messages in thread
From: John Weber @ 2013-05-18  1:33 UTC (permalink / raw)
  Cc: meta-freescale

[-- Attachment #1: Type: text/plain, Size: 5626 bytes --]

Is it possible to also include machines in the other layers?   For example
meta-fsl-arm-extra?


On Friday, May 17, 2013, Mahesh Mahadevan wrote:

> From: Mahesh Mahadevan <mahesh.mahadevan@freescale.com <javascript:;>>
>
> Add options to help specify the machine, below are the options added:
> Usage: source ./setup-environment <-m machine>
>     Optional parameters: [-j jobs] [-t tasks] [-h]
>
>  Supported machines: imx23evk imx28evk imx31pdk imx35pdk imx51evk imx53ard
> imx53qsb imx6dlsabresd imx6qsabreauto imx6qsabresd imx6slevk
>     * [-j jobs]: number of jobs for make to spawn during compile; default=4
>     * [-t tasks]: number of bitbake tasks that can be issued in parallel;
> default=4
>     * [-b path]: non-default build dir location; default location is
> /home/r9aadq/yocto/build
>     * [-h]: help
>
> Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@freescale.com<javascript:;>
> >
> ---
>  setup-environment |   91
> +++++++++++++++++++++++++++++++++++++++++++++++------
>  1 file changed, 81 insertions(+), 10 deletions(-)
>
> diff --git a/setup-environment b/setup-environment
> index 6aadbb4..96b1e26 100644
> --- a/setup-environment
> +++ b/setup-environment
> @@ -17,13 +17,88 @@
>  # 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`
> +
> +usage()
> +{
> +    echo -e "\nUsage: source ${BASH_SOURCE[0]} <-m machine>
> +    Optional parameters: [-j jobs] [-t tasks] [-h]"
> +    echo -e -n "\n Supported machines: `ls
> $CWD/sources/meta-fsl-arm/conf/machine \
> +    | grep -v "^include" | sed s/\.conf//g | xargs echo`"
> +echo "
> +    * [-j jobs]: number of jobs for make to spawn during compile;
> default=$NCPU
> +    * [-t tasks]: number of bitbake tasks that can be issued in parallel;
> default=$NCPU
> +    * [-b path]: non-default build dir location; default location is
> $CWD/build
> +    * [-h]: help
> +"
> +}
> +
> +clean_up()
> +{
> +   unset EULA MACHINE JOBS THREADS LIST_MACHINES VALID_MACHINE BUILD_DIR
> +   unset NCPU CWD TEMPLATES
> +   unset imx_poky_setup_j imx_poky_setup_t imx_poky_setup_help
> imx_poky_setup_error
> +}
> +
> +# get command line options
> +OLD_OPTIND=$OPTIND
> +while getopts "m:r:t:b:h" imx_poky_setup_flag
> +do
> +    case $imx_poky_setup_flag in
> +        m) MACHINE="$OPTARG";
> +           ;;
> +        j) imx_poky_setup_j="$OPTARG";
> +           ;;
> +        t) imx_poky_setup_t="$OPTARG";
> +           ;;
> +        b) BUILD_DIR="$CWD/$OPTARG";
> +           ;;
> +        h) imx_poky_setup_help='true';
> +           ;;
> +        ?) imx_poky_setup_error='true';
> +           ;;
> +    esac
> +done
> +OPTIND=$OLD_OPTIND
>
>  if [ "$(whoami)" = "root" ]; then
>      echo "ERROR: do not use the BSP as root. Exiting..."
>  fi
>
> -if [ -z "$MACHINE" ]; then
> -    MACHINE='imx6qsabresd'
> +# check the "-h" and other not supported options
> +if test $imx_poky_setup_error || test $imx_poky_setup_help; then
> +    usage && clean_up && return 1
> +fi
> +
> +# Check the machine type specified
> +LIST_MACHINES=`ls $CWD/sources/meta-fsl-arm/conf/machine`
> +VALID_MACHINE=`echo -e "$LIST_MACHINES" | grep ${MACHINE}.conf$ | wc -l`
> +if [ "x$MACHINE" = "x" ] || [ "$VALID_MACHINE" = "0" ]; then
> +    echo "Invalid machine type!"
> +    usage && clean_up
> +    return 1
> +else
> +    echo "Configuring for ${MACHINE}"
> +fi
> +
> +if [ -n "$imx_poky_setup_j" ] && [[ "$imx_poky_setup_j" =~ ^[0-9]+$ ]];
> then
> +    JOBS=$imx_poky_setup_j
> +else
> +    JOBS=$NCPU
> +fi
> +
> +if [ -n "$fsl_poky_setup_t" ] && [[ "$fsl_poky_setup_t" =~ ^[0-9]+$ ]];
> then
> +    THREADS=$imx_poky_setup_t
> +else
> +    THREADS=$NCPU
> +fi
> +
> +if [ -z "$BUILD_DIR" ]; then
> +    BUILD_DIR=$CWD/build
>  fi
>
>  if [ -z "$SDKMACHINE" ]; then
> @@ -39,8 +114,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
> @@ -62,7 +135,7 @@ fi
>
>  cd $OEROOT
>
> -. ./oe-init-build-env $CWD/$1 > /dev/null
> +. ./oe-init-build-env $BUILD_DIR > /dev/null
>
>  # Clean up PATH, because if it includes tokens to current directories
> somehow,
>  # wrong binaries can be used instead of the expected ones during task
> execution
> @@ -74,12 +147,11 @@ 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
>
> -BB_NUMBER_THREADS = '$NCPU'
> -PARALLEL_MAKE = '-j $NCPU'
> +BB_NUMBER_THREADS = '$THREADS'
> +PARALLEL_MAKE = '-j $JOBS'
>  EOF
>      # Change settings according environment
>      sed -e "s,MACHINE ??=.*,MACHINE ??= '$MACHINE',g" \
> @@ -167,5 +239,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.7.10.4
>
>
> _______________________________________________
> meta-freescale mailing list
> meta-freescale@yoctoproject.org <javascript:;>
> https://lists.yoctoproject.org/listinfo/meta-freescale
>

[-- Attachment #2: Type: text/html, Size: 6876 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [fsl-community-bsp-platform][PATCH] setup-environment: add options for the script
@ 2013-05-18  1:02 Mahesh Mahadevan
  2013-05-18  1:33 ` John Weber
  2013-05-18 14:15 ` Otavio Salvador
  0 siblings, 2 replies; 17+ messages in thread
From: Mahesh Mahadevan @ 2013-05-18  1:02 UTC (permalink / raw)
  To: meta-freescale

From: Mahesh Mahadevan <mahesh.mahadevan@freescale.com>

Add options to help specify the machine, below are the options added:
Usage: source ./setup-environment <-m machine>
    Optional parameters: [-j jobs] [-t tasks] [-h]

 Supported machines: imx23evk imx28evk imx31pdk imx35pdk imx51evk imx53ard imx53qsb imx6dlsabresd imx6qsabreauto imx6qsabresd imx6slevk
    * [-j jobs]: number of jobs for make to spawn during compile; default=4
    * [-t tasks]: number of bitbake tasks that can be issued in parallel; default=4
    * [-b path]: non-default build dir location; default location is /home/r9aadq/yocto/build
    * [-h]: help

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@freescale.com>
---
 setup-environment |   91 +++++++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 81 insertions(+), 10 deletions(-)

diff --git a/setup-environment b/setup-environment
index 6aadbb4..96b1e26 100644
--- a/setup-environment
+++ b/setup-environment
@@ -17,13 +17,88 @@
 # 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`
+
+usage()
+{
+    echo -e "\nUsage: source ${BASH_SOURCE[0]} <-m machine>
+    Optional parameters: [-j jobs] [-t tasks] [-h]"
+    echo -e -n "\n Supported machines: `ls $CWD/sources/meta-fsl-arm/conf/machine \
+    | grep -v "^include" | sed s/\.conf//g | xargs echo`"
+echo "
+    * [-j jobs]: number of jobs for make to spawn during compile; default=$NCPU
+    * [-t tasks]: number of bitbake tasks that can be issued in parallel; default=$NCPU
+    * [-b path]: non-default build dir location; default location is $CWD/build
+    * [-h]: help
+"
+}
+
+clean_up()
+{
+   unset EULA MACHINE JOBS THREADS LIST_MACHINES VALID_MACHINE BUILD_DIR
+   unset NCPU CWD TEMPLATES
+   unset imx_poky_setup_j imx_poky_setup_t imx_poky_setup_help imx_poky_setup_error
+}
+
+# get command line options
+OLD_OPTIND=$OPTIND
+while getopts "m:r:t:b:h" imx_poky_setup_flag
+do
+    case $imx_poky_setup_flag in
+        m) MACHINE="$OPTARG";
+           ;;
+        j) imx_poky_setup_j="$OPTARG";
+           ;;
+        t) imx_poky_setup_t="$OPTARG";
+           ;;
+        b) BUILD_DIR="$CWD/$OPTARG";
+           ;;
+        h) imx_poky_setup_help='true';
+           ;;
+        ?) imx_poky_setup_error='true';
+           ;;
+    esac
+done
+OPTIND=$OLD_OPTIND
 
 if [ "$(whoami)" = "root" ]; then
     echo "ERROR: do not use the BSP as root. Exiting..."
 fi
 
-if [ -z "$MACHINE" ]; then
-    MACHINE='imx6qsabresd'
+# check the "-h" and other not supported options
+if test $imx_poky_setup_error || test $imx_poky_setup_help; then
+    usage && clean_up && return 1
+fi
+
+# Check the machine type specified
+LIST_MACHINES=`ls $CWD/sources/meta-fsl-arm/conf/machine`
+VALID_MACHINE=`echo -e "$LIST_MACHINES" | grep ${MACHINE}.conf$ | wc -l`
+if [ "x$MACHINE" = "x" ] || [ "$VALID_MACHINE" = "0" ]; then
+    echo "Invalid machine type!"
+    usage && clean_up
+    return 1
+else
+    echo "Configuring for ${MACHINE}"
+fi
+
+if [ -n "$imx_poky_setup_j" ] && [[ "$imx_poky_setup_j" =~ ^[0-9]+$ ]]; then
+    JOBS=$imx_poky_setup_j
+else
+    JOBS=$NCPU
+fi
+
+if [ -n "$fsl_poky_setup_t" ] && [[ "$fsl_poky_setup_t" =~ ^[0-9]+$ ]]; then
+    THREADS=$imx_poky_setup_t
+else
+    THREADS=$NCPU
+fi
+
+if [ -z "$BUILD_DIR" ]; then
+    BUILD_DIR=$CWD/build
 fi
 
 if [ -z "$SDKMACHINE" ]; then
@@ -39,8 +114,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
@@ -62,7 +135,7 @@ fi
 
 cd $OEROOT
 
-. ./oe-init-build-env $CWD/$1 > /dev/null
+. ./oe-init-build-env $BUILD_DIR > /dev/null
 
 # Clean up PATH, because if it includes tokens to current directories somehow,
 # wrong binaries can be used instead of the expected ones during task execution
@@ -74,12 +147,11 @@ 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
 
-BB_NUMBER_THREADS = '$NCPU'
-PARALLEL_MAKE = '-j $NCPU'
+BB_NUMBER_THREADS = '$THREADS'
+PARALLEL_MAKE = '-j $JOBS'
 EOF
     # Change settings according environment
     sed -e "s,MACHINE ??=.*,MACHINE ??= '$MACHINE',g" \
@@ -167,5 +239,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.7.10.4




^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2013-05-31 12:41 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-21 14:01 [fsl-community-bsp-platform][PATCH] setup-environment: add options for the script Mahesh Mahadevan
2013-05-22 13:19 ` Otavio Salvador
2013-05-22 14:09   ` Mahadevan Mahesh-R9AADQ
2013-05-22 14:53     ` Otavio Salvador
2013-05-22 15:23       ` Mahadevan Mahesh-R9AADQ
2013-05-30 19:16   ` Mahadevan Mahesh-R9AADQ
2013-05-31 12:41     ` Otavio Salvador
  -- strict thread matches above, loose matches on Subject: below --
2013-05-21  4:32 Mahesh Mahadevan
2013-05-21  4:38 ` Otavio Salvador
2013-05-20 19:26 Mahesh Mahadevan
2013-05-20 19:41 ` Otavio Salvador
2013-05-18  1:02 Mahesh Mahadevan
2013-05-18  1:33 ` John Weber
2013-05-19  2:05   ` Mahadevan Mahesh-R9AADQ
2013-05-18 14:15 ` Otavio Salvador
2013-05-19  2:04   ` Mahadevan Mahesh-R9AADQ
2013-05-19 19:43     ` Otavio Salvador

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.