View Source Nerves.Runtime.Init (nerves_runtime v0.13.4)
GenServer that handles device initialization.
Initialization currently consists of:
- Mounting the application partition
- If the application partition can't be mounted, format it, and then mount it.
Device initialization is usually a first boot only operation. It's possible that device filesystems get corrupt enough to cause them to be reinitialized. Since corruption should be rare, Nerves systems create firmware images without formatting the application partition. This has the benefit of exercising the corruption repair code. It's also required since some filesystem types can only be formatted on device.
Long format times can be problematic in manufacturing. If this is an issue, see if you can use F2FS since it formats much faster than ext4. Some devices have also had stalls when formatting while waiting for enough entropy to generate a UUID. Look into hardcoding UUIDs or enabling a hw random number generator to increase entropy.