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

Reply via email to