NVRAM2ENV(4)

NAME
nvram2env - copy nvram-like data into kernel environment

SYNOPSIS
device nvram2env

DESCRIPTION
nvram2env implements a simple method of reading the NVRAM-like data and information stored in flash and storing it in the kernel environment. It can then be used by various device drivers at boot-time.

The NVRAM-like data is an array of zero terminated strings. Each string contains the string name, "=" delimiter and the string value.

nvram2env copies the environment values into kernel environment using the kernel setenv call.

Configuration of nvram2env is done in device.hints(5) defining the NVRAM base address, fallback base address, maxsize and flags.

nvram2env is currently MIPS-specific.

  base
base - physical address where data block is stored.

  fallbackbase
fallbackbase - physical address where data block is stored, but only if not found at base.

  maxsize
maxsize - maximum size of data block.

  flags
flags - control flags, used to select nvram type and enable/disable CRC check.

0x0001
    Avoid CRC checking. Currently CRC checking is not implemented, so to be future compatible, please set it to "1".

0x0002
    Use format "Generic", skip uint32_t field, then zero terminating array of strings.

0x0004
    Use Broadcom CFE format. uint32_t signature "FLSH", uint32_t size, three unused fields uint32_t, then data.

0x0008
    Use U-Boot format, uint32_t crc, then zero terminating array of strings.

EXAMPLES
Usage in U-Boot case:

    hint.nvram.0.base=0x1f030000
    hint.nvram.0.maxsize=0x2000
    hint.nvram.0.flags=3 # 1 = No check, 2 = Format Generic
    hint.nvram.1.base=0x1f032000
    hint.nvram.1.maxsize=0x4000
    hint.nvram.1.flags=3 # 1 = No check, 2 = Format Generic

CFE nvram with fallback:

    hint.nvram.0.base=0x1fff8000
    hint.nvram.0.fallbackbase=0x1fc00400
    hint.nvram.0.flags=4 # 4 = Format Broadcom

but seems for CFE nvram preferred to read both blocks:

NVRAM partition: Static, CFE internal

    hint.nvram.0.flags=0x05 # Broadcom + nocheck
    hint.nvram.0.base=0x1fc00400

Dynamic, editable form CFE, override values from first

    hint.nvram.1.flags=0x05 # Broadcom + nocheck
    hint.nvram.1.base=0x1cff8000

SEE ALSO
kenv(1), kenv(2).

HISTORY
nvram2env first appeared in FreeBSD 9.0.

AUTHORS
-nosplit nvram2env Aleksandr Rybalko <ray@ddteam.net>.