Build scripts unique name issue 70 - #166
Draft
StrongSad388 wants to merge 2 commits into
Draft
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR to address generating a unique name for each flipper-one device.