View Source UBootEnv.Config (uboot_env v1.0.1)

Utilities for reading the U-Boot's fw_env.config file.

Link to this section Summary

Functions

Return the first location

Return whether this is a redundant environment

Raising version of from_file/1

Create a UBootEnv.Config from a file (/etc/fw_env.config by default)

Raising version of from_string/1

Create a UBootEnv.Config from the contents of an fw_env.config file

Parse an integer

Return the second location

Return the environment block size

Link to this section Types

@type t() :: %UBootEnv.Config{locations: [UBootEnv.Location.t()]}

Link to this section Functions

@spec first(t()) :: UBootEnv.Location.t()

Return the first location

@spec format(t()) :: :redundant | :nonredundant

Return whether this is a redundant environment

@spec from_file!(Path.t()) :: t()

Raising version of from_file/1

@spec from_file(Path.t()) :: {:ok, t()} | {:error, atom()}

Create a UBootEnv.Config from a file (/etc/fw_env.config by default)

This file should be formatted as described in from_string/1.

@spec from_string!(String.t()) :: t()

Raising version of from_string/1

@spec from_string(String.t()) :: {:ok, t()} | {:error, atom()}

Create a UBootEnv.Config from the contents of an fw_env.config file

Only one or two U-Boot environment locations are supported. Each location row has the following format:

<Device name>	<Device offset>	<Env. size>	[Flash sector size]	[Number of sectors]
@spec parse_int(String.t()) :: integer()

Parse an integer

Examples:

iex> UBootEnv.Config.parse_int("0x12")
18

iex> UBootEnv.Config.parse_int("1234")
1234
@spec second(t()) :: UBootEnv.Location.t()

Return the second location

This raises for nonredundant environments.

@spec size(t()) :: pos_integer()

Return the environment block size