zephyr/doc/getting_started/installation_mac.rst
Rodrigo Caballero 4f976c20d7 doc: Refactor the Quick Start Guide.
Restructured the guide to follow a basic three step process: Set up, develop,
build. All information that is independent of the OS selection was taken out of
of the OS related documents and placed in the general set up sections.

A new section, Developing Zephyr Applications, was added with links to all the
development relevant section of the documentation.

The content in local_development.rst was split between the setting_up.rst,
installation_linux.rst and installation_mac.rst files as appropriate.

This new structure provides a much better flow for developers beginning their
Zephyr develpment.

Applied all of Inaky's suggestions in the refactored content.

Minor markup fixes and language edits were also perfomed during the refactoring.

Fixed a cross-reference that was broken during the refactor.

Applied all the feedback from the first trial run.

Applied the feedback provided by David Kinder from TCS.

Change-Id: I3368a3a41ec9ad02cc4e7b37fe71c65abd8a7df9
Signed-off-by: Rodrigo Caballero <rodrigo.caballero.abraham@intel.com>
2016-02-05 20:25:30 -05:00

180 lines
5.1 KiB
ReStructuredText

.. _installing_zephyr_mac:
Development Environment Setup on Mac OS
#######################################
This section describes how to set up a Mac OS development system.
After completing these steps, you will be able to compile and run your Zephyr
applications on the following Mac OS version:
Mac OS X 10.11 (El Capitan)
Update Your Operating System
****************************
Before proceeding with the build, ensure your OS is up to date.
.. _mac_requirements:
Installing Requirements and Dependencies
****************************************
To install the software components required to build the Zephyr kernel on a
Mac, you will need to build a cross compiler for the target devices you wish to
build for and install tools that the build system requires.
.. note::
Minor version updates of the listed required packages might also
work.
.. attention::
Check your firewall and proxy configurations to ensure that Internet
access is available before attempting to install the required packages.
First, install the :program:`Homebrew` (The missing package manager for
OS X). Homebrew is a free and open-source software package management system
that simplifies the installation of software on Apple's OS X operating
system.
To install :program:`Homebrew`, visit the `Homebrew site`_ and follow the
installation instructions on the site.
To complete the Homebrew installation, you might be prompted to install some
missing dependency. If so, follow please follow the instructions provided.
After Homebrew was successfully installed, install the following tools using
the brew command line.
.. code-block:: console
$ brew install gettext qemu help2man mpfr gmp coreutils wget
$ brew tap homebrew/dupes
$ brew install grep --default-names
.. code-block:: console
$ brew install crosstool-ng
Alternatively you can install the latest version of :program:`crosstool-ng`
from source. Download the latest version from the `crosstool-ng site`_. The
latest version usually supports the latest released compilers.
.. code-block:: console
$ wget
http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.22.0.tar.bz2
$ tar xvf crosstool-ng-1.22.0.tar.bz2
$ cd crosstool-ng/
$ ./configure
$ make
$ make install
.. _setting_up_mac_toolchain:
Setting Up the Toolchain
************************
Creating a Case-sensitive File System
=====================================
Building the compiler requires a case-senstive file system. Therefore, use
:program:`diskutil` to create an 8 GB blank sparse image making sure you select
case-sensitive file system (OS X Extended (Case-sensitive, Journaled) and
mount it.
Alternatively you can use the script below to create the image:
.. code-block:: bash
#!/bin/bash ImageName=CrossToolNG ImageNameExt=${ImageName}.sparseimage
diskutil umount force /Volumes/${ImageName} && true rm -f ${ImageNameExt}
&& true hdiutil create ${ImageName} -volname ${ImageName} -type SPARSE
-size 8g -fs HFSX hdiutil mount ${ImageNameExt} cd /Volumes/$ImageName
When mounted, the file system of the image will be available under
:file:`/Volumes`. Change to the mounted directory:
.. code-block:: console
$ cd /Volumes/CrossToolNG
$ mkdir build
$ cd build
Setting the Toolchain Options
=============================
In the Zephyr kernel source tree we provide two configurations for
both ARM and X86 that can be used to pre-select the options needed
for building the toolchain.
The configuration files can be found in :file:`${ZEPHYR_BASE}/scripts/cross_compiler/`.
.. code-block:: console
$ cp ${ZEPHYR_BASE}/scripts/cross_compiler/x86.config .config
You can create a toolchain configuration or customize an existing configuration
yourself using the configuration menus:
.. code-block:: console
$ ct-ng menuconfig
Verifying the Configuration of the Toolchain
============================================
Before building the toolchain it is advisable to perform a quick verification
of the configuration set for the toolchain.
1. Open the generated :file:`.config` file.
2. Verify the following lines are present, assuming the sparse image was
mounted under :file:`/Volumes/CrossToolNG`:
.. code-block:: bash
...
CT_LOCAL_TARBALLS_DIR="/Volumes/CrossToolNG/src"
# CT_SAVE_TARBALLS is not set
CT_WORK_DIR="${CT_TOP_DIR}/.build"
CT_PREFIX_DIR="/Volumes/CrossToolNG/x-tools/${CT_TARGET}"
CT_INSTALL_DIR="${CT_PREFIX_DIR}"
...
Building the Toolchain
======================
To build the toolchain, enter:
.. code-block:: console
$ ct-ng build
The above process takes a while. When finished, the toolchain will be available
under :file:`/Volumes/CrossToolNG/x-tools`.
Repeat the step for all architectures you want to support in your environment.
To use the toolchain with Zephyr, export the following environment variables
and use the target location where the toolchain was installed, type:
.. code-block:: console
$ export ZEPHYR_GCC_VARIANT=xtools
$ export ZEPHYR_SDK_INSTALL_DIR=/Volumes/CrossToolNG/x-tools
.. _Homebrew site: http://brew.sh/
.. _crosstool-ng site: http://crosstool-ng.org