Skip to content

Commit 1c38b98

Browse files
authored
Merge pull request #18 from amclain/configure-boardid
Configure board ID
2 parents 34fe892 + 4bc907a commit 1c38b98

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,16 @@ file location by setting the environment variable
169169
`NERVES_PROVISIONING=/path/to/provisioning.conf`. The default provisioning.conf
170170
will set the `nerves_serial_number`, if you override the location to this file,
171171
you will be responsible for setting this yourself.
172+
173+
## Hostname
174+
175+
By default the hostname will only include the last 4 digits of the board
176+
identifier. If you would rather use the entire identifier, set the following
177+
in your `config/target.exs` file:
178+
179+
```elixir
180+
config :nerves,
181+
erlinit: [
182+
uniqueid_exec: "boardid"
183+
]
184+
```

rootfs_overlay/etc/boardid.config

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Check if a serial number has been manually set with the nerves_serial_number
2+
# U-Boot environment variable.
3+
-b uboot_env -u nerves_serial_number
4+
5+
# Get the board identifier from the ATECC Trust&GO crypto chip if using the SOM.
6+
-b atecc508a -X -a 0x35 -f /dev/i2c-0
7+
8+
# Fall back to using the MAC address.
9+
-b macaddr

rootfs_overlay/etc/erlinit.config

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,9 @@
5757
# Erlang release search path
5858
-r /srv/erlang
5959

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

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

0 commit comments

Comments
 (0)