uboot_env v0.1.0 UBootEnv.Config

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

Link to this section Summary

Functions

Decode the contents of a fw_env.config file

Parse an integer

Read and decode the specified file (or fw_env.config if not passed)

Link to this section Functions

Link to this function

decode(config)
decode(String.t()) ::
  {dev_name :: String.t(), dev_offset :: non_neg_integer(),
   env_size :: pos_integer()}

Decode the contents of a fw_env.config file.

Link to this function

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

Parse an integer

Examples:

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

iex> UBootEnv.Config.parse_int("1234")
1234
Link to this function

read(config_file \\ "/etc/fw_env.config")
read(Path.t()) ::
  {:ok,
   {dev_name :: String.t(), dev_offset :: non_neg_integer(),
    env_size :: pos_integer()}}
  | {:error, reason :: any()}

Read and decode the specified file (or fw_env.config if not passed).

On success, this returns a tuple with the device name that contains the U-Boot environment block, the offset in that file, and the environment size.