# `UBootEnv.Config`
[🔗](https://github.com/nerves-project/uboot_env/blob/v1.0.2/lib/uboot_env/config.ex#L8)

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

# `t`

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

# `first`

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

Return the first location

# `format`

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

Return whether this is a redundant environment

# `from_file`

```elixir
@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`.

# `from_file!`

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

Raising version of `from_file/1`

# `from_string`

```elixir
@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]
```

# `from_string!`

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

Raising version of `from_string/1`

# `parse_int`

```elixir
@spec parse_int(String.t()) :: integer()
```

Parse an integer

Examples:

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

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

# `second`

```elixir
@spec second(t()) :: UBootEnv.Location.t()
```

Return the second location

This raises for nonredundant environments.

# `size`

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

Return the environment block size

---

*Consult [api-reference.md](api-reference.md) for complete listing*
