Skip to content

Commit

Permalink
Merge pull request #18 from amclain/configure-boardid
Browse files Browse the repository at this point in the history
Configure board ID
  • Loading branch information
amclain authored Dec 19, 2022
2 parents 34fe892 + 4bc907a commit 1c38b98
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,16 @@ file location by setting the environment variable
`NERVES_PROVISIONING=/path/to/provisioning.conf`. The default provisioning.conf
will set the `nerves_serial_number`, if you override the location to this file,
you will be responsible for setting this yourself.

## Hostname

By default the hostname will only include the last 4 digits of the board
identifier. If you would rather use the entire identifier, set the following
in your `config/target.exs` file:

```elixir
config :nerves,
erlinit: [
uniqueid_exec: "boardid"
]
```
9 changes: 9 additions & 0 deletions rootfs_overlay/etc/boardid.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Check if a serial number has been manually set with the nerves_serial_number
# U-Boot environment variable.
-b uboot_env -u nerves_serial_number

# Get the board identifier from the ATECC Trust&GO crypto chip if using the SOM.
-b atecc508a -X -a 0x35 -f /dev/i2c-0

# Fall back to using the MAC address.
-b macaddr
7 changes: 3 additions & 4 deletions rootfs_overlay/etc/erlinit.config
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,9 @@
# Erlang release search path
-r /srv/erlang

# Assign a unique hostname based on a board identifier. The logic is:
# 1. Check the U-boot environment block for a key named "nerves_serial_number"
# 2. Use the MAC address of the first Ethernet port.
-d "/usr/bin/boardid -b uboot_env -u nerves_serial_number -b macaddr -n 4"
# Assign a unique hostname based on a board identifier.
# See `/etc/boardid.config` for how the identifier is determined.
-d /usr/bin/boardid -n 4
-n nerves-%s

# If using shoehorn (https://github.com/nerves-project/shoehorn), start the
Expand Down

0 comments on commit 1c38b98

Please sign in to comment.