I have made some progress. This is a steep learning curve!
The mix.exs files in the kiosk-system-rpi4 repo are significantly different from the ones in kiosk_system_rpi3 repo. I have modified the one in the top level of the rpi4 repo as below.
defmodule KioskSystemRpi4.MixProject do
use Mix.Project
@app :kiosk_system_rpi4
@version Path.join(__DIR__, "VERSION")
|> File.read!()
|> String.trim()
def project do
[
app: @app,
version: @version,
elixir: "~> 1.6",
compilers: Mix.compilers() ++ [:nerves_package],
nerves_package: nerves_package(),
description: description(),
package: package(),
deps: deps(),
aliases: [loadconfig: [&bootstrap/1], docs: ["docs", ©_images/1]],
docs: [extras: ["README.md"], main: "readme"]
]
end
def application do
[]
end
defp bootstrap(args) do
set_target()
Application.start(:nerves_bootstrap)
Mix.Task.run("loadconfig", args)
end
defp nerves_package do
[
type: :system,
# artifact_sites: [
# {:github_releases, "nerves-project/#{@app}"}
# ],
build_runner_opts: build_runner_opts(),
platform: Nerves.System.BR,
platform_config: [
defconfig: "nerves_defconfig"
],
checksum: package_files()
]
end
defp deps do
[
{:nerves, "~> 1.7", runtime: false},
{:nerves_system_br, "1.13.2", runtime: false},
{:nerves_toolchain_arm_unknown_linux_gnueabihf, "1.3.2", runtime: false},
{:nerves_system_linter, "~> 0.4", runtime: false},
{:ex_doc, "~> 0.18", only: [:dev, :test], runtime: false}
]
end
defp description do
"""
Nerves System - Raspberry Pi 4
"""
end
defp package do
[
files: package_files(),
licenses: ["Apache 2.0"],
links: %{"GitHub" => "https://github.com/nerves-project/#{@app}"}
]
end
defp package_files do
[
"fwup_include",
"rootfs_overlay",
"CHANGELOG.md",
"cmdline.txt",
"config.txt",
"fwup-revert.conf",
"fwup.conf",
"LICENSE",
"linux-4.19.defconfig",
"mix.exs",
"nerves_defconfig",
"post-build.sh",
"post-createfs.sh",
"ramoops.dts",
"README.md",
"VERSION"
]
end
# Copy the images referenced by docs, since ex_doc doesn't do this.
defp copy_images(_) do
File.cp_r("assets", "doc/assets")
end
defp build_runner_opts() do
if primary_site = System.get_env("BR2_PRIMARY_SITE") do
[make_args: ["BR2_PRIMARY_SITE=#{primary_site}"]]
else
[]
end
end
defp set_target() do
if function_exported?(Mix, :target, 1) do
apply(Mix, :target, [:target])
else
System.put_env("MIX_TARGET", "target")
end
end
end
This should stop the build system looking for non existent relwase targets. I have created a mix,exs for my project as shown below
defmodule Kiosk.MixProject do
use Mix.Project
@app :kiosk
@version "0.1.0"
@all_targets [:rpi, :rpi0, :rpi2, :rpi3, :rpi3a, :rpi4, :bbb, :osd32mp1, :x86_64]
def project do
[
app: @app,
version: @version,
elixir: "~> 1.9",
archives: [nerves_bootstrap: "~> 1.10"],
start_permanent: Mix.env() == :prod,
build_embedded: true,
deps: deps(),
releases: [{@app, release()}],
preferred_cli_target: [run: :host, test: :host]
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
mod: {Kiosk.Application, []},
extra_applications: [:logger, :runtime_tools]
]
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[
# Dependencies for all targets
{:nerves, "~> 1.7.4", runtime: false},
{:shoehorn, "~> 0.7.0"},
{:ring_logger, "~> 0.8.1"},
{:toolshed, "~> 0.2.13"},
{:webengine_kiosk, "~> 0.3"},
# Dependencies for all targets except :host
{:nerves_runtime, "~> 0.11.3", targets: @all_targets},
{:nerves_pack, "~> 0.6.0", targets: @all_targets},
# Dependencies for specific targets
{:kiosk_system_rpi4,
path: "~/kiosk_system_rpi4/",
nerves: [compile: true],
runtime: false, targets: :rpi4}
]
end
def release do
[
overwrite: true,
# Erlang distribution is not started automatically.
# See https://hexdocs.pm/nerves_pack/readme.html#erlang-distribution
cookie: "#{@app}_cookie",
include_erts: &Nerves.Release.erts/0,
steps: [&Nerves.Release.init/1, :assemble],
strip_beams: Mix.env() == :prod or [keep: ["Docs"]]
]
end
end
My hope was this force mix to to recompile the kiosk project. This appears to work. But the compile fails as below.
Resolving Hex dependencies...
Dependency resolution completed:
Unchanged:
beam_notify 1.0.0
circular_buffer 0.4.0
elixir_make 0.6.3
gen_state_machine 3.0.0
mdns_lite 0.8.4
muontrap 1.0.0
nerves 1.7.12
nerves_motd 0.1.5
nerves_pack 0.6.0
nerves_runtime 0.11.8
nerves_ssh 0.2.3
nerves_system_br 1.13.2
nerves_system_linter 0.4.0
nerves_time 0.4.4
nerves_toolchain_arm_unknown_linux_gnueabihf 1.3.2
nerves_toolchain_ctng 1.7.2
one_dhcpd 1.0.0
ring_logger 0.8.2
shoehorn 0.7.0
ssh_subsystem_fwup 0.6.0
system_registry 0.8.2
toolshed 0.2.25
uboot_env 1.0.0
vintage_net 0.11.3
vintage_net_direct 0.10.3
vintage_net_ethernet 0.10.3
vintage_net_wifi 0.10.6
webengine_kiosk 0.3.0
Nerves environment
MIX_TARGET: rpi4
MIX_ENV: dev
==> nerves
==> kiosk
Resolving Nerves artifacts...
Resolving kiosk_system_rpi4
Skipping kiosk_system_rpi4
Cached nerves_toolchain_arm_unknown_linux_gnueabihf
roger@dragon:~/toasty/kiosk$ mix firmware
==> nerves
make: Entering directory '/home/roger/toasty/kiosk/deps/nerves_system_br/buildroot-2020.08'
GEN /home/roger/kiosk_system_rpi4/.nerves/artifacts/kiosk_system_rpi4-portable-1.8.2/Makefile
#
# configuration written to /home/roger/kiosk_system_rpi4/.nerves/artifacts/kiosk_system_rpi4-portable-1.8.2/.config
#
make: Leaving directory '/home/roger/toasty/kiosk/deps/nerves_system_br/buildroot-2020.08'
------------
Build directory successfully created.
Configuration: /home/roger/kiosk_system_rpi4/nerves_defconfig
Next, do the following:
1. cd /home/roger/kiosk_system_rpi4/.nerves/artifacts/kiosk_system_rpi4-portable-1.8.2
2. make
For additional options, run 'make help' in the build directory.
IMPORTANT: If you update nerves_system_br, you should rerun this script.
>>> host-m4 1.4.18 Building==> kiosk_system_rpi4
could not compile dependency :kiosk_system_rpi4, "mix compile" failed. You can recompile this dependency with "mix deps.compile kiosk_system_rpi4", update it with "mix deps.update kiosk_system_rpi4" or clean it with "mix deps.clean kiosk_system_rpi4"
==> kiosk
** (Mix) Nerves encountered an error while constructing the artifact
/usr/bin/make -j1 O=/home/roger/kiosk_system_rpi4/.nerves/artifacts/kiosk_system_rpi4-portable-1.8.2 HOSTCC="/usr/bin/gcc" HOSTCXX="/usr/bin/g++" syncconfig
GEN /home/roger/kiosk_system_rpi4/.nerves/artifacts/kiosk_system_rpi4-portable-1.8.2/Makefile
>>> host-m4 1.4.18 Building
PATH="/home/roger/kiosk_system_rpi4/.nerves/artifacts/kiosk_system_rpi4-portable-1.8.2/host/bin:/home/roger/kiosk_system_rpi4/.nerves/artifacts/kiosk_system_rpi4-portable-1.8.2/host/sbin:/home/roger/.asdf/installs/erlang/24.1.5/erts-12.1.5/bin:/home/roger/.asdf/installs/erlang/24.1.5/bin:/home/roger/.asdf/plugins/elixir/shims:/home/roger/.asdf/installs/elixir/1.12.3-otp-24/bin:/home/roger/.asdf/installs/elixir/1.12.3-otp-24/.mix/escripts:/home/roger/.asdf/shims:/home/roger/.asdf/bin:/home/roger/.yarn/bin:/home/roger/.config/yarn/global/node_modules/.bin:/home/roger/.local/bin:/opt/cross-pi-gcc/bin:/home/roger/xamarin.android-oss_v8.3.99.189_Linux-x86_64_HEAD_7b85e47/bin/Release/bin:/home/roger/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/roger/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin" PKG_CONFIG="/home/roger/kiosk_system_rpi4/.nerves/artifacts/kiosk_system_rpi4-portable-1.8.2/host/bin/pkg-config" PKG_CONFIG_SYSROOT_DIR="/" PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_LIBDIR="/home/roger/kiosk_system_rpi4/.nerves/artifacts/kiosk_system_rpi4-portable-1.8.2/host/lib/pkgconfig:/home/roger/kiosk_system_rpi4/.nerves/artifacts/kiosk_system_rpi4-portable-1.8.2/host/share/pkgconfig" /usr/bin/make -j9 -C /home/roger/kiosk_system_rpi4/.nerves/artifacts/kiosk_system_rpi4-portable-1.8.2/build/host-m4-1.4.18/
/usr/bin/make all-recursive
Making all in .
make[4]: Nothing to be done for 'all-am'.
Making all in examples
make[4]: Nothing to be done for 'all'.
Making all in lib
/usr/bin/make all-am
CC c-stack.o
CC getprogname.o
CC hard-locale.o
CC gl_linkedhash_list.o
CC gl_list.o
CC localcharset.o
CC malloca.o
CC math.o
CC memchr2.o
CC gl_oset.o
CC pipe2.o
In file included from /usr/include/signal.h:328,
from ./signal.h:52,
from c-stack.c:49:
c-stack.c:55:26: error: missing binary operator before token "("
55 | #elif HAVE_LIBSIGSEGV && SIGSTKSZ < 16384
| ^~~~~~~~
make[5]: *** [Makefile:1915: c-stack.o] Error 1
make[5]: *** Waiting for unfinished jobs....
make[4]: *** [Makefile:1674: all] Error 2
make[3]: *** [Makefile:1572: all-recursive] Error 1
make[2]: *** [Makefile:1528: all] Error 2
make[1]: *** [package/pkg-generic.mk:250: /home/roger/kiosk_system_rpi4/.nerves/artifacts/kiosk_system_rpi4-portable-1.8.2/build/host-m4-1.4.18/.stamp_built] Error 2
make: *** [Makefile:23: _all] Error 2
It is hard work out what is going on here! Is there any way to force mix not run make in multiple job mode?
Hast anyone got any ideas on the error?
Roger