From 3ee2e097b5cf064bba6feda24bded09f8b777813 Mon Sep 17 00:00:00 2001 From: Johan Larsson Date: Sat, 25 Jan 2020 11:19:51 +0100 Subject: [PATCH 1/4] Add nerves configuration --- README.md | 8 ++++++ config/config.exs | 18 ++++++++++++ config/device.exs | 4 +-- mix.exs | 58 ++++++++++++++++++++++++++++++++++---- mix.lock | 39 +++++++++++++++++++++++++ rel/vm.args.eex | 43 ++++++++++++++++++++++++++++ rootfs_overlay/etc/iex.exs | 18 ++++++++++++ 7 files changed, 181 insertions(+), 7 deletions(-) create mode 100644 rel/vm.args.eex create mode 100644 rootfs_overlay/etc/iex.exs diff --git a/README.md b/README.md index aac08f7..40cdbfc 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,14 @@ mix firmware mix firmware.burn ``` +Ensure that Nerves is up and running by pinging it or SSH:ing to it + +```bash +ping nerves.local + +ssh nerves.local +``` + Generate a nerves script to upload updates via the network ```bash diff --git a/config/config.exs b/config/config.exs index 025f3f8..5b5c671 100644 --- a/config/config.exs +++ b/config/config.exs @@ -9,6 +9,24 @@ config :restid, :destinations, [ %{name: "Centralstationen", lat: 57.708713, long: 11.973301} ] +config :restid, target: Mix.target() + +# Customize non-Elixir parts of the firmware. See +# https://hexdocs.pm/nerves/advanced-configuration.html for details. + +config :nerves, :firmware, rootfs_overlay: "rootfs_overlay" + +# Set the SOURCE_DATE_EPOCH date for reproducible builds. +# See https://reproducible-builds.org/docs/source-date-epoch/ for more information + +config :nerves, source_date_epoch: "1578826697" + +# Use Ringlogger as the logger backend and remove :console. +# See https://hexdocs.pm/ring_logger/readme.html for more information on +# configuring ring_logger. + +config :logger, backends: [RingLogger] + targeting = case Mix.target() do :host -> :host diff --git a/config/device.exs b/config/device.exs index 567cfb0..4a6676f 100644 --- a/config/device.exs +++ b/config/device.exs @@ -45,9 +45,9 @@ config :nerves_network, :default, key_mgmt: String.to_atom(key_mgmt) ] -config :eink, :viewport, %{ +config :restid, :viewport, %{ name: :main_viewport, - default_scene: {Eink.Scene.Main, nil}, + default_scene: {Restid.Scene.Main, nil}, # Note: Match these to your inky display size: {400, 300}, opts: [scale: 1.0], diff --git a/mix.exs b/mix.exs index 14edff2..11d1cb9 100644 --- a/mix.exs +++ b/mix.exs @@ -1,21 +1,36 @@ defmodule Restid.MixProject do use Mix.Project + @app :restid + @version "0.1.0" + @all_targets [:rpi, :rpi0, :rpi2, :rpi3, :rpi3a, :rpi4, :bbb, :x86_64] + def project do [ - app: :restid, - version: "0.1.0", + app: @app, + version: @version, elixir: "~> 1.9", + archives: [nerves_bootstrap: "~> 1.7"], build_embedded: true, start_permanent: Mix.env() == :prod, - deps: deps() + aliases: [loadconfig: [&bootstrap/1]], + deps: deps(), + releases: [{@app, release()}], + preferred_cli_target: [run: :host, test: :host] ] end + # Starting nerves_bootstrap adds the required aliases to Mix.Project.config() + # Aliases are only added if MIX_TARGET is set. + def bootstrap(args) do + Application.start(:nerves_bootstrap) + Mix.Task.run("loadconfig", args) + end + # Run "mix help compile.app" to learn about applications. def application do [ - extra_applications: [:logger], + extra_applications: [:logger, :runtime_tools], mod: {Restid.Application, []} ] end @@ -26,12 +41,45 @@ defmodule Restid.MixProject do {:tesla, "~> 0.8"}, {:poison, ">= 1.0.0"}, {:scenic, "~> 0.10"}, + {:scenic_driver_inky, "~> 1.0", targets: @all_targets}, {:scenic_driver_glfw, "~> 0.10", targets: :host}, # These deps are optional and are included as they are often used. # If your app doesn't need them, they are safe to remove. {:scenic_sensor, "~> 0.7"}, - {:scenic_clock, "~> 0.10"} + {:scenic_clock, "~> 0.10"}, + + # Nerves dependencies for all targets + {:nerves, "~> 1.5.0", runtime: false}, + {:shoehorn, "~> 0.6"}, + {:ring_logger, "~> 0.6"}, + {:toolshed, "~> 0.2"}, + {:inky, "~> 1.0"}, + {:inky_host_dev, "~> 1.0", targets: :host, only: :dev}, + + # Dependencies for all targets except :host + {:nerves_runtime, "~> 0.6", targets: @all_targets}, + {:nerves_init_gadget, "~> 0.4", targets: @all_targets}, + + # Dependencies for specific targets + {:nerves_system_rpi, "~> 1.10", runtime: false, targets: :rpi}, + {:nerves_system_rpi0, "~> 1.10", runtime: false, targets: :rpi0}, + {:nerves_system_rpi2, "~> 1.10", runtime: false, targets: :rpi2}, + {:nerves_system_rpi3, "~> 1.10", runtime: false, targets: :rpi3}, + {:nerves_system_rpi3a, "~> 1.10", runtime: false, targets: :rpi3a}, + {:nerves_system_rpi4, "~> 1.10", runtime: false, targets: :rpi4}, + {:nerves_system_bbb, "~> 2.5", runtime: false, targets: :bbb}, + {:nerves_system_x86_64, "~> 1.10", runtime: false, targets: :x86_64} + ] + end + + def release do + [ + overwrite: true, + cookie: "#{@app}_cookie", + include_erts: &Nerves.Release.erts/0, + steps: [&Nerves.Release.init/1, :assemble], + strip_beams: Mix.env() == :prod ] end end diff --git a/mix.lock b/mix.lock index 8a0337a..3b4e871 100644 --- a/mix.lock +++ b/mix.lock @@ -1,12 +1,51 @@ %{ + "circuits_gpio": {:hex, :circuits_gpio, "0.4.4", "09823645b82d84177549c9520e822ffb87d228413527f8a3134f4f436be16efe", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm"}, + "circuits_spi": {:hex, :circuits_spi, "0.1.5", "5f1901c77fb982217a956498ba0d9d0d47cc58ec47731020621b5c95eee296c0", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm"}, + "dns": {:hex, :dns, "2.1.2", "81c46d39f7934f0e73368355126e4266762cf227ba61d5889635d83b2d64a493", [:mix], [{:socket, "~> 0.3.13", [hex: :socket, repo: "hexpm", optional: false]}], "hexpm"}, "elixir_make": {:hex, :elixir_make, "0.6.0", "38349f3e29aff4864352084fc736fa7fa0f2995a819a737554f7ebd28b85aaab", [:mix], [], "hexpm"}, "font_metrics": {:hex, :font_metrics, "0.3.1", "025ff9957040eb4d6430c306a4445bad5d9f43ec24448c1647df7cb63b5dd88c", [:mix], [{:msgpax, "~> 2.2", [hex: :msgpax, repo: "hexpm", optional: false]}], "hexpm"}, + "inky": {:hex, :inky, "1.0.1", "241cc1609c3eca5163659033bbe0d78689571eeae27c4ade322ee0d8d0495983", [:mix], [{:circuits_gpio, "~> 0.4", [hex: :circuits_gpio, repo: "hexpm", optional: false]}, {:circuits_spi, "~> 0.1", [hex: :circuits_spi, repo: "hexpm", optional: false]}], "hexpm"}, + "inky_host_dev": {:hex, :inky_host_dev, "1.0.0", "61710408f4e2f2832d32ed58756c9170c52544cbcd66993d2a9b42c241a61c6b", [:mix], [], "hexpm"}, + "mdns": {:hex, :mdns, "1.0.3", "f08414daf5636bf5cd364611e838818e9250c91a3282a817ad9174b03e757401", [:mix], [{:dns, "~> 2.0", [hex: :dns, repo: "hexpm", optional: false]}], "hexpm"}, "mime": {:hex, :mime, "1.3.1", "30ce04ab3175b6ad0bdce0035cba77bba68b813d523d1aac73d9781b4d193cf8", [:mix], [], "hexpm"}, "msgpax": {:hex, :msgpax, "2.2.4", "7b3790ef684089076b63c0f08c2f4b079c6311daeb006b69e4ed2bf67518291e", [:mix], [{:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm"}, + "muontrap": {:hex, :muontrap, "0.5.1", "98fe96d0e616ee518860803a37a29eb23ffc2ca900047cb1bb7fd37521010093", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm"}, + "nerves": {:hex, :nerves, "1.5.4", "d5a2a29a642e92277d5680f40d0fadff17796e75faa82de87ba0bc920ffcf818", [:mix], [{:distillery, "~> 2.1", [hex: :distillery, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm"}, + "nerves_firmware_ssh": {:hex, :nerves_firmware_ssh, "0.4.4", "12b0d9c84ec9f79c1b0ac0de1c575372ef972d0c58ce21c36bf354062c6222d9", [:mix], [{:nerves_runtime, "~> 0.6", [hex: :nerves_runtime, repo: "hexpm", optional: false]}], "hexpm"}, + "nerves_init_gadget": {:hex, :nerves_init_gadget, "0.7.0", "7402b190a7354fc4df53e707e1a8e421352ac6c3dba4262273d1f1a55bbb019b", [:mix], [{:mdns, "~> 1.0", [hex: :mdns, repo: "hexpm", optional: false]}, {:nerves_firmware_ssh, "~> 0.2", [hex: :nerves_firmware_ssh, repo: "hexpm", optional: false]}, {:nerves_network, "~> 0.3", [hex: :nerves_network, repo: "hexpm", optional: false]}, {:nerves_runtime, "~> 0.3", [hex: :nerves_runtime, repo: "hexpm", optional: false]}, {:nerves_time, "~> 0.2", [hex: :nerves_time, repo: "hexpm", optional: false]}, {:one_dhcpd, "~> 0.1", [hex: :one_dhcpd, repo: "hexpm", optional: false]}, {:ring_logger, "~> 0.4", [hex: :ring_logger, repo: "hexpm", optional: false]}], "hexpm"}, + "nerves_network": {:hex, :nerves_network, "0.5.5", "4690c362707f76c4072810bd9639b2ae8eb7dd9c21119656308b462a087230aa", [:make, :mix], [{:elixir_make, "~> 0.5", [hex: :elixir_make, repo: "hexpm", optional: false]}, {:nerves_network_interface, "~> 0.4.4", [hex: :nerves_network_interface, repo: "hexpm", optional: false]}, {:nerves_wpa_supplicant, "~> 0.5", [hex: :nerves_wpa_supplicant, repo: "hexpm", optional: false]}, {:one_dhcpd, "~> 0.2.0", [hex: :one_dhcpd, repo: "hexpm", optional: false]}, {:system_registry, "~> 0.7", [hex: :system_registry, repo: "hexpm", optional: false]}], "hexpm"}, + "nerves_network_interface": {:hex, :nerves_network_interface, "0.4.6", "d50e57daca8154f0f780fd98eb5ae94a005579e0d72d69840e80e228375d88ad", [:make, :mix], [{:elixir_make, "~> 0.5", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm"}, + "nerves_runtime": {:hex, :nerves_runtime, "0.10.3", "8671c805262a6b8819a92b16afb100060af55a807a30f62395136c133e72b4ab", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}, {:system_registry, "~> 0.8.0", [hex: :system_registry, repo: "hexpm", optional: false]}, {:uboot_env, "~> 0.1.1", [hex: :uboot_env, repo: "hexpm", optional: false]}], "hexpm"}, + "nerves_system_bbb": {:hex, :nerves_system_bbb, "2.5.0", "1efe6c45026227ec03ed8e21f95f209980b5d38f7931fcc3ebc3ffd17b737540", [:mix], [{:nerves, "~> 1.5.0", [hex: :nerves, repo: "hexpm", optional: false]}, {:nerves_system_br, "1.10.0", [hex: :nerves_system_br, repo: "hexpm", optional: false]}, {:nerves_system_linter, "~> 0.3.0", [hex: :nerves_system_linter, repo: "hexpm", optional: false]}, {:nerves_toolchain_arm_unknown_linux_gnueabihf, "1.2.0", [hex: :nerves_toolchain_arm_unknown_linux_gnueabihf, repo: "hexpm", optional: false]}], "hexpm"}, + "nerves_system_br": {:hex, :nerves_system_br, "1.10.0", "29169ebad0415b916bf3b9890f821a91b70be9af93a7fd824aa661f17b193548", [:mix], [], "hexpm"}, + "nerves_system_linter": {:hex, :nerves_system_linter, "0.3.0", "84e0f63c8ac196b16b77608bbe7df66dcf352845c4e4fb394bffd2b572025413", [:mix], [], "hexpm"}, + "nerves_system_rpi": {:hex, :nerves_system_rpi, "1.10.0", "38cee1e6e01b99868d91ff3ca5872b12c01e7509a5b8bf2bd379a79d385c1096", [:mix], [{:nerves, "~> 1.5.0", [hex: :nerves, repo: "hexpm", optional: false]}, {:nerves_system_br, "1.10.0", [hex: :nerves_system_br, repo: "hexpm", optional: false]}, {:nerves_system_linter, "~> 0.3.0", [hex: :nerves_system_linter, repo: "hexpm", optional: false]}, {:nerves_toolchain_armv6_rpi_linux_gnueabi, "1.2.0", [hex: :nerves_toolchain_armv6_rpi_linux_gnueabi, repo: "hexpm", optional: false]}], "hexpm"}, + "nerves_system_rpi0": {:hex, :nerves_system_rpi0, "1.10.0", "af2330d3a17faab6dadbeb54412e132438eaaf7a489f38b8de0f3ef06f2712ae", [:mix], [{:nerves, "~> 1.5.0", [hex: :nerves, repo: "hexpm", optional: false]}, {:nerves_system_br, "1.10.0", [hex: :nerves_system_br, repo: "hexpm", optional: false]}, {:nerves_system_linter, "~> 0.3.0", [hex: :nerves_system_linter, repo: "hexpm", optional: false]}, {:nerves_toolchain_armv6_rpi_linux_gnueabi, "1.2.0", [hex: :nerves_toolchain_armv6_rpi_linux_gnueabi, repo: "hexpm", optional: false]}], "hexpm"}, + "nerves_system_rpi2": {:hex, :nerves_system_rpi2, "1.10.0", "920fc0732cdead67122660b73d2fb4c9809d32d4aee2d3d04cfca0897c21d159", [:mix], [{:nerves, "~> 1.5.0", [hex: :nerves, repo: "hexpm", optional: false]}, {:nerves_system_br, "1.10.0", [hex: :nerves_system_br, repo: "hexpm", optional: false]}, {:nerves_system_linter, "~> 0.3.0", [hex: :nerves_system_linter, repo: "hexpm", optional: false]}, {:nerves_toolchain_arm_unknown_linux_gnueabihf, "1.2.0", [hex: :nerves_toolchain_arm_unknown_linux_gnueabihf, repo: "hexpm", optional: false]}], "hexpm"}, + "nerves_system_rpi3": {:hex, :nerves_system_rpi3, "1.10.0", "6fe30a856a985820cc952683feda913a118b0fb38a5b5e227c79aa01ed9aadc9", [:mix], [{:nerves, "~> 1.5.0", [hex: :nerves, repo: "hexpm", optional: false]}, {:nerves_system_br, "1.10.0", [hex: :nerves_system_br, repo: "hexpm", optional: false]}, {:nerves_system_linter, "~> 0.3.0", [hex: :nerves_system_linter, repo: "hexpm", optional: false]}, {:nerves_toolchain_arm_unknown_linux_gnueabihf, "1.2.0", [hex: :nerves_toolchain_arm_unknown_linux_gnueabihf, repo: "hexpm", optional: false]}], "hexpm"}, + "nerves_system_rpi3a": {:hex, :nerves_system_rpi3a, "1.10.0", "9ae7ed6178002751f07427dfd01fb76f3699e078409480e9978725b7fc086ff2", [:mix], [{:nerves, "~> 1.5.0", [hex: :nerves, repo: "hexpm", optional: false]}, {:nerves_system_br, "1.10.0", [hex: :nerves_system_br, repo: "hexpm", optional: false]}, {:nerves_system_linter, "~> 0.3.0", [hex: :nerves_system_linter, repo: "hexpm", optional: false]}, {:nerves_toolchain_arm_unknown_linux_gnueabihf, "1.2.0", [hex: :nerves_toolchain_arm_unknown_linux_gnueabihf, repo: "hexpm", optional: false]}], "hexpm"}, + "nerves_system_rpi4": {:hex, :nerves_system_rpi4, "1.10.0", "a503222d50e3fc62b80262267c62462c7a862c6020aa296e9d71b53bc18fec1e", [:mix], [{:nerves, "~> 1.5", [hex: :nerves, repo: "hexpm", optional: false]}, {:nerves_system_br, "1.10.0", [hex: :nerves_system_br, repo: "hexpm", optional: false]}, {:nerves_system_linter, "~> 0.3.0", [hex: :nerves_system_linter, repo: "hexpm", optional: false]}, {:nerves_toolchain_arm_unknown_linux_gnueabihf, "1.2.0", [hex: :nerves_toolchain_arm_unknown_linux_gnueabihf, repo: "hexpm", optional: false]}], "hexpm"}, + "nerves_system_x86_64": {:hex, :nerves_system_x86_64, "1.10.0", "51a62af0ea0820e927b030216063f49f086ab830b44521375ed76cccf2b9d2d8", [:mix], [{:nerves, "~> 1.5.0", [hex: :nerves, repo: "hexpm", optional: false]}, {:nerves_system_br, "1.10.0", [hex: :nerves_system_br, repo: "hexpm", optional: false]}, {:nerves_system_linter, "~> 0.3.0", [hex: :nerves_system_linter, repo: "hexpm", optional: false]}, {:nerves_toolchain_x86_64_unknown_linux_musl, "1.2.0", [hex: :nerves_toolchain_x86_64_unknown_linux_musl, repo: "hexpm", optional: false]}], "hexpm"}, + "nerves_time": {:hex, :nerves_time, "0.3.2", "cbd1048701a756695cda6ec5835419e47505a7fe437f97088c9475dc6f8ab625", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}, {:muontrap, "~> 0.5", [hex: :muontrap, repo: "hexpm", optional: false]}], "hexpm"}, + "nerves_toolchain_arm_unknown_linux_gnueabihf": {:hex, :nerves_toolchain_arm_unknown_linux_gnueabihf, "1.2.0", "ba48ce7c846ee12dfca8148dc7240988d96a3f2eb9c234bf08bffe4f0f7a3c62", [:mix], [{:nerves, "~> 1.0", [hex: :nerves, repo: "hexpm", optional: false]}, {:nerves_toolchain_ctng, "~> 1.6.0", [hex: :nerves_toolchain_ctng, repo: "hexpm", optional: false]}], "hexpm"}, + "nerves_toolchain_armv6_rpi_linux_gnueabi": {:hex, :nerves_toolchain_armv6_rpi_linux_gnueabi, "1.2.0", "007668c7ad1f73bad8fd54ad1a27a3b0fb91bca51b4af6bb3bbdac968ccae0ba", [:mix], [{:nerves, "~> 1.0", [hex: :nerves, repo: "hexpm", optional: false]}, {:nerves_toolchain_ctng, "~> 1.6.0", [hex: :nerves_toolchain_ctng, repo: "hexpm", optional: false]}], "hexpm"}, + "nerves_toolchain_ctng": {:hex, :nerves_toolchain_ctng, "1.6.0", "452f8589c1a58ac787477caab20a8cfc6671e345837ccc19beefe49ae35ba983", [:mix], [{:nerves, "~> 1.0", [hex: :nerves, repo: "hexpm", optional: false]}], "hexpm"}, + "nerves_toolchain_x86_64_unknown_linux_musl": {:hex, :nerves_toolchain_x86_64_unknown_linux_musl, "1.2.0", "fbe688fa561b03190765e269d4336333c4961a48d2acd3f6cb283443a058e138", [:mix], [{:nerves, "~> 1.0", [hex: :nerves, repo: "hexpm", optional: false]}, {:nerves_toolchain_ctng, "~> 1.6.0", [hex: :nerves_toolchain_ctng, repo: "hexpm", optional: false]}], "hexpm"}, + "nerves_wpa_supplicant": {:hex, :nerves_wpa_supplicant, "0.5.2", "4ec392fc08faf35f50d1070446c2e5019f6b85bd53f5716f904e3f75716d9596", [:make, :mix], [{:elixir_make, "~> 0.5", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm"}, + "one_dhcpd": {:hex, :one_dhcpd, "0.2.4", "2664f2e1ac72cbae0474a88d1a3d55019ccc3ee582ded382589511627a8ed516", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm"}, "poison": {:hex, :poison, "4.0.1", "bcb755a16fac91cad79bfe9fc3585bb07b9331e50cfe3420a24bcc2d735709ae", [:mix], [], "hexpm"}, + "ring_logger": {:hex, :ring_logger, "0.8.0", "b1baddc269099b2afe2ea3a87b8e2b71e57331c0000038ae55090068aac679db", [:mix], [], "hexpm"}, + "rpi_fb_capture": {:hex, :rpi_fb_capture, "0.3.0", "28ffa73d0bb7570f0eaffd77139ed473831778ddac8e964bed9779eabb70b16d", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm"}, "scenic": {:hex, :scenic, "0.10.2", "f4f0a00eed677ac50a7b297375c0323d03f4273580f17c50b877abfaf0c6dc1f", [:make, :mix], [{:elixir_make, "~> 0.5", [hex: :elixir_make, repo: "hexpm", optional: false]}, {:font_metrics, "~> 0.3", [hex: :font_metrics, repo: "hexpm", optional: false]}], "hexpm"}, "scenic_clock": {:hex, :scenic_clock, "0.10.0", "5be4a87ed425c07ae9d05e833eddbdcc026b67ba8059fc979586e2efc067cd77", [:mix], [{:scenic, "~> 0.10", [hex: :scenic, repo: "hexpm", optional: false]}], "hexpm"}, "scenic_driver_glfw": {:hex, :scenic_driver_glfw, "0.10.1", "df7a11bc1d23415dd48c7796a70a6ad98b9cf77554078d79115d6c6e58b87eda", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}, {:scenic, "~> 0.10", [hex: :scenic, repo: "hexpm", optional: false]}], "hexpm"}, + "scenic_driver_inky": {:hex, :scenic_driver_inky, "1.0.0", "320131912311f1837a4f010ab79a1348ffcd870e576c8a6d232b4feb688a343c", [:mix], [{:inky, "~> 1.0.0", [hex: :inky, repo: "hexpm", optional: false]}, {:rpi_fb_capture, "~> 0.1", [hex: :rpi_fb_capture, repo: "hexpm", optional: false]}, {:scenic, "~> 0.9", [hex: :scenic, repo: "hexpm", optional: false]}, {:scenic_driver_nerves_rpi, "~> 0.9", [hex: :scenic_driver_nerves_rpi, repo: "hexpm", optional: false]}], "hexpm"}, + "scenic_driver_nerves_rpi": {:hex, :scenic_driver_nerves_rpi, "0.10.1", "1479d24b9e91e989eef28d6bc6be6cb864e7a60cfb831bef53ead6a37b1502ac", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}, {:scenic, "~> 0.10", [hex: :scenic, repo: "hexpm", optional: false]}], "hexpm"}, "scenic_sensor": {:hex, :scenic_sensor, "0.7.0", "a12aed7596fbab025a535f912325da5a087ff704e96f7acb274c3034d832f9ce", [:mix], [], "hexpm"}, + "shoehorn": {:hex, :shoehorn, "0.6.0", "f9a1b7d6212cf18ba91c4f71c26076059df33cea4db2eb3c098bfa6673349412", [:mix], [{:distillery, "~> 2.1", [hex: :distillery, repo: "hexpm", optional: true]}], "hexpm"}, + "socket": {:hex, :socket, "0.3.13", "98a2ab20ce17f95fb512c5cadddba32b57273e0d2dba2d2e5f976c5969d0c632", [:mix], [], "hexpm"}, + "system_registry": {:hex, :system_registry, "0.8.2", "df791dc276652fcfb53be4dab823e05f8269b96ac57c26f86a67838dbc0eefe7", [:mix], [], "hexpm"}, "tesla": {:hex, :tesla, "0.10.0", "e588c7e7f1c0866c81eeed5c38f02a4a94d6309eede336c1e6ca08b0a95abd3f", [:mix], [{:exjsx, ">= 0.1.0", [hex: :exjsx, repo: "hexpm", optional: true]}, {:fuse, "~> 2.4", [hex: :fuse, repo: "hexpm", optional: true]}, {:hackney, "~> 1.6", [hex: :hackney, repo: "hexpm", optional: true]}, {:ibrowse, "~> 4.2", [hex: :ibrowse, repo: "hexpm", optional: true]}, {:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}, {:poison, ">= 1.0.0", [hex: :poison, repo: "hexpm", optional: true]}], "hexpm"}, + "toolshed": {:hex, :toolshed, "0.2.11", "0cd5312bd6a48f5b654b6ffa9239a63af9f3d200da414790fe25f066e14842a9", [:mix], [{:nerves_runtime, "~> 0.8", [hex: :nerves_runtime, repo: "hexpm", optional: true]}], "hexpm"}, + "uboot_env": {:hex, :uboot_env, "0.1.1", "b01e3ec0973e99473234f27839e29e63b5b81eba6a136a18a78d049d4813d6c5", [:mix], [], "hexpm"}, } diff --git a/rel/vm.args.eex b/rel/vm.args.eex new file mode 100644 index 0000000..7731ff5 --- /dev/null +++ b/rel/vm.args.eex @@ -0,0 +1,43 @@ +## Add custom options here + +## Distributed Erlang Options +## The cookie needs to be configured prior to vm boot for +## for read only filesystem. + +-setcookie <%= @release.options[:cookie] %> + +## Use Ctrl-C to interrupt the current shell rather than invoking the emulator's +## break handler and possibly exiting the VM. ++Bc + +# Allow time warps so that the Erlang system time can more closely match the +# OS system time. ++C multi_time_warp + +## Load code at system startup +## See http://erlang.org/doc/system_principles/system_principles.html#code-loading-strategy +-mode embedded + +## Save the shell history between reboots +## See http://erlang.org/doc/man/kernel_app.html for additional options +-kernel shell_history enabled + +## Enable heartbeat monitoring of the Erlang runtime system +-heart -env HEART_BEAT_TIMEOUT 30 + +## Start the Elixir shell + +-noshell +-user Elixir.IEx.CLI + +## Enable colors in the shell +-elixir ansi_enabled true + +## Options added after -extra are interpreted as plain arguments and can be +## retrieved using :init.get_plain_arguments(). Options before the "--" are +## interpreted by Elixir and anything afterwards is left around for other IEx +## and user applications. +-extra --no-halt +-- +--dot-iex /etc/iex.exs + diff --git a/rootfs_overlay/etc/iex.exs b/rootfs_overlay/etc/iex.exs new file mode 100644 index 0000000..6c94f7e --- /dev/null +++ b/rootfs_overlay/etc/iex.exs @@ -0,0 +1,18 @@ +# Add Toolshed helpers to the IEx session +use Toolshed + +if RingLogger in Application.get_env(:logger, :backends, []) do + IO.puts """ + 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 + """ +end + +# Be careful when adding to this file. Nearly any error can crash the VM and +# cause a reboot. From de40408fcf6143a5291c602690e2d5e4be6ca041 Mon Sep 17 00:00:00 2001 From: Johan Larsson Date: Sat, 25 Jan 2020 11:20:01 +0100 Subject: [PATCH 2/4] Ignore upload.sh since it can be generated --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 4d82a1f..63f4cbf 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ restid-*.tar /.elixir_ls .DS_Store /config/secret.exs +/upload.sh From 2530804528789015b5373538365ab3410d78896a Mon Sep 17 00:00:00 2001 From: Johan Larsson Date: Sun, 26 Jan 2020 09:32:24 +0100 Subject: [PATCH 3/4] Update readme to default to rpi3 instead of rpi4 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 40cdbfc..16027b0 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Burn the initial firmware ```bash # Set the correct target device in the env variable MIX_TARGET -set -x MIX_TARGET rpi4 +set -x MIX_TARGET rpi3 # Configure the Nerves network connection by setting env variables set -x NERVES_NETWORK_SSID "YOUR WIFI SSID NAME" From f41b00bcf95beda207bebf3545a091549ffe568d Mon Sep 17 00:00:00 2001 From: Johan Larsson Date: Sun, 26 Jan 2020 10:26:45 +0100 Subject: [PATCH 4/4] Move all device config to device.exs --- config/config.exs | 16 ---------------- config/device.exs | 13 +++++++++++-- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/config/config.exs b/config/config.exs index 5b5c671..064f348 100644 --- a/config/config.exs +++ b/config/config.exs @@ -11,22 +11,6 @@ config :restid, :destinations, [ config :restid, target: Mix.target() -# Customize non-Elixir parts of the firmware. See -# https://hexdocs.pm/nerves/advanced-configuration.html for details. - -config :nerves, :firmware, rootfs_overlay: "rootfs_overlay" - -# Set the SOURCE_DATE_EPOCH date for reproducible builds. -# See https://reproducible-builds.org/docs/source-date-epoch/ for more information - -config :nerves, source_date_epoch: "1578826697" - -# Use Ringlogger as the logger backend and remove :console. -# See https://hexdocs.pm/ring_logger/readme.html for more information on -# configuring ring_logger. - -config :logger, backends: [RingLogger] - targeting = case Mix.target() do :host -> :host diff --git a/config/device.exs b/config/device.exs index 4a6676f..07d4796 100644 --- a/config/device.exs +++ b/config/device.exs @@ -1,13 +1,22 @@ use Mix.Config +# Customize non-Elixir parts of the firmware. See +# https://hexdocs.pm/nerves/advanced-configuration.html for details. config :nerves, :firmware, rootfs_overlay: "rootfs_overlay" +# Set the SOURCE_DATE_EPOCH date for reproducible builds. +# See https://reproducible-builds.org/docs/source-date-epoch/ for more information +config :nerves, source_date_epoch: "1578826697" + +# Use Ringlogger as the logger backend and remove :console. +# See https://hexdocs.pm/ring_logger/readme.html for more information on +# configuring ring_logger. +config :logger, backends: [RingLogger] + config :shoehorn, init: [:nerves_runtime, :nerves_init_gadget], app: Mix.Project.config()[:app] -config :logger, backends: [RingLogger] - keys = [ Path.join([System.user_home!(), ".ssh", "id_rsa.pub"]),