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

UBootEnv reads and writes U-Boot environment blocks

It's like the commandline tools `fw_setenv` and `fw_printenv` except in pure
Elixir. It also uses `/etc/fw_env.config` by default to figure out where the
environment exists so that you need not store the configuration in two
places.

# `configuration`

```elixir
@spec configuration() :: {:ok, UBootEnv.Config.t()} | {:error, atom()}
```

Load the U-Boot environment configuration

This is returns the default U-Boot environment configuration from
`"/etc/fw_env.config"`. If you do not want this, see
`UBootEnv.Config.from_file/1` or `UBootEnv.Config.from_string/1` for
creating or loading a custom configuration.

# `read`

```elixir
@spec read() :: {:ok, map()} | {:error, reason :: atom()}
```

Read the U-Boot environment into a map or key value pairs

The configuration from `"/etc/fw_env.config"` is used to find the location of
the environment block. See `read/1` for specifying a custom location.

# `read`

```elixir
@spec read(UBootEnv.Config.t()) :: {:ok, map()} | {:error, atom()}
```

Read the U-Boot environment into a map or key value pairs

# `write`

```elixir
@spec write(map()) :: :ok | {:error, reason :: atom()}
```

Write a map of key value pairs to the U-Boot environment

The configuration from `"/etc/fw_env.config"` is used to find the location of
the environment block. See `write/2` for specifying a custom location.

# `write`

```elixir
@spec write(map(), UBootEnv.Config.t()) :: :ok | {:error, atom()}
```

Write a map of key-value pairs to the U-Boot environment

---

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