1.. _toolchain_xtools:
2
3Crosstool-NG (Deprecated)
4#########################
5
6.. warning::
7
8   ``xtools`` toolchain variant is deprecated. The
9   :ref:`cross-compile toolchain variant <other_x_compilers>` should be used
10   when using a custom toolchain built with Crosstool-NG.
11
12You can build toolchains from source code using crosstool-NG.
13
14#. Follow the steps on the crosstool-NG website to `prepare your host
15   <http://crosstool-ng.github.io/docs/os-setup/>`_.
16
17#. Follow the `Zephyr SDK with Crosstool NG instructions
18   <https://github.com/zephyrproject-rtos/sdk-ng/blob/master/README.md>`_ to
19   build your toolchain. Repeat as necessary to build toolchains for multiple
20   target architectures.
21
22   You will need to clone the ``sdk-ng`` repo and run the following command:
23
24   .. code-block:: console
25
26      ./go.sh <arch>
27
28   .. note::
29
30      Currently, only i586 and Arm toolchain builds are verified.
31
32#. :ref:`Set these environment variables <env_vars>`:
33
34   - Set :envvar:`ZEPHYR_TOOLCHAIN_VARIANT` to ``xtools``.
35   - Set :envvar:`XTOOLS_TOOLCHAIN_PATH` to the toolchain build directory.
36
37#. To check that you have set these variables correctly in your current
38   environment, follow these example shell sessions (the
39   :envvar:`XTOOLS_TOOLCHAIN_PATH` values may be different on your system):
40
41   .. code-block:: console
42
43      # Linux, macOS:
44      $ echo $ZEPHYR_TOOLCHAIN_VARIANT
45      xtools
46      $ echo $XTOOLS_TOOLCHAIN_PATH
47      /Volumes/CrossToolNGNew/build/output/
48
49.. _crosstool-ng site: http://crosstool-ng.org
50