Topics

remove zephyr-env.sh


Carles Cufi
 

Hi Inaky,

-----Original Message-----
From: Perez-Gonzalez, Inaky [mailto:inaky.perez-gonzalez(a)intel.com]
Sent: Wednesday, April 20, 2016 20:45
To: devel(a)lists.zephyrproject.org
Subject: [devel] RFC: remove zephyr-env.sh

Hello All

https://jira.zephyrproject.org/browse/ZEP-211 has been entered to track
a proposal to remove zephyr-env.sh.

<<from the ticket>>
Currently we require the user to source the zephyr-env.sh environment to
set up the build environment. This is awkward; things build fine without
it and the user still has to manually setup ZEPHYR_BASE,
ZEPHYR_GCC_VARIANT and ZEPHYR_SDK_INSTALL_DIR.
I might be mistaken but I believe ZEPHYR_BASE is indeed set by zephyr-env.sh, so it does not need to be set manually. In fact I ran into an issue where I had my own ZEPHYR_BASE set to "/home/me/src/zephyr" but was working on a separate "/home/me/src/zephyr-upstream/" copy of the repo and my changes to Kconfig obviously never showed up, leaving me puzzled. It is somehow convenient to be able to set the ZEPHYR_BASE to whatever copy of the repo one is building, but it would be even better if make itself would do that when building instead, based on the path where one executes it.

By the way, and as a side comment, paths containing "~" do not seem to work in ZEPHYR_BASE and <toolchain>_TOOLCHAIN_PATH. Instead one has to explicitly set "/home/me".

Carles


Perez-Gonzalez, Inaky <inaky.perez-gonzalez@...>
 

On Wed, 2016-04-20 at 19:35 +0000, Cufi, Carles wrote:
Hi Inaky,

From: Perez-Gonzalez, Inaky [mailto:inaky.perez-gonzalez(a)intel.com]
 
https://jira.zephyrproject.org/browse/ZEP-211 has been entered to
track
a proposal to remove zephyr-env.sh.

<<from the ticket>>
Currently we require the user to source the zephyr-env.sh
environment to
set up the build environment. This is awkward; things build fine
without
it and the user still has to manually setup ZEPHYR_BASE,
ZEPHYR_GCC_VARIANT and ZEPHYR_SDK_INSTALL_DIR. 
I might be mistaken but I believe ZEPHYR_BASE is indeed set by
zephyr-env.sh, so it does not need to be set manually. In fact I ran
into an issue where I had my own ZEPHYR_BASE set to
"/home/me/src/zephyr" but was working on a separate
"/home/me/src/zephyr-upstream/" copy of the repo and my changes to
Kconfig obviously never showed up, leaving me puzzled. It is somehow
convenient to be able to set the ZEPHYR_BASE to whatever copy of the
repo one is building, but it would be even better if make itself
would do that when building instead, based on the path where one
executes it.
to avoid those issues I usually run make ZEPHYR_BASE=DIR <blah>, which
is kind of more verbose, but gets the trick done.

However, I hear your call. I think it's worthwhile to consider the
posibility of having the Makefile "look" for the source (looking in top
level directories, following a symlink, $ZEPHYR_BASE or fail) -- the
trick is how to do it so it does not require a huge chunk of code in
each app's Makefile (it can't be in a library as we'd have to point to
it)

By the way, and as a side comment, paths containing "~" do not seem
to work in ZEPHYR_BASE and <toolchain>_TOOLCHAIN_PATH. Instead one
has to explicitly set "/home/me".
Mind filing a ticket for it, please?


Boie, Andrew P
 

From: Perez-Gonzalez, Inaky [mailto:inaky.perez-gonzalez(a)intel.com]
Currently we require the user to source the zephyr-env.sh environment to
set up the build environment. This is awkward; things build fine without
it and the user still has to manually setup ZEPHYR_BASE,
ZEPHYR_GCC_VARIANT and ZEPHYR_SDK_INSTALL_DIR. zephyr-env.sh has grown to
I don't believe this is the case.

You do have to set ZEPHYR_GCC_VARIANT and ZEPHYR_SDK_INSTALL_DIR. I put them in my .bashrc:

export ZEPHYR_GCC_VARIANT=zephyr
export ZEPHYR_SDK_INSTALL_DIR=/opt/zephyr-sdk/

However, ZEPHYR_BASE is specific to what Zephyr tree you are working in. I personally have several that I work in. This is not something I would want to globally set in my .bashrc. At minimum we would need to transplant this logic to the Makefiles.

From looking at the script it additionally:

1. Appends the ZEPHYR_BASE/scripts directory to the PATH
2. Sources ~/.zephyrrc if it exists (not sure what the use-case for this is, I don't personally use it).

Both of these seem optional, but to run stuff like sanitycheck from the command line you'd have to include a full path.

Andrew


Benjamin Walsh <benjamin.walsh@...>
 

On Wed, Apr 20, 2016 at 07:53:56PM +0000, Boie, Andrew P wrote:
From: Perez-Gonzalez, Inaky [mailto:inaky.perez-gonzalez(a)intel.com]
Currently we require the user to source the zephyr-env.sh environment to
set up the build environment. This is awkward; things build fine without
it and the user still has to manually setup ZEPHYR_BASE,
ZEPHYR_GCC_VARIANT and ZEPHYR_SDK_INSTALL_DIR. zephyr-env.sh has grown to
I don't believe this is the case.

You do have to set ZEPHYR_GCC_VARIANT and ZEPHYR_SDK_INSTALL_DIR. I
put them in my .bashrc:

export ZEPHYR_GCC_VARIANT=zephyr
export ZEPHYR_SDK_INSTALL_DIR=/opt/zephyr-sdk/

However, ZEPHYR_BASE is specific to what Zephyr tree you are working
in. I personally have several that I work in. This is not something I
would want to globally set in my .bashrc. At minimum we would need to
transplant this logic to the Makefiles.

From looking at the script it additionally:

1. Appends the ZEPHYR_BASE/scripts directory to the PATH
2. Sources ~/.zephyrrc if it exists (not sure what the use-case for
this is, I don't personally use it).
I use it instead of polluting my .bashrc with zephyr stuff. Basically,
your two export lines above go in there.

I personally like that zephyr-env.sh exists: you just have to source it
and your environment is fully set (if you put the two export lines above
in your ~/.zephyrrc as well).

Both of these seem optional, but to run stuff like sanitycheck from
the command line you'd have to include a full path.


Perez-Gonzalez, Inaky <inaky.perez-gonzalez@...>
 

On Wed, 2016-04-20 at 19:53 +0000, Boie, Andrew P wrote:

From: Perez-Gonzalez, Inaky [mailto:inaky.perez-gonzalez(a)intel.com]
Currently we require the user to source the zephyr-env.sh
environment to
set up the build environment. This is awkward; things build fine
without
it and the user still has to manually setup ZEPHYR_BASE,
ZEPHYR_GCC_VARIANT and ZEPHYR_SDK_INSTALL_DIR. zephyr-env.sh has
grown to
I don't believe this is the case.

You do have to set ZEPHYR_GCC_VARIANT and ZEPHYR_SDK_INSTALL_DIR. I
put them in my .bashrc:

export ZEPHYR_GCC_VARIANT=zephyr
export ZEPHYR_SDK_INSTALL_DIR=/opt/zephyr-sdk/

However, ZEPHYR_BASE is specific to what Zephyr tree you are working
in. I personally have several that I work in. This is not something I
would want to globally set in my .bashrc. At minimum we would need to
transplant this logic to the Makefiles.
Certainly, ZEPHYR_BASE is tree-specific (so could be the other in
certain cases, but uncommon). I also do set it manually (in fact, as I
said somewhere, I feed it to make's command line)

From looking at the script it additionally:

1. Appends the ZEPHYR_BASE/scripts directory to the PATH
This is the only one that might have some use--however, it still forces
you to work on the same session; if you fly through windows and tabs,
like I do, it's not as useful.

2. Sources ~/.zephyrrc if it exists (not sure what the use-case for
this is, I don't personally use it).
I haven't heard of anyone ever using this (hopefully they'll come up in
this thread).

Both of these seem optional, but to run stuff like sanitycheck from
the command line you'd have to include a full path.
Can we fold a 'make sanitycheck'-like solution? After all, if we can
figure out access to the Makefile, we can use it for accessing the
scripts too?


Nashif, Anas
 

On 20/04/2016, 15:58, "Perez-Gonzalez, Inaky" <inaky.perez-gonzalez(a)intel.com> wrote:

On Wed, 2016-04-20 at 19:53 +0000, Boie, Andrew P wrote:

From: Perez-Gonzalez, Inaky [mailto:inaky.perez-gonzalez(a)intel.com]
Currently we require the user to source the zephyr-env.sh
environment to
set up the build environment. This is awkward; things build fine
without
it and the user still has to manually setup ZEPHYR_BASE,
ZEPHYR_GCC_VARIANT and ZEPHYR_SDK_INSTALL_DIR. zephyr-env.sh has
grown to
I don't believe this is the case.

You do have to set ZEPHYR_GCC_VARIANT and ZEPHYR_SDK_INSTALL_DIR. I
put them in my .bashrc:

export ZEPHYR_GCC_VARIANT=zephyr
export ZEPHYR_SDK_INSTALL_DIR=/opt/zephyr-sdk/

However, ZEPHYR_BASE is specific to what Zephyr tree you are working
in. I personally have several that I work in. This is not something I
would want to globally set in my .bashrc. At minimum we would need to
transplant this logic to the Makefiles.
Certainly, ZEPHYR_BASE is tree-specific (so could be the other in
certain cases, but uncommon). I also do set it manually (in fact, as I
said somewhere, I feed it to make's command line)

if you think doing this

# make ZEPHYR_BASE=/path/to/source/tree BOARD=blah blah

hundreds of times per day is more convenient than doing 'source zephyr-env.sh’ once a day per shell then we have a different definition of convenience :-)



From looking at the script it additionally:

1. Appends the ZEPHYR_BASE/scripts directory to the PATH
This is the only one that might have some use--however, it still forces
you to work on the same session; if you fly through windows and tabs,
like I do, it's not as useful.

2. Sources ~/.zephyrrc if it exists (not sure what the use-case for
this is, I don't personally use it).
I haven't heard of anyone ever using this (hopefully they'll come up in
this thread).

I use it and it is also documented in the getting started guide.



Both of these seem optional, but to run stuff like sanitycheck from
the command line you'd have to include a full path.
Can we fold a 'make sanitycheck'-like solution? After all, if we can
figure out access to the Makefile, we can use it for accessing the
scripts too?

then you have to support all the nice options of sanity checks using make, do not know how user-friendly this will be.


Anas


Boie, Andrew P
 

-----Original Message-----
From: Perez-Gonzalez, Inaky
Certainly, ZEPHYR_BASE is tree-specific (so could be the other in certain
cases, but uncommon). I also do set it manually (in fact, as I said
somewhere, I feed it to make's command line)
I feel that is rather cumbersome.
I'm not sure if we can just migrate this to the build system, since the application Makefile has to find the main Zephyr Makefile somehow...it could be out-of-tree.

Can we fold a 'make sanitycheck'-like solution? After all, if we can
figure out access to the Makefile, we can use it for accessing the scripts
too?
Given the plethora of command line options to sanitycheck, a nontrivial subset of which are used fairly often, I don't see a path to success with this approach.

Andrew


Perez-Gonzalez, Inaky <inaky.perez-gonzalez@...>
 

On Wed, 2016-04-20 at 15:58 -0400, Benjamin Walsh wrote:
On Wed, Apr 20, 2016 at 07:53:56PM +0000, Boie, Andrew P wrote:


From: Perez-Gonzalez, Inaky [mailto:inaky.perez-gonzalez(a)intel.co
m]
Currently we require the user to source the zephyr-env.sh
environment to
set up the build environment. This is awkward; things build fine
without
it and the user still has to manually setup ZEPHYR_BASE,
ZEPHYR_GCC_VARIANT and ZEPHYR_SDK_INSTALL_DIR. zephyr-env.sh has
grown to
I don't believe this is the case.

Thanks for all the feedback -- it definitely looks that it is staying
as people very actively rely on it, so I'll close the ticket but first
I'll add the feedback to it for future reference in case anyone has the
same idea :)


Carles Cufi
 


By the way, and as a side comment, paths containing "~" do not seem to
work in ZEPHYR_BASE and <toolchain>_TOOLCHAIN_PATH. Instead one has to
explicitly set "/home/me".
Mind filing a ticket for it, please?
https://jira.zephyrproject.org/browse/ZEP-212

Carles