Demonstration on Erlang & Elixir Fest 2019
- Provisioning of
hello_nerves
project and Building it - Burning firm to microSD, Booting and Running IEx
- Editing
lib/hello_nerves.ex
and Uploading firmware byssh nerves.local
- Burning firm over NervesHub
- Running device controlling apps integrated with scenic
NOTE: Files of Step 1.,2.,3. are only located on respective branches (e.g., "3").
$ mix nerves.new hello_nerves --init-gadget
$ cd hello_nerves
$ ssh-keygen -t rsa -P "" -C "eefest19" -f eefest19
Generating public/private rsa key pair.
Your identification has been saved in eefest19.
Your public key has been saved in eefest19.pub.
The key fingerprint is:
SHA256:dz+vWXjW7LqFFgNCybphcHPyi7SkQItkEGMZfMDEhvY eefest19
The key's randomart image is:
+---[RSA 2048]----+
|XB+ ... |
|oOo.. . +.+ |
|oooo . o *. . |
| .Eo * .. . |
| . =S=... o |
| . +... . *.|
| * B|
| . X |
| =+o|
+----[SHA256]-----+
$ mv eefest* ~/.ssh/
$ vim ~/.ssh/config
# Add following block
Host nerves.local
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
IdentityFile ~/.ssh/eefest19
$ vim config/config.exs
# Edit as follow
$ git diff config/config.exs
diff --git a/hello_nerves/config/config.exs b/hello_nerves/config/config.exs
index da0c2ac..b5335a6 100644
--- a/hello_nerves/config/config.exs
+++ b/hello_nerves/config/config.exs
@@ -45,7 +45,10 @@ if keys == [],
""")
config :nerves_firmware_ssh,
- authorized_keys: Enum.map(keys, &File.read!/1)
+ authorized_keys: [
+ "Paste contents of ~/.ssh/eefest19.pub here"
+ ]
# Configure nerves_init_gadget.
# See https://hexdocs.pm/nerves_init_gadget/readme.html for more information.
$ export MIX_TARGET=rpi0
$ mix deps.get
$ mix firmware
Connect microSD to hostPC with SD writer, and then,,,
$ mix firmware.burn
$ ssh nerves.local
Warning: Permanently added 'nerves.local,172.31.125.113' (RSA) to the list of known hosts.
Interactive Elixir (1.8.1) - press Ctrl+C to exit (type h() ENTER for help)
Toolshed imported. Run h(Toolshed) for more info
RingLogger is collecting log messages from Elixir and Linux. To see the
messages, either attach the current IEx session to the logger:
RingLogger.attach
or print the next messages in the log:
RingLogger.next
iex([email protected])1> uname
Nerves nerves-2131 hello_nerves 0.1.0 (bee968a4-58e8-5d2e-6dd1-954970a1529c) arm
iex([email protected])2> HelloNerves.hello
:world
Enjoy the Nerves Hello World and IEx!!
$ vim lib/hello_nerves.ex
# Edit as follow
$ git diff lib/hello_nerves.ex
diff --git a/hello_nerves/lib/hello_nerves.ex b/hello_nerves/lib/hello_nerves.ex
index 0c2bebc..349954c 100644
--- a/hello_nerves/lib/hello_nerves.ex
+++ b/hello_nerves/lib/hello_nerves.ex
@@ -13,6 +13,6 @@ defmodule HelloNerves do
"""
def hello do
- :world
+ "Erlang & Elixir Fest 2019!"
end
end
$ mix firmware
$ mix firmware.gen.script
Writing upload.sh...
$ ./upload.sh
Path: ./_build/rpi0_dev/nerves/images/hello_nerves.fw
Product: hello_nerves 0.1.0
UUID: 2cd4a00a-042f-5e41-5d8f-cf16de422f3e
Platform: rpi0
Uploading to nerves.local...
Warning: Permanently added '[nerves.local]:8989,[172.31.125.113]:8989' (RSA) to the list of known hosts.
Running fwup...
fwup: Upgrading partition B
|====================================| 100% (31.37 / 31.37) MB
Success!
Elapsed time: 18.933 s
Rebooting...
Received disconnect from 172.31.125.113 port 8989:11: Terminated (shutdown) by supervisor
Disconnected from 172.31.125.113 port 8989
$ ssh nerves.local
Warning: Permanently added 'nerves.local,172.31.125.113' (RSA) to the list of known hosts.
Interactive Elixir (1.8.1) - press Ctrl+C to exit (type h() ENTER for help)
Toolshed imported. Run h(Toolshed) for more info
RingLogger is collecting log messages from Elixir and Linux. To see the
messages, either attach the current IEx session to the logger:
RingLogger.attach
or print the next messages in the log:
RingLogger.next
iex([email protected])1> HelloNerves.hello
"Erlang & Elixir Fest 2019!"
iex([email protected])2> exit
Connection to nerves.local closed.
$ cd scenic_dev_ctrl
$ export MIX_TARGET=rpi0
$ mix deps.get
$ mix firmware
$ ./upload.sh
TBA (Please consider to attend Nerves Training!!)
$ cd scenic_dev_ui
$ mix deps.get
$ mix scenic.run
$ cd scenic_dev_ctrl
$ export MIX_TARGET=rpi0
$ mix deps.get
$ mix firmware
# upload over NervesHub or upload.sh
Then,
Erlang & Elixir Fest 2019 will be appeared on OLED Bonnet. Also, white/black of display can be inverted by pushing #5.
- https://github.com/nerves-training/nerves_team
- Special thanks to Nerves Project members and Nerves Friends!!
- I used branch "8" of its repo as the basis of demonstration of Step 4.