All of lore.kernel.org
 help / color / mirror / Atom feed
* [base][PATCH] setup-environment: Simplify use model for pre-existing build directory
@ 2016-11-11 19:30 Tom Hochstein
  2016-11-16 10:41 ` Florea, Tudor
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Hochstein @ 2016-11-11 19:30 UTC (permalink / raw)
  To: meta-freescale

The script setup-environment requires that MACHINE and DISTRO be set.
However, these variables are only used when creating a new build directory,
and they should not be required when using a pre-existing build directory.

Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
---
 setup-environment | 48 ++++++++++++++++++++++++++++++++++--------------
 1 file changed, 34 insertions(+), 14 deletions(-)

diff --git a/setup-environment b/setup-environment
index a3eae7b..a04ffae 100755
--- a/setup-environment
+++ b/setup-environment
@@ -25,12 +25,21 @@ PROGNAME="setup-environment"
 
 usage()
 {
-    echo -e "\nUsage:MACHINE=<machine> DISTRO=<distro> source $PROGNAME <build-dir>
-    <build-dir>: specifies the build directory location (required)
-    <machine>:   specifies the machine name (required)
-    <distro>:    specifies the distro name (required)
-
-You must set \$MACHINE and \$DISTRO before setting up the environment.
+    echo -e "
+Usage: MACHINE=<machine> DISTRO=<distro> source $PROGNAME <build-dir>
+Usage:                                   source $PROGNAME <build-dir>
+    <machine>    machine name
+    <distro>     distro name
+    <build-dir>  build directory
+
+The first usage is for creating a new build directory. In this case, the
+script creates the build directory <build-dir>, configures it for the
+specified <machine> and <distro>, and prepares the calling shell for running
+bitbake on the build directory.
+
+The second usage is for using an existing build directory. In this case,
+the script prepares the calling shell for running bitbake on the build
+directory <build-dir>. The build directory configuration is unchanged.
 "
 
     ls sources/*/conf/machine/*.conf > /dev/null 2>&1
@@ -46,9 +55,14 @@ Supported Freescale's distros: `echo; ls sources/meta-freescale-distro/conf/dist
 Available Poky's distros: `echo; ls sources/poky/meta-poky/conf/distro/*.conf \
 | sed s/\.conf//g | sed -r 's/^.+\///' | xargs -I% echo -e "\t%"`
 
-To build for a machine and distro listed above, run this script as:
-MACHINE=<machine> DISTRO=<distro> source $PROGNAME <build-dir>
-Ex: MACHINE=imx6qsabresd DISTRO=fslc-framebuffer source $PROGNAME build"
+Examples:
+
+- To create a new Yocto build directory:
+  $ MACHINE=imx6qsabresd DISTRO=fslc-framebuffer source $PROGNAME build
+
+- To use an existing Yocto build directory:
+  $ source $PROGNAME build
+"
     fi
 }
 
@@ -92,9 +106,15 @@ if [ "$(whoami)" = "root" ]; then
     echo "ERROR: do not use the BSP as root. Exiting..."
 fi
 
-if [ -z "$MACHINE" ]; then
+if [ ! -e $1/conf/local.conf.sample ]; then
+    build_dir_setup_enabled="true"
+else
+    build_dir_setup_enabled="false"
+fi
+
+if [ "$build_dir_setup_enabled" = "true" ] && [ -z "$MACHINE" ]; then
     usage
-    echo -e "\nYou must set \$MACHINE before setting up the environment."
+    echo -e "ERROR: You must set MACHINE when creating a new build directory."
     clean_up
     return 1
 fi
@@ -103,9 +123,9 @@ if [ -z "$SDKMACHINE" ]; then
     SDKMACHINE='i686'
 fi
 
-if [ -z "$DISTRO" ]; then
+if [ "$build_dir_setup_enabled" = "true" ] && [ -z "$DISTRO" ]; then
     usage
-    echo -e "\nYou must set \$DISTRO before setting up the environment."
+    echo -e "ERROR: You must set DISTRO when creating a new build directory."
     clean_up
     return 1
 fi
@@ -146,7 +166,7 @@ fi
 export PATH="`echo $PATH | sed 's/\(:.\|:\)*:/:/g;s/^.\?://;s/:.\?$//'`"
 
 generated_config=
-if [ ! -e conf/local.conf.sample ]; then
+if [ "$build_dir_setup_enabled" = "true" ]; then
     mv conf/local.conf conf/local.conf.sample
 
     # Generate the local.conf based on the Yocto defaults
-- 
1.9.1



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

* Re: [base][PATCH] setup-environment: Simplify use model for pre-existing build directory
  2016-11-11 19:30 [base][PATCH] setup-environment: Simplify use model for pre-existing build directory Tom Hochstein
@ 2016-11-16 10:41 ` Florea, Tudor
  2016-12-08 13:32   ` Otavio Salvador
  0 siblings, 1 reply; 3+ messages in thread
From: Florea, Tudor @ 2016-11-16 10:41 UTC (permalink / raw)
  To: Tom Hochstein, meta-freescale

Hi,

Poky already provide a versatile mechanism for setting up the build environment [1]:
TEMPLATECONF=/path/to/my/conf .  [path_to]/oe-init-build-env [build_dir].

Is it a particular reason to diverge from this?

With this script I can no longer point to my template conf directory.

The chances are that my machine, my distro name and my common target are all custom.

I see that one think this script is doing is explicitly accepting the EULA (one time only). 
Most probably this is implicitly accepted as per the content of my/conf/local.conf.sample.  I assume I'm allowed to do this; is that true? 
For this purpose a separate script modifying the existing conf/local.conf is more simple and more intuitive. 
The same approach could be used for setting up the (SDK)MACHINE and DISTRO if those aren't already set on local.conf.sample
The conf-notest.txt might issue the fact that above script(s) need to be run (once) to complete the environment setup.

Regards,
  Tudor.

[1] http://www.yoctoproject.org/docs/2.1/dev-manual/dev-manual.html#creating-a-custom-template-configuration-directory

> -----Original Message-----
> From: meta-freescale-bounces@yoctoproject.org [mailto:meta-freescale-
> bounces@yoctoproject.org] On Behalf Of Tom Hochstein
> Sent: Friday, 11 November, 2016 19:30
> To: meta-freescale@yoctoproject.org
> Subject: [meta-freescale] [base][PATCH] setup-environment: Simplify use
> model for pre-existing build directory
> 
> The script setup-environment requires that MACHINE and DISTRO be set.
> However, these variables are only used when creating a new build directory,
> and they should not be required when using a pre-existing build directory.
> 
> Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
> ---
>  setup-environment | 48 ++++++++++++++++++++++++++++++++++---------
> -----
>  1 file changed, 34 insertions(+), 14 deletions(-)
> 
> diff --git a/setup-environment b/setup-environment index a3eae7b..a04ffae
> 100755
> --- a/setup-environment
> +++ b/setup-environment
> @@ -25,12 +25,21 @@ PROGNAME="setup-environment"
> 
>  usage()
>  {
> -    echo -e "\nUsage:MACHINE=<machine> DISTRO=<distro> source
> $PROGNAME <build-dir>
> -    <build-dir>: specifies the build directory location (required)
> -    <machine>:   specifies the machine name (required)
> -    <distro>:    specifies the distro name (required)
> -
> -You must set \$MACHINE and \$DISTRO before setting up the environment.
> +    echo -e "
> +Usage: MACHINE=<machine> DISTRO=<distro> source $PROGNAME
> <build-dir>
> +Usage:                                   source $PROGNAME <build-dir>
> +    <machine>    machine name
> +    <distro>     distro name
> +    <build-dir>  build directory
> +
> +The first usage is for creating a new build directory. In this case,
> +the script creates the build directory <build-dir>, configures it for
> +the specified <machine> and <distro>, and prepares the calling shell
> +for running bitbake on the build directory.
> +
> +The second usage is for using an existing build directory. In this
> +case, the script prepares the calling shell for running bitbake on the
> +build directory <build-dir>. The build directory configuration is unchanged.
>  "
> 
>      ls sources/*/conf/machine/*.conf > /dev/null 2>&1 @@ -46,9 +55,14 @@
> Supported Freescale's distros: `echo; ls sources/meta-freescale-
> distro/conf/dist
>  Available Poky's distros: `echo; ls sources/poky/meta-
> poky/conf/distro/*.conf \  | sed s/\.conf//g | sed -r 's/^.+\///' | xargs -I%
> echo -e "\t%"`
> 
> -To build for a machine and distro listed above, run this script as:
> -MACHINE=<machine> DISTRO=<distro> source $PROGNAME <build-dir>
> -Ex: MACHINE=imx6qsabresd DISTRO=fslc-framebuffer source $PROGNAME
> build"
> +Examples:
> +
> +- To create a new Yocto build directory:
> +  $ MACHINE=imx6qsabresd DISTRO=fslc-framebuffer source $PROGNAME
> build
> +
> +- To use an existing Yocto build directory:
> +  $ source $PROGNAME build
> +"
>      fi
>  }
> 
> @@ -92,9 +106,15 @@ if [ "$(whoami)" = "root" ]; then
>      echo "ERROR: do not use the BSP as root. Exiting..."
>  fi
> 
> -if [ -z "$MACHINE" ]; then
> +if [ ! -e $1/conf/local.conf.sample ]; then
> +    build_dir_setup_enabled="true"
> +else
> +    build_dir_setup_enabled="false"
> +fi
> +
> +if [ "$build_dir_setup_enabled" = "true" ] && [ -z "$MACHINE" ]; then
>      usage
> -    echo -e "\nYou must set \$MACHINE before setting up the environment."
> +    echo -e "ERROR: You must set MACHINE when creating a new build
> directory."
>      clean_up
>      return 1
>  fi
> @@ -103,9 +123,9 @@ if [ -z "$SDKMACHINE" ]; then
>      SDKMACHINE='i686'
>  fi
> 
> -if [ -z "$DISTRO" ]; then
> +if [ "$build_dir_setup_enabled" = "true" ] && [ -z "$DISTRO" ]; then
>      usage
> -    echo -e "\nYou must set \$DISTRO before setting up the environment."
> +    echo -e "ERROR: You must set DISTRO when creating a new build
> directory."
>      clean_up
>      return 1
>  fi
> @@ -146,7 +166,7 @@ fi
>  export PATH="`echo $PATH | sed 's/\(:.\|:\)*:/:/g;s/^.\?://;s/:.\?$//'`"
> 
>  generated_config=
> -if [ ! -e conf/local.conf.sample ]; then
> +if [ "$build_dir_setup_enabled" = "true" ]; then
>      mv conf/local.conf conf/local.conf.sample
> 
>      # Generate the local.conf based on the Yocto defaults
> --
> 1.9.1
> 
> --
> _______________________________________________
> meta-freescale mailing list
> meta-freescale@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/meta-freescale

_______________________________________________________________________
This e-mail and any files transmitted with it are proprietary and intended solely for the use of the individual or entity to whom they are addressed.  If you have reason to believe that you have received this e-mail in error, please notify the sender and destroy this e-mail and any attached files.  Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of the Curtiss-Wright Corporation or any of its subsidiaries.  Documents attached hereto may contain technology subject to government export regulations.  Recipient is solely responsible for ensuring that any re-export, transfer or disclosure of this information is in accordance with applicable government export regulations.  The recipient should check this e-mail and any attachments for the presence of viruses.  Curtiss-Wright Corporation and its subsidiaries accept no liability for any damage caused by any virus transmitted by this e-mail.


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

* Re: [base][PATCH] setup-environment: Simplify use model for pre-existing build directory
  2016-11-16 10:41 ` Florea, Tudor
@ 2016-12-08 13:32   ` Otavio Salvador
  0 siblings, 0 replies; 3+ messages in thread
From: Otavio Salvador @ 2016-12-08 13:32 UTC (permalink / raw)
  To: Florea, Tudor; +Cc: meta-freescale

Hello Tudor,

On Wed, Nov 16, 2016 at 8:41 AM, Florea, Tudor
<tflorea@curtisswright.com> wrote:
> Poky already provide a versatile mechanism for setting up the build environment [1]:
> TEMPLATECONF=/path/to/my/conf .  [path_to]/oe-init-build-env [build_dir].
>
> Is it a particular reason to diverge from this?
>
> With this script I can no longer point to my template conf directory.
>
> The chances are that my machine, my distro name and my common target are all custom.
>
> I see that one think this script is doing is explicitly accepting the EULA (one time only).
> Most probably this is implicitly accepted as per the content of my/conf/local.conf.sample.  I assume I'm allowed to do this; is that true?
> For this purpose a separate script modifying the existing conf/local.conf is more simple and more intuitive.
> The same approach could be used for setting up the (SDK)MACHINE and DISTRO if those aren't already set on local.conf.sample
> The conf-notest.txt might issue the fact that above script(s) need to be run (once) to complete the environment setup.

The idea of our setup-environment script is to allow for easy use of
the FSL Community BSP. We are wide open to trim the script down, if it
keep supporting the current features and become more generic. Please
feel free to send any patches you have which help us to move on this
direction :-)

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


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

end of thread, other threads:[~2016-12-08 13:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-11 19:30 [base][PATCH] setup-environment: Simplify use model for pre-existing build directory Tom Hochstein
2016-11-16 10:41 ` Florea, Tudor
2016-12-08 13:32   ` 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.