Skip to content

Instantly share code, notes, and snippets.

View serpent213's full-sized avatar

Steffen Beyer serpent213

  • 213tec
  • Germany
View GitHub Profile
% iex --name 'master@192.168.213.95' --cookie '1mk0ulenVwtz4bktF15Xu2OH8xn0CjgC4Vp4KVU5QC/kIqsbXuEoF4nPTgB04zys'
Erlang/OTP 20 [erts-9.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
Interactive Elixir (1.4.5) - press Ctrl+C to exit (type h() ENTER for help)
iex(master@192.168.213.95)1> Node.connect :'brainz@192.168.213.81'
true
iex(master@192.168.213.95)2> :observer.start
:ok
def init_kernel_modules() do
Enum.each(@kernel_modules, & System.cmd("modprobe", [&1]))
end
def init_network() do
opts = Application.get_env(:brainz, @interface)
Nerves.InterimWiFi.setup(@interface, opts)
end
% iex --name 'master@192.168.213.95' --cookie '1mk0ulenVwtz4bktF15Xu2OH8xn0CjgC4Vp4KVU5QC/kIqsbXuEoF4nPTgB04zys' --remsh 'brainz@192.168.213.81'
Erlang/OTP 20 [erts-9.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
Interactive Elixir (1.4.5) - press Ctrl+C to exit (type h() ENTER for help)
iex(brainz@192.168.213.81)1> System.cmd("pwd", [])
{"/srv/erlang\n", 0}
iex(brainz@192.168.213.81)2> System.cmd("ls", ["/etc"])
{"ssl\nshadow\nresolv.conf\nprofile.d\npasswd\nos-release\nnsswitch.conf\nnetwork\nmtab\nmodprobe.d\nmke2fs.conf\nlibnl\nhosts\ngroup\nfw_env.config\nerlinit.config\nerl_inetrc\n",
0}
iex(brainz@192.168.213.81)3> model_bin = File.read!("/proc/device-tree/model")
## Distributed Erlang Options
## The cookie needs to be configured prior to vm boot for
## for read only filesystem.
-name brainz@192.168.213.81
-setcookie 1mk0ulenVwtz4bktF15Xu2OH8xn0CjgC4Vp4KVU5QC/kIqsbXuEoF4nPTgB04zys
def application(_target) do
[mod: {Brainz.Application, []},
extra_applications: [:logger, :runtime_tools]]
end
% mix firmware
Mix environment
MIX_TARGET: bbb
MIX_ENV: dev
Compiling 1 file (.ex)
|nerves_bootstrap| Building OTP Release...
==> Cleaning all releases..
==> Clean successful!
def deps(target) do
[ system(target),
{:bootloader, "~> 0.1"},
{:nerves_runtime, "~> 0.4"},
{:logger_multicast_backend, "~> 0.2.2"},
{:nerves_interim_wifi, "~> 0.2.0"}
]
end
def deps(target) do
[ system(target),
{:bootloader, "~> 0.1"},
{:nerves_runtime, "~> 0.4"},
{:nerves_interim_wifi, "~> 0.2.0"}
]
end
config :logger,
backends: [ :console,
{LoggerMulticastBackend,
target: {{192,168,213,95}, 514},
level: :debug}
]
defmodule NervesBBBEEPROM do
@moduledoc """
Documentation for NervesBbbEeprom.
"""
@doc """
Hello world.
## Examples