UBootEnv.Config (uboot_env v1.0.0) View Source

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

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

Raising version of from_file/1

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

Raising version of from_string/1

Parse an integer

Return the second location

Return the environment block size

Link to this section Types

Specs

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

Link to this section Functions

Specs

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

Return the first location

Specs

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

Return whether this is a redundant environment

Specs

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.

Specs

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

Raising version of from_file/1

Specs

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]

Specs

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

Raising version of from_string/1

Specs

parse_int(String.t()) :: integer()

Parse an integer

Examples:

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

iex> UBootEnv.Config.parse_int("1234")
1234

Specs

second(t()) :: UBootEnv.Location.t()

Return the second location

This raises for nonredundant environments.

Specs

size(t()) :: pos_integer()

Return the environment block size