From 3096b5425794cd5d3443a120fbf6f9fe49c2c142 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 12 Feb 2016 22:24:47 -0500 Subject: [PATCH] Use .zephyrrc for initializing common variables The file can be used to define variables used by the SDK to avoid having to define them everytime a session is started. The old file names ~/zephyr-env_install.bash will still work but it will warn about the file being renamed. We do not want to break users who have ~/zephyr-env_install.bash in their home and depend on it. Change-Id: I04fcaa76854bda3dcfc1cabe75e00e95c511b10d Signed-off-by: Anas Nashif --- doc/getting_started/installation_linux.rst | 10 ++++++++++ doc/getting_started/installation_mac.rst | 10 ++++++++++ zephyr-env.sh | 8 +++++++- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/doc/getting_started/installation_linux.rst b/doc/getting_started/installation_linux.rst index ded5fbc15f2..e249bd33ef6 100644 --- a/doc/getting_started/installation_linux.rst +++ b/doc/getting_started/installation_linux.rst @@ -182,6 +182,16 @@ Follow these steps to install the SDK on your Linux host system. $ export ZEPHYR_SDK_INSTALL_DIR=/opt/zephyr-sdk + To use the same toolchain in new sessions in the future you can set the + variables in the file :file:`${HOME}/.zephyrrc`, for example: + + .. code-block:: console + + $ cat < ~/.zephyrrc + export ZEPHYR_GCC_VARIANT=zephyr + export ZEPHYR_SDK_INSTALL_DIR=/opt/zephyr-sdk + EOF + .. _SDK self-extractable binary: https://nexus.zephyrproject.org/content/repositories/releases/org/zephyrproject/zephyr-sdk/0.7.2-i686/zephyr-sdk-0.7.2-i686-setup.run diff --git a/doc/getting_started/installation_mac.rst b/doc/getting_started/installation_mac.rst index f7b2f077505..0d6e6815827 100644 --- a/doc/getting_started/installation_mac.rst +++ b/doc/getting_started/installation_mac.rst @@ -174,6 +174,16 @@ and use the target location where the toolchain was installed, type: $ export ZEPHYR_SDK_INSTALL_DIR=/Volumes/CrossToolNG/x-tools +To use the same toolchain in new sessions in the future you can set the +variables in the file :file:`${HOME}/.zephyrrc`, for example: + +.. code-block:: console + + $ cat < ~/.zephyrrc + export ZEPHYR_SDK_INSTALL_DIR=/Volumes/CrossToolNG/x-tools + export ZEPHYR_GCC_VARIANT=xtools + EOF + .. _Homebrew site: http://brew.sh/ .. _crosstool-ng site: http://crosstool-ng.org diff --git a/zephyr-env.sh b/zephyr-env.sh index 62188d72325..dcb0638b72d 100644 --- a/zephyr-env.sh +++ b/zephyr-env.sh @@ -20,5 +20,11 @@ unset scripts_path # enable custom environment settings zephyr_answer_file=~/zephyr-env_install.bash -[ -f ${zephyr_answer_file} ] && . ${zephyr_answer_file} +[ -f ${zephyr_answer_file} ] && { + echo "Warning: Please rename ~/zephyr-env_install.bash to ~/.zephyrrc"; + . ${zephyr_answer_file}; +} +unset zephyr_answer_file +zephyr_answer_file=~/.zephyrrc +[ -f ${zephyr_answer_file} ] && . ${zephyr_answer_file}; unset zephyr_answer_file