Nerves.Runtime.Init (nerves_runtime v0.13.10)

View Source

GenServer that handles device initialization.

Initialization currently consists of:

  1. Mounting the application partition
  2. 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.

This GenServer is started by default. It can be prevented or overriden by setting the config option :init_module to another module or nil. This allows customizing application filesystem initialization:

# Override with GenServer module
config :nerves_runtime, init_module: MyApp.FilesystemInit
# Disable
config :nerves_runtime, init_module: nil

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

init_application_partition()

@spec init_application_partition() ::
  :mounted | :mounted_with_error | :noop | :unmounted

start_link(args)

@spec start_link(any()) :: GenServer.on_start()