LoginSignup
1
0

wslでnerves その16

Last updated at Posted at 2023-11-14

概要

wsl(wsl2じゃない)でnervesやってみる。
qemu(x86_64エミュレータ、ラズパイじゃない)でやってみた。
環境を作り直した。
失敗編

環境

windows 10
ubuntu 20.04LTS(WSL)

elixir -v

Erlang/OTP 25 [erts-13.0.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns]

Elixir 1.14.5 (compiled with Erlang/OTP 25)

手順 aptできるものインストール

$ sudo apt update
$ sudo apt install build-essential automake autoconf git squashfs-tools ssh-askpass pkg-config curl libmnl-dev

手順 mixできるものインストール

$ mix local.hex
Found existing entry: /home/ore/.mix/archives/hex-2.0.6
Are you sure you want to replace it with "https://repo.hex.pm/installs/1.14.0/hex-2.0.6.ez"? [Yn] y
* creating .mix/archives/hex-2.0.6

$ mix local.rebar
.mix/elixir/1-14/rebar3 already exists, overwrite? [Yn] y
* creating .mix/elixir/1-14/rebar3

$ mix archive.install hex nerves_bootstrap
Resolving Hex dependencies...
Resolution completed in 0.041s
New:
  nerves_bootstrap 1.12.1
* Getting nerves_bootstrap (Hex package)
All dependencies are up to date
Compiling 5 files (.ex)
Generated nerves_bootstrap app
Generated archive "nerves_bootstrap-1.12.1.ez" with MIX_ENV=prod
Are you sure you want to install "nerves_bootstrap-1.12.1.ez"? [Yn] y
* creating /home/ore/.mix/archives/nerves_bootstrap-1.12.1


$ mix help | grep nerves
mix local.nerves      # Checks for updates to nerves_bootstrap
mix nerves.new        # Creates a new Nerves application


$ export MIX_TARGET=x86_64
$ mix nerves.new hello_nerves
* creating hello_nerves/config/config.exs
* creating hello_nerves/config/host.exs
* creating hello_nerves/config/target.exs
* creating hello_nerves/lib/hello_nerves.ex
* creating hello_nerves/lib/hello_nerves/application.ex
* creating hello_nerves/test/test_helper.exs
* creating hello_nerves/test/hello_nerves_test.exs
* creating hello_nerves/rel/vm.args.eex
* creating hello_nerves/rootfs_overlay/etc/iex.exs
* creating hello_nerves/.gitignore
* creating hello_nerves/.formatter.exs
* creating hello_nerves/mix.exs
* creating hello_nerves/README.md

Fetch and install dependencies? [Yn] y
* running mix deps.get
* running mix format
Your Nerves project was created successfully.

You should now pick a target. See https://hexdocs.pm/nerves/targets.html#content
for supported targets. If your target is on the list, set `MIX_TARGET`
to its tag name:

For example, for the Raspberry Pi 3 you can either
  $ export MIX_TARGET=rpi3
Or prefix `mix` commands like the following:
  $ MIX_TARGET=rpi3 mix firmware

If you will be using a custom system, update the `mix.exs`
dependencies to point to desired system's package.

Now download the dependencies and build a firmware archive:
  $ cd hello_nerves
  $ mix deps.get
  $ mix firmware

If your target boots up using an SDCard (like the Raspberry Pi 3),
then insert an SDCard into a reader on your computer and run:
  $ mix burn

Plug the SDCard into the target and power it up. See target documentation
above for more information and other targets.
$ cd hello_nerves
$ mix deps.get
Resolving Hex dependencies...
Resolution completed in 0.287s
Unchanged:
  beam_notify 1.1.0
  castore 1.0.4
  circular_buffer 0.4.1
  elixir_make 0.7.7
  gen_state_machine 3.0.0
  jason 1.4.1
  mdns_lite 0.8.8
  muontrap 1.3.2
  nerves 1.10.4
  nerves_logging 0.2.2
  nerves_motd 0.1.13
  nerves_pack 0.7.0
  nerves_runtime 0.13.6
  nerves_ssh 0.4.3
  nerves_system_bbb 2.19.1
  nerves_system_br 1.24.1
  nerves_system_grisp2 0.8.1
  nerves_system_mangopi_mq_pro 0.6.1
  nerves_system_osd32mp1 0.15.1
  nerves_system_rpi 1.24.1
  nerves_system_rpi0 1.24.1
  nerves_system_rpi2 1.24.1
  nerves_system_rpi3 1.24.1
  nerves_system_rpi3a 1.24.1
  nerves_system_rpi4 1.24.1
  nerves_system_x86_64 1.24.1
  nerves_time 0.4.6
  nerves_toolchain_aarch64_nerves_linux_gnu 1.8.0
  nerves_toolchain_armv6_nerves_linux_gnueabihf 1.8.0
  nerves_toolchain_armv7_nerves_linux_gnueabihf 1.8.0
  nerves_toolchain_ctng 1.9.3
  nerves_toolchain_riscv64_nerves_linux_gnu 1.8.0
  nerves_toolchain_x86_64_nerves_linux_musl 1.8.0
  nerves_uevent 0.1.0
  one_dhcpd 2.0.2
  property_table 0.2.4
  ring_logger 0.10.5
  shoehorn 0.9.1
  ssh_subsystem_fwup 0.6.1
  toolshed 0.3.1
  uboot_env 1.0.1
  vintage_net 0.13.5
  vintage_net_direct 0.10.7
  vintage_net_ethernet 0.11.2
  vintage_net_wifi 0.11.7
All dependencies are up to date
==> jason
Compiling 10 files (.ex)
Generated jason app
==> castore
Compiling 1 file (.ex)
Generated castore app
==> elixir_make
Compiling 6 files (.ex)
Generated elixir_make app
==> nerves
HOST_CC port.o
HOST_LD port
Compiling 50 files (.ex)
Generated nerves app
==> hello_nerves

Nerves environment
  MIX_TARGET:   x86_64
  MIX_ENV:      dev

Checking for prebuilt Nerves artifacts...
  Checking nerves_system_x86_64...
  [GitHub] nerves_system_x86_64-portable-1.24.1-88FF788.tar.gz
|==================================================| 100% (119 / 119) MB
  => Success
  Checking nerves_toolchain_x86_64_nerves_linux_musl...
  [GitHub] nerves_toolchain_x86_64_nerves_linux_musl-linux_x86_64-1.8.0-F489F29.tar.xz
|==================================================| 100% (75 / 75) MB
  => Success

エラー発生

$ mix firmware.image


==> nerves
==> nerves_system_br
Generated nerves_system_br app
==> nerves_toolchain_ctng
Compiling 1 file (.ex)
Generated nerves_toolchain_ctng app
==> nerves_toolchain_x86_64_nerves_linux_musl
Generated nerves_toolchain_x86_64_nerves_linux_musl app
==> nerves_system_x86_64
Compiling 1 file (.ex)
Generated nerves_system_x86_64 app
==> hello_nerves

Nerves environment
  MIX_TARGET:   x86_64
  MIX_ENV:      dev

** (Mix) Major version mismatch between host and target Erlang/OTP versions
  Host version: 25
  Target version: 26

This will likely cause Erlang code compiled for the target to fail in
unexpected ways.

The easiest way to resolve this issue is to install the same version of
Erlang/OTP on your host. See the Nerves installation guide for doing this
using the `asdf` version manager.

The Nerves System (nerves_system_*) dependency determines the OTP version
running on the target. It is possible that a recent update to the Nerves
System pulled in a new version of Erlang/OTP. If you are using an official
Nerves System, you can verify this by reviewing the CHANGELOG.md file that
comes with the release. Run 'mix deps' to see the Nerves System version and
go to that system's repository on https://github.com/nerves-project.

If you need to run a particular version of Erlang/OTP on your target, you can
either lock the nerves_system_* dependency in your mix.exs to an older
version. Note that this route prevents you from receiving security updates
from the official systems. The other option is to build a custom Nerves
system. See the Nerves documentation for building a custom system and then
run 'make menuconfig' and look for the Erlang options.


積んだ。

以上。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0