You are here:
(19 Jul 2016,
<noautolink> ---+!! HowTo (Mac) - Build %TOC% *Note:* This page assumes that you have successfully completed the [[Install]] step. ---++ Image Build The notes below are based on the =hello_nerves= example from the [[%NP%][Nerves Project]]'s [[%NGS%][Getting Started]] page. In this variation, we'll do the build on =spot= (a MacBook Air), using a [[%WP_RP%][Raspberry Pi]] 2B as the target. Our goal, in this step, is to build a [[%WP_SI%][system image]] for the target, including copies of Linux, Erlang, Elixir, Nerves, and the application code. We start by asking [[%Mix%][Mix]] to create a new Nerves project: <verbatim> $ mix nerves.new hello_nerves_spot --target rpi2 * creating hello_nerves_spot/config/config.exs ... </verbatim> After entering the directory, we ask Mix to ensure that we have local copies of our dependencies. Note that these will include some that are specific to the target. <verbatim> $ cd hello_nerves_spot $ mix local.hex * creating /Users/rdm/.mix/archives/hex-0.12.1 ... $ mix deps.get ... </verbatim> Now, we bring in a copy of [[%Rebar3%][Rebar3]], "an [[%WP_EPL%][Erlang]] tool that makes it easy to create, develop, and release Erlang libraries, applications, and systems in a repeatable manner". <verbatim> $ mix local.rebar ... </verbatim> Finally (whew!), we can try to compile the project. When doing this, I encountered several warnings. The one about =cloudi_service_db_riak= isn't a Nerves issue, so I filed it with the appropriate folks. The other bugs (I am told) will disappear Real Soon Now: <verbatim> $ mix compile ... ==> hello_nerves_spot Compiling 1 file (.ex) Generated hello_nerves_spot app </verbatim> As a sanity check, let's examine the results of the build: <verbatim> $ NERVES_DEBUG=1 mix compile Nerves Env loaded ------------------ Nerves Environment ------------------ target: rpi2 toolchain: _build/rpi2/dev/nerves/toolchain system: _build/rpi2/dev/nerves/system app: /Users/rdm/Dropbox/elixir/hello_nerves_spot </verbatim> Looks good; let's create a system image for the target's firmware: <verbatim> $ mix firmware Building release with MIX_ENV=dev. ... Building _images/rpi2/hello_nerves_spot.fw... </verbatim> We now have an system image; our next step is to [[Upload]] it. <!-- * Set Erlang = http://elixir-lang.org/getting-started/mix-otp/introduction-to-mix.html * Set Mix = http://elixir-lang.org/getting-started/mix-otp/introduction-to-mix.html * Set NGS = https://hexdocs.pm/nerves/getting-started.html * Set NP = http://nerves-project.org * Set Rebar3 = https://github.com/erlang/rebar3 * Set WP_EPL = %WP%/Erlang_(Programming_language) * Set WP_BB = %WP%/BeagleBoard#BeagleBone * Set WP_MSD = %WP%/Secure_Digital#Mini-_and_micro-cards * Set WP_RP = %WP%/Raspberry_Pi * Set WP_SI = %WP%/System_image --> %ZB%
ore topic actions
Topic revision: r8 - 19 Jul 2016,
Copyright © by the contributing authors. All material on this wiki is the property of the contributing authors.
, Plugin API version
Ideas, requests, problems regarding CFCL Wiki?
Send us email