From 5ade2728809926620334e6c124d9d96905576142 Mon Sep 17 00:00:00 2001 From: James Harton Date: Fri, 13 Oct 2023 13:36:01 +1300 Subject: [PATCH] chore: empty mix app and copy files from x86_64 template. --- .drone.yml | 227 ++++++++++++++++++++++++++++++ .formatter.exs | 4 + .gitignore | 30 ++++ .gitmodules | 3 + Config.in | 4 + README.md | 3 + bivouac_defconfig | 90 ++++++++++++ config/config.exs | 11 ++ lib/bivouac_system_rpi4.ex | 18 +++ mix.exs | 180 +++++++++++++++++++++++ mix.lock | 18 +++ nerves_system_rpi4 | 1 + rootfs_overlay/etc/.keep | 0 rootfs_overlay/etc/erlinit.config | 81 +++++++++++ test/bivouac_system_rpi4_test.exs | 8 ++ test/test_helper.exs | 1 + 16 files changed, 679 insertions(+) create mode 100644 .drone.yml create mode 100644 .formatter.exs create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 Config.in create mode 100644 README.md create mode 100644 bivouac_defconfig create mode 100644 config/config.exs create mode 100644 lib/bivouac_system_rpi4.ex create mode 100644 mix.exs create mode 100644 mix.lock create mode 160000 nerves_system_rpi4 create mode 100644 rootfs_overlay/etc/.keep create mode 100644 rootfs_overlay/etc/erlinit.config create mode 100644 test/bivouac_system_rpi4_test.exs create mode 100644 test/test_helper.exs diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..3425987 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,227 @@ +kind: pipeline +type: docker +name: build + +environment: + HEX_HOME: /drone/src/.hex + MIX_HOME: /drone/src/.mix + REBAR_BASE_DIR: /drone/src/.rebar3 + ASDF_DATA_DIR: /drone/src/.asdf + ASDF_DIR: /root/.asdf + XDG_DATA_HOME: /drone/src/.nerves_data + NERVES_FW_PRODUCT: "Bivouac RPI4" + NERVES_FW_AUTHOR: "James Harton " + +platform: + os: linux + arch: arm64 + +steps: + - name: submodules + image: alpine/git + commands: + - git submodule update --init --recursive + + - name: restore ASDF cache + image: meltwater/drone-cache + pull: "always" + environment: + AWS_ACCESS_KEY_ID: + from_secret: ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY: + from_secret: SECRET_ACCESS_KEY + AWS_PLUGIN_PATH_STYLE: true + settings: + restore: true + endpoint: + from_secret: S3_ENDPOINT + bucket: + from_secret: CACHE_BUCKET + region: us-east-1 + path-style: true + cache_key: 'asdf-{{ os }}-{{ arch }}-{{ checksum ".tool-versions" }}' + mount: + - .asdf + + - name: restore build cache + image: meltwater/drone-cache + environment: + AWS_ACCESS_KEY_ID: + from_secret: ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY: + from_secret: SECRET_ACCESS_KEY + AWS_PLUGIN_PATH_STYLE: true + settings: + restore: true + endpoint: + from_secret: S3_ENDPOINT + bucket: + from_secret: CACHE_BUCKET + region: us-east-1 + path-style: true + cache_key: 'elixir-{{ checksum "mix.lock" }}-{{ checksum ".tool-versions" }}' + mount: + - deps + - _build + - .hex + - .mix + - .rebar3 + + - name: restore nerves cache + image: meltwater/drone-cache + environment: + AWS_ACCESS_KEY_ID: + from_secret: ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY: + from_secret: SECRET_ACCESS_KEY + AWS_PLUGIN_PATH_STYLE: true + settings: + restore: true + endpoint: + from_secret: S3_ENDPOINT + bucket: + from_secret: CACHE_BUCKET + region: us-east-1 + path-style: true + mount: + - .nerves + - .nerves_data + + - name: install dependencies + image: code.harton.nz/james/asdf_container:latest + pull: "always" + depends_on: + - restore ASDF cache + - restore build cache + commands: + - asdf_install + - rm -rf .asdf/downloads + - . $ASDF_DIR/asdf.sh + - mix local.hex --if-missing --force + - mix local.rebar --if-missing --force + - mix archive.install hex nerves_bootstrap --force + - mix deps.get + + - name: get buildroot dependencies + image: code.harton.nz/james/asdf_container:latest + depends_on: + - install dependencies + commands: + - ./deps/nerves_system_br/create-build.sh bivouac_defconfig .temp_nerves_system + - (cd .temp_nerves_system && make source) + + - name: build system + image: code.harton.nz/james/asdf_container:latest + depends_on: + - get buildroot dependencies + commands: + - . $ASDF_DIR/asdf.sh + - mix compile + + - name: store ASDF cache + image: meltwater/drone-cache + environment: + AWS_ACCESS_KEY_ID: + from_secret: ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY: + from_secret: SECRET_ACCESS_KEY + AWS_PLUGIN_PATH_STYLE: true + depends_on: + - install dependencies + settings: + rebuild: true + override: false + endpoint: + from_secret: S3_ENDPOINT + bucket: + from_secret: CACHE_BUCKET + region: us-east-1 + path-style: true + cache_key: 'asdf-{{ os }}-{{ arch }}-{{ checksum ".tool-versions" }}' + mount: + - .asdf + + - name: store build cache + image: meltwater/drone-cache + environment: + AWS_ACCESS_KEY_ID: + from_secret: ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY: + from_secret: SECRET_ACCESS_KEY + AWS_PLUGIN_PATH_STYLE: true + depends_on: + - build system + settings: + rebuild: true + override: false + endpoint: + from_secret: S3_ENDPOINT + bucket: + from_secret: CACHE_BUCKET + region: us-east-1 + path-style: true + cache_key: 'elixir-{{ checksum "mix.lock" }}-{{ checksum ".tool-versions" }}' + mount: + - deps + - _build + - .hex + - .mix + - .rebar3 + + - name: store nerves cache + image: meltwater/drone-cache + environment: + AWS_ACCESS_KEY_ID: + from_secret: ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY: + from_secret: SECRET_ACCESS_KEY + AWS_PLUGIN_PATH_STYLE: true + depends_on: + - build system + settings: + rebuild: true + override: false + endpoint: + from_secret: S3_ENDPOINT + bucket: + from_secret: CACHE_BUCKET + region: us-east-1 + path-style: true + mount: + - .nerves + - .nerves_data + + - name: lint system + image: code.harton.nz/james/asdf_container:latest + depends_on: + - build system + commands: + - . $ASDF_DIR/asdf.sh + - mix nerves.system.lint bivouac_defconfig + + - name: build artifacts + image: code.harton.nz/james/asdf_container:latest + depends_on: + - lint system + commands: + - . $ASDF_DIR/asdf.sh + - mkdir -p deploy/system/artifacts + - cp ./CHANGELOG.md deploy/system/CHANGELOG.md + - TAG=$${DRONE_TAG:-$$DRONE_COMMIT_SHA} mix nerves.artifact ${DRONE_REPO_NAME} --path deploy/system/artifacts + + - name: gitea tag release + image: plugins/gitea-release + depends_on: + - build artifacts + when: + event: + - tag + refs: + include: + - refs/tags/v* + settings: + api_key: + from_secret: DRONE_TOKEN + base_url: https://code.harton.nz + files: deploy/system/artifacts/* + checksum: sha256 diff --git a/.formatter.exs b/.formatter.exs new file mode 100644 index 0000000..d2cda26 --- /dev/null +++ b/.formatter.exs @@ -0,0 +1,4 @@ +# Used by "mix format" +[ + inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] +] diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4fb31dc --- /dev/null +++ b/.gitignore @@ -0,0 +1,30 @@ +# The directory Mix will write compiled artifacts to. +/_build/ + +# If you run "mix test --cover", coverage assets end up here. +/cover/ + +# The directory Mix downloads your dependencies sources to. +/deps/ + +# Where 3rd-party dependencies like ExDoc output generated docs. +/doc/ + +# Ignore .fetch files in case you like to edit your project deps locally. +/.fetch + +# If the VM crashes, it generates a dump, let's ignore it too. +erl_crash.dump + +# Ignore our generated files +/build.log +/archive.log +/.nerves + +# Ignore files copied from the underlying system +/fwup* +/post*sh +/VERSION +/linux +/*.dts +/*.txt diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..e2d6537 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "nerves_system_rpi4"] + path = nerves_system_rpi4 + url = https://github.com/nerves-project/nerves_system_rpi4.git diff --git a/Config.in b/Config.in new file mode 100644 index 0000000..7252ed8 --- /dev/null +++ b/Config.in @@ -0,0 +1,4 @@ +# Add project-specific packages for Buildroot here +# +# If these are non-proprietary, please consider contributing them back to +# Nerves or Buildroot. diff --git a/README.md b/README.md new file mode 100644 index 0000000..3b6d66c --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# bivouac_system_rpi4 + +Builder for the Bivouac base system on Raspberry Pi 4. diff --git a/bivouac_defconfig b/bivouac_defconfig new file mode 100644 index 0000000..560cb4d --- /dev/null +++ b/bivouac_defconfig @@ -0,0 +1,90 @@ +BR2_aarch64=y +BR2_cortex_a72=y +BR2_ARM_FPU_VFPV4=y +BR2_TOOLCHAIN_EXTERNAL=y +BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y +BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y +BR2_TOOLCHAIN_EXTERNAL_URL="https://github.com/nerves-project/toolchains/releases/download/v1.8.0/nerves_toolchain_aarch64_nerves_linux_gnu-linux_${shell uname -m}-1.8.0-E9F5B2A.tar.xz" +BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="aarch64-nerves-linux-gnu" +BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_19=y +BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y +# BR2_TOOLCHAIN_EXTERNAL_INET_RPC is not set +BR2_TOOLCHAIN_EXTERNAL_CXX=y +BR2_TOOLCHAIN_EXTERNAL_OPENMP=y +BR2_TAR_OPTIONS="--no-same-owner" +BR2_BACKUP_SITE="http://dl.nerves-project.org" +BR2_ENABLE_DEBUG=y +BR2_OPTIMIZE_2=y +BR2_GLOBAL_PATCH_DIR="${BR2_EXTERNAL_NERVES_PATH}/patches" +BR2_REPRODUCIBLE=y +BR2_ROOTFS_SKELETON_CUSTOM=y +BR2_ROOTFS_SKELETON_CUSTOM_PATH="${BR2_EXTERNAL_NERVES_PATH}/board/nerves-common/skeleton" +BR2_INIT_NONE=y +BR2_ROOTFS_DEVICE_TABLE="${BR2_EXTERNAL_NERVES_PATH}/board/nerves-common/device_table.txt" +BR2_ENABLE_LOCALE_WHITELIST="locale-archive" +BR2_GENERATE_LOCALE="en_US.UTF-8" +BR2_ROOTFS_OVERLAY="${BR2_EXTERNAL_NERVES_PATH}/board/nerves-common/rootfs_overlay ${NERVES_DEFCONFIG_DIR}/rootfs_overlay" +BR2_ROOTFS_POST_BUILD_SCRIPT="${NERVES_DEFCONFIG_DIR}/post-build.sh ${BR2_EXTERNAL_NERVES_PATH}/board/nerves-common/post-build.sh" +BR2_ROOTFS_POST_IMAGE_SCRIPT="${NERVES_DEFCONFIG_DIR}/post-createfs.sh" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_TARBALL=y +BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="https://github.com/raspberrypi/linux/archive/refs/tags/1.20230405.tar.gz" +BR2_LINUX_KERNEL_PATCH="${NERVES_DEFCONFIG_DIR}/linux" +BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y +BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="${NERVES_DEFCONFIG_DIR}/linux-6.1.defconfig" +BR2_LINUX_KERNEL_XZ=y +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="broadcom/bcm2711-rpi-4-b broadcom/bcm2711-rpi-cm4 broadcom/bcm2711-rpi-400" +BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="${NERVES_DEFCONFIG_DIR}/ramoops.dts" +BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y +BR2_PACKAGE_BUSYBOX_CONFIG="${BR2_EXTERNAL_NERVES_PATH}/board/nerves-common/busybox.config" +BR2_PACKAGE_ALSA_UTILS=y +# BR2_PACKAGE_ALSA_UTILS_ALSAMIXER is not set +BR2_PACKAGE_ALSA_UTILS_AMIXER=y +BR2_PACKAGE_ALSA_UTILS_APLAY=y +BR2_PACKAGE_F2FS_TOOLS=y +BR2_PACKAGE_MESA3D=y +BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_SWRAST=y +BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_V3D=y +BR2_PACKAGE_MESA3D_OPENGL_ES=y +BR2_PACKAGE_RPI_FIRMWARE=y +BR2_PACKAGE_RPI_FIRMWARE_CUSTOM_VERSION="1.20230405" +BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4_X=y +BR2_PACKAGE_PIGPIO=y +# BR2_PACKAGE_RNG_TOOLS_JITTERENTROPY_LIBRARY is not set +BR2_PACKAGE_RPI_USERLAND=y +# BR2_PACKAGE_ALSA_LIB_RAWMIDI is not set +# BR2_PACKAGE_ALSA_LIB_HWDEP is not set +# BR2_PACKAGE_ALSA_LIB_SEQ is not set +# BR2_PACKAGE_ALSA_LIB_ALISP is not set +# BR2_PACKAGE_ALSA_LIB_OLD_SYMBOLS is not set +BR2_PACKAGE_CA_CERTIFICATES=y +BR2_PACKAGE_LIBP11=y +BR2_PACKAGE_UNIXODBC=y +BR2_PACKAGE_DTC=y +BR2_PACKAGE_LIBCAMERA_V4L2=y +BR2_PACKAGE_LIBCAMERA_PIPELINE_RASPBERRYPI=y +BR2_PACKAGE_LIBCAMERA_APPS=y +BR2_PACKAGE_LIBMNL=y +BR2_PACKAGE_WIRELESS_REGDB=y +BR2_PACKAGE_WPA_SUPPLICANT=y +BR2_PACKAGE_WPA_SUPPLICANT_AP_SUPPORT=y +BR2_PACKAGE_WPA_SUPPLICANT_MESH_NETWORKING=y +BR2_PACKAGE_WPA_SUPPLICANT_AUTOSCAN=y +BR2_PACKAGE_WPA_SUPPLICANT_HOTSPOT=y +BR2_PACKAGE_WPA_SUPPLICANT_DEBUG_SYSLOG=y +BR2_PACKAGE_WPA_SUPPLICANT_WPS=y +BR2_PACKAGE_WPA_SUPPLICANT_WPA3=y +BR2_PACKAGE_WPA_SUPPLICANT_CTRL_IFACE=y +# BR2_TARGET_ROOTFS_TAR is not set +BR2_NERVES_SYSTEM_NAME="nerves_system_rpi4" +BR2_NERVES_ADDITIONAL_IMAGE_FILES="${NERVES_DEFCONFIG_DIR}/fwup.conf ${NERVES_DEFCONFIG_DIR}/cmdline.txt ${NERVES_DEFCONFIG_DIR}/config.txt" +BR2_PACKAGE_NBTTY=y +BR2_PACKAGE_NERVES_CONFIG=y +BR2_PACKAGE_RPI_DISTRO_FIRMWARE_NONFREE=y +BR2_PACKAGE_WPA_SUPPLICANT=y +BR2_PACKAGE_BTRFS_PROGS=y +BR2_PACKAGE_CONTAINERD=y +BR2_PACKAGE_CNI_PLUGINS=y +BR2_PACKAGE_IPTABLES=y +BR2_PACKAGE_NERDCTL=y diff --git a/config/config.exs b/config/config.exs new file mode 100644 index 0000000..f75af9b --- /dev/null +++ b/config/config.exs @@ -0,0 +1,11 @@ +import Config + +if config_env() == :docs do + config :git_ops, + mix_project: Mix.Project.get!(), + changelog_file: "CHANGELOG.md", + repository_url: "https://code.harton.nz/bivouac/bivouac_system_rpi4", + manage_mix_version?: true, + version_tag_prefix: "v", + manage_readme_version: "README.md" +end diff --git a/lib/bivouac_system_rpi4.ex b/lib/bivouac_system_rpi4.ex new file mode 100644 index 0000000..053f11b --- /dev/null +++ b/lib/bivouac_system_rpi4.ex @@ -0,0 +1,18 @@ +defmodule BivouacSystemRpi4 do + @moduledoc """ + Documentation for `BivouacSystemRpi4`. + """ + + @doc """ + Hello world. + + ## Examples + + iex> BivouacSystemRpi4.hello() + :world + + """ + def hello do + :world + end +end diff --git a/mix.exs b/mix.exs new file mode 100644 index 0000000..53458d7 --- /dev/null +++ b/mix.exs @@ -0,0 +1,180 @@ +defmodule BivouacSystemRpi4.MixProject do + use Mix.Project + + @app :bivouac_system_rpi4 + @source_url "https://code.harton.nz/james/bivouac_system_rpi4" + @version "0.1.0" + @description """ + A customised Raspberry Pi 4 buildroot for the Bivouac project. + """ + + @upstream_globs [ + "{fwup*,post*sh}", + "rootfs_overlay/**/*", + "fwup_include/**/*", + "linux/**/*", + "*.dts", + "*.txt" + ] + + 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], + compile: [&upstream_wrap("compile", "nerves_system_rpi4", &1)], + "nerves.artifact": [&upstream_wrap("nerves.artifact", "nerves_system_rpi4", &1)], + "nerves.system.lint": [&upstream_wrap("nerves.system.lint", "nerves_system_rpi4", &1)], + clean: [&upstream_wrap("clean", "nerves_system_rpi4", &1)] + ], + docs: docs(), + preferred_cli_env: %{ + docs: :docs, + "hex.build": :docs, + "hex.publish": :docs, + "git_ops.release": :docs + } + ] + end + + def application do + [extra_applications: [:eex]] + 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: [ + {:gitea_releases, "code.harton.nz/bivouac/bivouac_system_rpi4"} + ], + build_runner_opts: build_runner_opts(), + platform: Nerves.System.BR, + platform_config: [ + defconfig: "bivouac_defconfig" + ], + # The :env key is an optional experimental feature for adding environment + # variables to the crosscompile environment. These are intended for + # llvm-based tooling that may need more precise processor information. + env: [ + {"TARGET_ARCH", "aarch64"}, + {"TARGET_OS", "linux"}, + {"TARGET_ABI", "gnu"}, + {"TARGET_GCC_FLAGS", + "-mabi=lp64 -fstack-protector-strong -mcpu=cortex-a72 -fPIE -pie -Wl,-z,now -Wl,-z,relro"} + ], + checksum: package_files() + ] + end + + defp deps do + [ + # {:nerves, "~> 1.5.4 or ~> 1.6.0 or ~> 1.7.15 or ~> 1.8", runtime: false}, + {:nerves, + github: "jimsynz/nerves", branch: "add-gitea-artifacts", override: true, runtime: false}, + {:nerves_system_br, "1.24.1", runtime: false}, + {:nerves_toolchain_aarch64_nerves_linux_gnu, "~> 1.8.0", runtime: false}, + {:nerves_system_linter, "~> 0.4", only: [:dev, :test], runtime: false}, + {:ex_doc, "~> 0.22", only: :docs, runtime: false}, + {:git_ops, "~> 2.6", only: :docs, runtime: false} + ] + end + + defp docs do + [ + extras: ["README.md", "CHANGELOG.md"], + main: "readme", + source_ref: "v#{@version}", + source_url: @source_url, + skip_undefined_reference_warnings_on: ["CHANGELOG.md"] + ] + end + + defp package do + [ + files: package_files(), + licenses: ["HL3-FULL"], + links: %{"Code" => @source_url} + ] + end + + defp package_files do + [ + "bivouac_defconfig", + "CHANGELOG.md", + "Config.in", + "LICENSE.md", + "linux-6.1.defconfig", + "mix.exs", + "README.md" + ] + end + + defp build_runner_opts() do + # Download source files first to get download errors right away. + [make_args: primary_site() ++ ["source", "all", "legal-info"]] + end + + defp primary_site() do + case System.get_env("BR2_PRIMARY_SITE") do + nil -> [] + primary_site -> ["BR2_PRIMARY_SITE=#{primary_site}"] + 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 + + defp upstream_wrap(task, upstream_path, args) do + upstream_files = + __DIR__ + |> Path.join(upstream_path) + |> then(fn path -> + Enum.map(@upstream_globs, &Path.join(path, &1)) + end) + |> Enum.flat_map(&Path.wildcard/1) + |> Enum.reject(&File.dir?/1) + + {:ok, created_files} = + Enum.reduce_while(upstream_files, {:ok, []}, fn source_path, {:ok, created_files} -> + target_path = String.replace(source_path, "/#{upstream_path}", "") + + with :ok <- File.mkdir_p(Path.dirname(target_path)), + false <- File.exists?(target_path), + :ok <- File.cp(source_path, target_path) do + {:cont, {:ok, [target_path | created_files]}} + else + true -> {:cont, {:ok, created_files}} + error -> {:halt, error} + end + end) + + version_path = + __DIR__ + |> Path.join("VERSION") + + :ok = File.write(version_path, @version) + + Mix.Task.run(task, args) + + File.rm(version_path) + Enum.each(created_files, &File.rm/1) + end +end diff --git a/mix.lock b/mix.lock new file mode 100644 index 0000000..7fa3137 --- /dev/null +++ b/mix.lock @@ -0,0 +1,18 @@ +%{ + "castore": {:hex, :castore, "1.0.4", "ff4d0fb2e6411c0479b1d965a814ea6d00e51eb2f58697446e9c41a97d940b28", [:mix], [], "hexpm", "9418c1b8144e11656f0be99943db4caf04612e3eaecefb5dae9a2a87565584f8"}, + "earmark_parser": {:hex, :earmark_parser, "1.4.37", "2ad73550e27c8946648b06905a57e4d454e4d7229c2dafa72a0348c99d8be5f7", [:mix], [], "hexpm", "6b19783f2802f039806f375610faa22da130b8edc21209d0bff47918bb48360e"}, + "elixir_make": {:hex, :elixir_make, "0.7.7", "7128c60c2476019ed978210c245badf08b03dbec4f24d05790ef791da11aa17c", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}], "hexpm", "5bc19fff950fad52bbe5f211b12db9ec82c6b34a9647da0c2224b8b8464c7e6c"}, + "ex_doc": {:hex, :ex_doc, "0.30.6", "5f8b54854b240a2b55c9734c4b1d0dd7bdd41f71a095d42a70445c03cf05a281", [:mix], [{:earmark_parser, "~> 1.4.31", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "bd48f2ddacf4e482c727f9293d9498e0881597eae6ddc3d9562bd7923375109f"}, + "git_cli": {:hex, :git_cli, "0.3.0", "a5422f9b95c99483385b976f5d43f7e8233283a47cda13533d7c16131cb14df5", [:mix], [], "hexpm", "78cb952f4c86a41f4d3511f1d3ecb28edb268e3a7df278de2faa1bd4672eaf9b"}, + "git_ops": {:hex, :git_ops, "2.6.0", "e0791ee1cf5db03f2c61b7ebd70e2e95cba2bb9b9793011f26609f22c0900087", [:mix], [{:git_cli, "~> 0.2", [hex: :git_cli, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "b98fca849b18aaf490f4ac7d1dd8c6c469b0cc3e6632562d366cab095e666ffe"}, + "jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"}, + "makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"}, + "makeup_elixir": {:hex, :makeup_elixir, "0.16.1", "cc9e3ca312f1cfeccc572b37a09980287e243648108384b97ff2b76e505c3555", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "e127a341ad1b209bd80f7bd1620a15693a9908ed780c3b763bccf7d200c767c6"}, + "makeup_erlang": {:hex, :makeup_erlang, "0.1.2", "ad87296a092a46e03b7e9b0be7631ddcf64c790fa68a9ef5323b6cbb36affc72", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f3f5a1ca93ce6e092d92b6d9c049bcda58a3b617a8d888f8e7231c85630e8108"}, + "nerves": {:git, "https://github.com/jimsynz/nerves.git", "cc6982f7493cdc368ea095e59288bc06c6c4cec3", [branch: "add-gitea-artifacts"]}, + "nerves_system_br": {:hex, :nerves_system_br, "1.24.1", "2c9df0bee3bc01a971e1d72a5b137fe9448a74ba1fdd0da02c52e291b468f8a7", [:mix], [], "hexpm", "d13ce0501f4db51869628d138edf5bffbb4fe38f3afa9f9f1e5371f7501535ff"}, + "nerves_system_linter": {:hex, :nerves_system_linter, "0.4.0", "81e9a6f5018fe5fb67d7b43a04dca36156f62b55b5554eb2fa3964d3889d09cd", [:mix], [], "hexpm", "b5bd8480ce7a6317f4601ff41fd2f594bdf76aff0bdf6dcfac571c3fa1ec5f82"}, + "nerves_toolchain_aarch64_nerves_linux_gnu": {:hex, :nerves_toolchain_aarch64_nerves_linux_gnu, "1.8.0", "40f7fe58737aaa9c6beee0e3599cca2265d1b4e40d7ab2713d7ad872349f21c2", [:mix], [{:nerves, "~> 1.4", [hex: :nerves, repo: "hexpm", optional: false]}, {:nerves_toolchain_ctng, "~> 1.9.3", [hex: :nerves_toolchain_ctng, repo: "hexpm", optional: false]}], "hexpm", "c06a16b54634bbab7348ee7686e3b02574e0af742144c406b0f196b5b374349c"}, + "nerves_toolchain_ctng": {:hex, :nerves_toolchain_ctng, "1.9.3", "60e87fde05988c4264babc8d68a9221c7b8fe5dc195b7d1526f29b8e626c735c", [:mix], [{:nerves, "~> 1.0", [hex: :nerves, repo: "hexpm", optional: false]}], "hexpm", "2b6edb0687b7f78d3fa49958d759f647e351b23c1f59f637c617a6dc179994ae"}, + "nimble_parsec": {:hex, :nimble_parsec, "1.3.1", "2c54013ecf170e249e9291ed0a62e5832f70a476c61da16f6aac6dca0189f2af", [:mix], [], "hexpm", "2682e3c0b2eb58d90c6375fc0cc30bc7be06f365bf72608804fb9cffa5e1b167"}, +} diff --git a/nerves_system_rpi4 b/nerves_system_rpi4 new file mode 160000 index 0000000..8a3ffb8 --- /dev/null +++ b/nerves_system_rpi4 @@ -0,0 +1 @@ +Subproject commit 8a3ffb8feabb34d7efb00c37ec2712409b03260f diff --git a/rootfs_overlay/etc/.keep b/rootfs_overlay/etc/.keep new file mode 100644 index 0000000..e69de29 diff --git a/rootfs_overlay/etc/erlinit.config b/rootfs_overlay/etc/erlinit.config new file mode 100644 index 0000000..390b2a6 --- /dev/null +++ b/rootfs_overlay/etc/erlinit.config @@ -0,0 +1,81 @@ +# Additional configuration for erlinit +# +# To override the settings in this file, see +# https://hexdocs.pm/nerves/advanced-configuration.html#overriding-erlinit-config-from-mix-config. +# + +# Turn on the debug prints +#-v + +# Specify where erlinit should send the IEx prompt. Only one may be enabled at +# a time. +#-c ttyS0 # UART pins on the GPIO connector +-c tty1 # HDMI output + +# If more than one tty are available, always warn if the user is looking at the +# wrong one. +--warn-unused-tty + +# Use nbtty to improve terminal handling on serial ports. +# Comment out or delete for HDMI (tty1) +-s "/usr/bin/nbtty" + +# There's a call to getrandom(2) when loading the crypto NIF that's before +# nerves_runtime can start rngd. This syscall can block the BEAM indefinitely +# if there's not enough entropy in the kernel. We have not observed blocking on +# this platform. However, we don't know that getrandom(2) will always have +# enough entropy, so start rngd here to be safe. +--pre-run-exec /usr/sbin/rngd + +# Specify the user and group IDs for the Erlang VM +#--uid 100 +#--gid 200 + +# Uncomment to ensure that the system clock is set to at least the Nerves +# System's build date/time. If you enable this, you'll still need to use NTP or +# another mechanism to set the clock, but it won't be decades off. +#--update-clock + +# Uncomment to hang the board rather than rebooting when Erlang exits +# NOTE: Do not enable on production boards +#--hang-on-exit + +# Change the graceful shutdown time. If 10 seconds isn't long enough between +# calling "poweroff", "reboot", or "halt" and :init.stop/0 stopping all OTP +# applications, enable this option with a new timeout in milliseconds. +#--graceful-shutdown-timeout 15000 + +# Optionally run a program if the Erlang VM exits +#--run-on-exit /bin/sh + +# Enable UTF-8 filename handling in Erlang and custom inet configuration +-e LANG=en_US.UTF-8;LANGUAGE=en;ERL_INETRC=/etc/erl_inetrc + +# Enable crash dumps (set ERL_CRASH_DUMP_SECONDS=0 to disable) +-e ERL_CRASH_DUMP=/root/erl_crash.dump;ERL_CRASH_DUMP_SECONDS=5 + +# Mount the application partition (run "man fstab" for field names) +# NOTE: This must match the location in the fwup.conf. If it doesn't the system +# will probably still work fine, but you won't get shell history since +# shoehorn/nerves_runtime can't mount the application filesystem before +# the history is loaded. If this mount fails due to corruption, etc., +# nerves_runtime will auto-format it. Your applications will need to handle +# initializing any expected files and folders. +-m /dev/mmcblk0p1:/boot:vfat:ro,nodev,noexec,nosuid: +-m /dev/mmcblk0p3:/root:f2fs:nodev: +-m pstore:/sys/fs/pstore:pstore:nodev,noexec,nosuid: +-m tmpfs:/sys/fs/cgroup:tmpfs:nodev,noexec,nosuid:mode=755,size=1024k +-m cpu:/sys/fs/cgroup/cpu:cgroup:nodev,noexec,nosuid:cpu + +# Erlang release search path +-r /srv/erlang + +# Assign a hostname of the form "nerves-". +# See /etc/boardid.config for locating the serial number. +-d /usr/bin/boardid +-n bivouac-%s + +# If using shoehorn (https://github.com/nerves-project/shoehorn), start the +# shoehorn OTP release up first. If shoehorn isn't around, erlinit fails back +# to the main OTP release. +--boot shoehorn diff --git a/test/bivouac_system_rpi4_test.exs b/test/bivouac_system_rpi4_test.exs new file mode 100644 index 0000000..002eeb8 --- /dev/null +++ b/test/bivouac_system_rpi4_test.exs @@ -0,0 +1,8 @@ +defmodule BivouacSystemRpi4Test do + use ExUnit.Case + doctest BivouacSystemRpi4 + + test "greets the world" do + assert BivouacSystemRpi4.hello() == :world + end +end diff --git a/test/test_helper.exs b/test/test_helper.exs new file mode 100644 index 0000000..869559e --- /dev/null +++ b/test/test_helper.exs @@ -0,0 +1 @@ +ExUnit.start()