Skip to content

Commit 4fb4c2d

Browse files
committed
add nerves-tips file
1 parent affd988 commit 4fb4c2d

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

fortunes/nerves-tips

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
Run `dmesg` to see log messages from device drivers and the Linux kernel.
2+
Nerves also routes kernel log messages to the Elixir logger.
3+
%
4+
Erlinit is a small program that starts the Erlang VM on boot.
5+
It has many options - especially for debugging startup issues.
6+
%
7+
Nerves automatically reboots devices when the Erlang VM exits.
8+
You can easily disable it in your config file.
9+
10+
config :nerves, :erlinit, hang_on_init: true
11+
%
12+
Use `mix firmware.unpack` to decompress a local copy of your firmware on host
13+
and inspect the files within before installing on device%
14+
%
15+
See if someone has already implemented support for a sensor or other hardware
16+
device that you have by checking https://elixir-circuits.github.io/.
17+
%
18+
Nerves stores all BEAM files, the Erlang runtime and various support
19+
libraries/apps in a compressed and read-only SquashFS filesystem.
20+
%
21+
Need to write to disk? Use the application partition mounted R/W at `/data`.
22+
%
23+
Configuring the Elixir Logger to show SASL reports can help debug unexpected
24+
GenServer restarts.
25+
26+
config :logger,
27+
handle_otp_reports: true,
28+
handle_sasl_reports: true
29+
%
30+
Get the default packages for starting a new Nerves project by depending
31+
on `:nerves_pack`. https://github.com/nerves-project/nerves_pack/
32+
%
33+
Nerves enables hardware watchdogs and connects them to Erlang's heart feature
34+
to detect and recover from the Erlang VM hanging.
35+
https://embedded-elixir.com/post/2018-12-10-heart/
36+
%
37+
Make small code changes to your running application by copy/pasting Elixir
38+
source files at the IEx prompt.
39+
%
40+
Identify your Nerves devices using a unique ID that's already programmed into
41+
the hardware using the boardid command. Try running `cmd("boardid")` in the IEx.
42+
https://github.com/nerves-project/boardid
43+
%
44+
Nerves maintains a set of examples for common use-cases with devices.
45+
https://github.com/nerves-project/nerves_examples
46+
%
47+
Use `RingLogger.next` to dump the current log buffer to screen.
48+
%
49+
Run `log_attach` in the IEx to attach the current session to the Elixir logger
50+
for live logs.
51+
%
52+
Get some insights to Nerves internals with this high level overview of the
53+
Nerves architecture and choice to use the BEAM VM. https://youtu.be/VzOaSvTcvU4
54+
%
55+
Run `Nerves.Runtime.revert` to go back to the previously loaded firmware.
56+
%
57+
Use the `RamoopsLogger` backend to store log messages in DRAM that can survive
58+
unexpected reboots. https://github.com/smartrent/ramoops_logger
59+
%
60+
Files saved in /data are persisted across reboots and firmware upgrades.
61+
Learn more: https://hexdocs.pm/nerves/faq.html#where-can-persistent-data-be-stored
62+
%

0 commit comments

Comments
 (0)