Yes, you can. The environment variables must be stored in flash memory,
and your Linux kernel must support flash access through the MTD layer.
In the U-Boot source tree you can find the tools fw_printenv and fw_setenv
which work exactly like the U-Boot commands printenv resp. setenv
(see directory tools/env).
You can either build these tools with a fixed configuration selected at compile time,
or you can configure the tools using the /etc/fw_env.config configuration file
in your target root filesystem. Here is an example configuration file:
# Configuration file for fw_(printenv/saveenv) utility.
# Up to two entries are valid, in this case the redundand
# environment sector is assumed present.
#########################################################################
# For TQM8xxL modules:
#########################################################################
# MTD device name Device offset Env. size Flash sector size
/dev/mtd0 0x8000 0x4000 0x4000
/dev/mtd0 0xC000 0x4000 0x4000
#########################################################################
# For NSCU:
#########################################################################
# MTD device name Device offset Env. size Flash sector size
#/dev/mtd1 0x0000 0x8000 0x20000
#/dev/mtd2 0x0000 0x8000 0x20000
#########################################################################
# For LWMON
#########################################################################
# MTD device name Device offset Env. size Flash sector size
#/dev/mtd1 0x0000 0x2000 0x40000