UBootEnv.IO (uboot_env v1.0.2)
View SourceFunctions for reading and writing raw blocks to storage
This is the module that handles the low level CRC32 and redundant block details.
Summary
Functions
Package up U-Boot environment contents
Read a U-Boot environment block
Unpackage a U-Boot environment block
Write a U-Boot environment block
Types
@type generation() :: byte() | :unused
Functions
@spec package(binary(), pos_integer(), generation()) :: {:ok, iodata()} | {:error, :environment_too_small}
Package up U-Boot environment contents
The result can be written to where ever the environment block is persisted.
@spec read(UBootEnv.Config.t()) :: {:ok, binary()} | {:error, any()}
Read a U-Boot environment block
This function performs the actual read and in the case of redundant U-Boot environments, it returns the newer block. It does not decode.
@spec unpackage(binary(), :redundant | :nonredundant) :: {:ok, binary(), generation()} | {:error, :invalid_crc}
Unpackage a U-Boot environment block
This is the opposite of package/3. It will only return successfully if the input passes the U-Boot CRC check.
@spec write(UBootEnv.Config.t(), iodata()) :: :ok | {:error, atom()}
Write a U-Boot environment block
This function performs the actual write. In the case of redundant U-Boot environments, it writes the block in the right location and marks the generation byte appropriately so that it is used on the next read. It does not encode.