Skip to content

Build scripts unique name issue 70 - #166

Draft
StrongSad388 wants to merge 2 commits into
flipperdevices:devfrom
StrongSad388:build-scripts-unique-name-issue-70
Draft

Build scripts unique name issue 70#166
StrongSad388 wants to merge 2 commits into
flipperdevices:devfrom
StrongSad388:build-scripts-unique-name-issue-70

Conversation

@StrongSad388

Copy link
Copy Markdown

PR to address generating a unique name for each flipper-one device.

Issue flipperdevices#70 wants a permanent per-device name, equivalent to a serial number.
Deriving it from the CPU ID already in OTP avoids a factory programming step
and survives reflashing. Storing an assigned name instead would need an OTP
write path: mainline rockchip-otp is read-only, rk3576_data has .reg_read and
no .reg_write, so that means U-Boot work plus production tooling.

Names are CVCVCVCVC over 18 consonants and 5 vowels, so 18^5 * 5^4 =
1,180,980,000 of them. Uniqueness is probabilistic: measured over random
64-bit serials, a fleet of 1,000,000 devices contains ~450 that share a name
with another. The serial remains the identity, the name is only the label.

Writing to /etc/flipper-name overrides the derived name, which covers both a
factory-assigned name and a user rename.

name-denylist holds substrings that trigger a reroll, so a generated name does
not end up printed on a device or broadcast as an SSID. Only consonant/vowel
alternating strings are reachable, so the list is short by construction; it
blocks 1.3% of the name space.

--self-test covers the generator, the override, the denylist and the spread of
names across serials.
Replaces the 6-hex-char serial prefix in the hostname with the derived device
name from flipper-name.sh, so the name is what shows up over DHCP and mDNS.

BUILD_ID is dropped from the hostname. It is the DHCP and mDNS name, so it has
to stay stable across upgrades; the build id is still in the banner, the MOTD
and os-release.

Also sets PRETTY_HOSTNAME. BlueZ's hostname plugin reads it, so the device
advertises "Flipper One <Name>" over Bluetooth without further configuration.

The AP SSID placeholder in the router profile becomes WIFISSIDNAME and carries
the name rather than the raw serial, which is what issue flipperdevices#70 asks for. The name
is added to the Avahi TXT record and the MOTD alongside the serial.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant