Custom Nerves firmware for RPi5 issues

I am going out of the frying pan into the fire today…

I wanted to create a custom firmware for my RPi5, I need nftables.
So I cloned the repo at the latest tag (v0.3.1), set my MIX_TARGET, changed the mix.exs file, as I have done several times in the past.
I got my dependencies and compiled, so far so good.
Now I need to get to the make menuconfig, so I ran mix nerves.system.shell copied the docker command and ran it. Still good.

But when I do make menuconfig I just get a blank screen, with a single line on the bottom

/home/nerves/project/.config - Buildroot 2024.05.2 Configuration----------

That’s all. No menus, nothing and I have to ctrl-c to get out of it.

I assumed it has something to do with me being on an M2-Mac, so I ssh-d into my Ubuntu development machine and did the same dance.
But here I cannot even get the firmware to compile.

==> nerves
==> nerves_system_br
Generated nerves_system_br app
==> nerves_toolchain_ctng
Compiling 1 file (.ex)
Generated nerves_toolchain_ctng app
==> nerves_toolchain_aarch64_nerves_linux_gnu
Generated nerves_toolchain_aarch64_nerves_linux_gnu app
==> gratwifi_rpi5
Generated gratwifi_rpi5 app
Buildroot extracted to /home/herman/Projects/nerves/custom_rpi5/deps/nerves_system_br/buildroot.

Applying 0001-erlang-clean-up-target-installation.patch using patch:
patching file package/erlang/erlang.mk
Hunk #1 succeeded at 93 (offset -2 lines).

Applying 0002-mtools-Disable-iconv-use-on-target.patch using patch:
patching file package/mtools/mtools.mk

Applying 0003-NERVES_DEFCONFIG_DIR-support.patch using patch:
patching file Makefile
Hunk #2 succeeded at 995 (offset 6 lines).

Applying 0004-Add-customizable-linux-logo.patch using patch:
patching file linux/Config.ext.in
patching file linux/linux-ext-customlogo.mk
patching file package/Config.in
Hunk #1 succeeded at 282 (offset 2 lines).
patching file package/customlogo/Config.in
patching file package/customlogo/customlogo.mk

Applying 0005-kernel-wireless-regdb-install-regdb-in-kernel.patch using patch:
patching file linux/Config.ext.in
patching file linux/linux-ext-kernel-wireless-regdb.mk
patching file package/Config.in
Hunk #1 succeeded at 2459 (offset 101 lines).
patching file package/kernel-wireless-regdb/Config.in
patching symbolic link package/kernel-wireless-regdb/kernel-wireless-regdb.hash
patching file package/kernel-wireless-regdb/kernel-wireless-regdb.mk

Applying 0006-erlang-force-configure-options.patch using patch:
patching file package/erlang/erlang.mk
Hunk #1 succeeded at 39 (offset 8 lines).

Applying 0007-erlang-support-OTP-21-27.patch using patch:
patching file package/erlang/21.3.8.24/0001-erts-ethread-instruct-libatomic_ops-we-do-require-CA.patch
patching file package/erlang/21.3.8.24/0002-erts-emulator-reorder-inclued-headers-paths.patch
patching file package/erlang/21.3.8.24/0003-Link-with-LDLIBS-instead-of-LIBS-for-DED.patch
patching file package/erlang/21.3.8.24/0004-erlang-enable-deterministic-builds.patch
patching file package/erlang/22.3.4.26/0001-erts-ethread-instruct-libatomic_ops-we-do-require-CA.patch
patching file package/erlang/22.3.4.26/0002-erts-emulator-reorder-inclued-headers-paths.patch
patching file package/erlang/22.3.4.26/0003-erlang-enable-deterministic-builds.patch
patching file package/erlang/22.3.4.26/0004-disksup-update-df-call-to-work-with-Busybox.patch
patching file package/erlang/23.3.4.14/0001-erts-ethread-instruct-libatomic_ops-we-do-require-CA.patch
patching file package/erlang/23.3.4.14/0002-erts-emulator-reorder-inclued-headers-paths.patch
patching file package/erlang/23.3.4.14/0003-erlang-enable-deterministic-builds.patch
patching file package/erlang/23.3.4.14/0004-disksup-update-df-call-to-work-with-Busybox.patch
patching file package/erlang/24.3.2/0001-erts-ethread-instruct-libatomic_ops-we-do-require-CA.patch
patching file package/erlang/24.3.2/0002-erts-emulator-reorder-inclued-headers-paths.patch
patching file package/erlang/24.3.2/0003-erlang-enable-deterministic-builds.patch
patching file package/erlang/24.3.2/0004-disksup-update-df-call-to-work-with-Busybox.patch
patching file package/erlang/25.3.2/0001-erts-emulator-reorder-inclued-headers-paths.patch
patching file package/erlang/25.3.2/0003-disksup-update-df-call-to-work-with-Busybox.patch
patching file package/erlang/26.2.5/0001-disksup-update-df-call-to-work-with-Busybox.patch
patching file package/erlang/26.2.5/0002-erlang-libei-arch-compile.patch
patching file package/erlang/27.0.1/0001-disksup-update-df-call-to-work-with-Busybox.patch
patching file package/erlang/Config.in
patching file package/erlang/erlang.hash
patching file package/erlang/erlang.mk

Applying 0008-erlang-don-t-install-to-target.patch using patch:
patching file package/erlang/erlang.mk
Hunk #1 succeeded at 48 with fuzz 2 (offset 3 lines).

Applying 0009-rpi-firmware-support-custom-version-selection.patch using patch:
patching file package/rpi-firmware/Config.in
patching file package/rpi-firmware/rpi-firmware.mk

Applying 0010-Revert-package-libp11-bump-to-version-0.4.12.patch using patch:
patching file package/libp11/0001-Update-wp11_rsa.c.patch
patching file package/libp11/0001-src-p11_attr.c-fix-build-with-gcc-4.8.patch
patching file package/libp11/libp11.hash
patching file package/libp11/libp11.mk

Applying 0011-toolchain-external-refine-support-library-search-to-.patch using patch:
patching file toolchain/toolchain-external/pkg-toolchain-external.mk
Hunk #1 succeeded at 451 (offset 16 lines).

Applying 0012-fwup-bump-to-v1.10.1.patch using patch:
patching file package/fwup/fwup.hash
patching file package/fwup/fwup.mk

Applying 0013-uboot-support-alternative-TEE-filenames.patch using patch:
patching file boot/uboot/Config.in
patching file boot/uboot/uboot.mk

Applying 0014-Install-Linux-headers-to-staging.patch using patch:
patching file linux/linux.mk
Hunk #1 succeeded at 553 (offset 4 lines).
make: Entering directory '/home/herman/Projects/nerves/custom_rpi5/deps/nerves_system_br/buildroot-2024.05.2'
  GEN     /home/herman/Projects/nerves/custom_rpi5/.nerves/artifacts/gratwifi_rpi5-portable-0.3.1/Makefile
#
# configuration written to /home/herman/Projects/nerves/custom_rpi5/.nerves/artifacts/gratwifi_rpi5-portable-0.3.1/.config
#
make: Leaving directory '/home/herman/Projects/nerves/custom_rpi5/deps/nerves_system_br/buildroot-2024.05.2'
------------

Build directory successfully created.

Configuration: /home/herman/Projects/nerves/custom_rpi5/nerves_defconfig

Next, do the following:
   1. cd /home/herman/Projects/nerves/custom_rpi5/.nerves/artifacts/gratwifi_rpi5-portable-0.3.1
   2. make

For additional options, run 'make help' in the build directory.

IMPORTANT: If you update nerves_system_br, you should rerun this script.
.** (Mix) Nerves encountered an error while constructing the artifact
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
/bin/bash: line 1: ./bin/cat: cannot execute binary file: Exec format error
make[1]: *** [Makefile:750: target-finalize] Error 126
make: *** [Makefile:23: _all] Error 2

I traced the error back to the installation of the certificates, apparently it is trying to call the target cat command instead of the host’s.

So now I am stuck, on my Mac the firmware compiles, but make menuconfig is empty, on Ubuntu it doesn’t compile.

Help?

:blush:

Ahem, I solved the Ubuntu issue, I had ./bin somewhere in my PATH.
Removing that and the compilation succeeds and I can make menuconfig.

So I can continue my journey.

Doesn’t explain why I get a black screen on Mac…

Are you using Kitty as your terminal? It sets TERM to xterm-kitty, which can lead to strange problems.

https://github.com/kovidgoyal/kitty/issues/713

Setting TERM to xterm in the nerves shell might solve the blank screen

mix nerves.system.shell
## wait a bit :) 
export TERM=xterm
make menuconfig
4 Likes

OMG, it’s not kiity, but iTerm2, but the issue was the same.

when I started the shell and echo $TERM it replied dumb.
So I set it to xterm and now it works.

2 Likes

Thank you for this! I’ve been having the same problem on my recent custom systems using Elixir 1.17/Nerves Buildroot 1.28 (not sure which dependency changed to cause this issue), I just hadn’t got around to posting here or slack yet.

My TERM variable was also set to “dumb” on both Alacritty and iTerm2. Is there a way to persist this setting between calls to mix nerves.system.shell?

1 Like

I added it as an extra environment variable on the docker command.

2 Likes