[U-Boot] [PATCH v3 21/24] env: Rename setenv() and friends to env_set()

Simon Glass sjg at chromium.org
Wed Jul 26 17:19:45 UTC 2017


We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd at denx.de>
Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v3: None
Changes in v2:
- Add new patch to rename setenv() and friends to env_set()

 api/api.c                                          |  4 +-
 arch/arm/cpu/armv7/vf610/generic.c                 |  2 +-
 arch/arm/cpu/armv8/fsl-layerscape/soc.c            |  2 +-
 arch/arm/lib/semihosting.c                         |  2 +-
 arch/arm/mach-davinci/misc.c                       |  2 +-
 arch/arm/mach-imx/mx6/opos6ul.c                    |  2 +-
 arch/arm/mach-imx/mx7/soc.c                        |  4 +-
 arch/arm/mach-omap2/boot-common.c                  |  2 +-
 arch/arm/mach-omap2/utils.c                        | 12 ++--
 arch/arm/mach-rockchip/rk3036-board.c              |  4 +-
 arch/arm/mach-rockchip/rk322x-board.c              |  4 +-
 arch/arm/mach-rockchip/rk3288-board.c              |  4 +-
 arch/arm/mach-socfpga/misc_gen5.c                  |  4 +-
 arch/arm/mach-tegra/board2.c                       |  4 +-
 arch/arm/mach-tegra/tegra186/nvtboot_board.c       |  4 +-
 arch/arm/mach-uniphier/board_late_init.c           | 10 +--
 arch/arm/mach-uniphier/mmc-first-dev.c             |  2 +-
 arch/powerpc/cpu/mpc85xx/cpu_init.c                |  2 +-
 arch/powerpc/include/asm/fsl_secure_boot.h         |  2 +-
 board/Arcturus/ucp1020/cmd_arc.c                   | 14 ++---
 board/Arcturus/ucp1020/ucp1020.c                   |  6 +-
 board/BuR/brppt1/board.c                           |  2 +-
 board/BuR/brxre1/board.c                           | 16 ++---
 board/BuR/common/common.c                          |  4 +-
 board/CZ.NIC/turris_omnia/turris_omnia.c           |  8 +--
 board/LaCie/net2big_v2/net2big_v2.c                |  2 +-
 board/LaCie/netspace_v2/netspace_v2.c              |  2 +-
 board/Synology/ds414/cmd_syno.c                    |  6 +-
 board/amazon/kc1/kc1.c                             |  2 +-
 board/amlogic/odroid-c2/odroid-c2.c                |  4 +-
 board/aries/ma5d4evk/ma5d4evk.c                    |  2 +-
 board/aristainetos/aristainetos-v2.c               |  4 +-
 board/armltd/integrator/integrator.c               |  2 +-
 board/atmel/sama5d2_xplained/sama5d2_xplained.c    |  2 +-
 board/atmel/sama5d3xek/sama5d3xek.c                |  2 +-
 board/bachmann/ot1200/ot1200.c                     |  4 +-
 board/birdland/bav335x/board.c                     |  6 +-
 board/bosch/shc/board.c                            |  8 +--
 board/boundary/nitrogen6x/nitrogen6x.c             |  6 +-
 board/buffalo/lsxl/lsxl.c                          |  2 +-
 board/cadence/xtfpga/xtfpga.c                      |  2 +-
 board/ccv/xpress/xpress.c                          |  2 +-
 board/compulab/cl-som-am57x/eth.c                  |  2 +-
 board/compulab/cm_fx6/cm_fx6.c                     |  2 +-
 board/compulab/cm_t335/cm_t335.c                   |  2 +-
 board/compulab/cm_t35/cm_t35.c                     |  2 +-
 board/compulab/cm_t3517/cm_t3517.c                 |  2 +-
 board/compulab/cm_t54/cm_t54.c                     |  2 +-
 board/congatec/cgtqmx6eval/cgtqmx6eval.c           |  4 +-
 board/cssi/MCR3000/MCR3000.c                       |  2 +-
 board/davinci/da8xxevm/da850evm.c                  |  2 +-
 board/davinci/da8xxevm/omapl138_lcdk.c             |  2 +-
 board/el/el6x/el6x.c                               |  2 +-
 board/engicam/common/board.c                       | 16 ++---
 board/engicam/common/board.h                       |  2 +-
 board/engicam/geam6ul/geam6ul.c                    |  4 +-
 board/engicam/icorem6/icorem6.c                    |  6 +-
 board/engicam/icorem6_rqs/icorem6_rqs.c            |  6 +-
 board/engicam/isiotmx6ul/isiotmx6ul.c              |  6 +-
 board/freescale/common/cmd_esbc_validate.c         |  2 +-
 board/freescale/common/fsl_chain_of_trust.c        |  6 +-
 board/freescale/common/sys_eeprom.c                |  2 +-
 board/freescale/ls1021aqds/ls1021aqds.c            |  2 +-
 board/freescale/ls1021atwr/ls1021atwr.c            |  2 +-
 board/freescale/mpc8323erdb/mpc8323erdb.c          |  2 +-
 board/freescale/mx53loco/mx53loco.c                |  4 +-
 board/freescale/mx6sabreauto/mx6sabreauto.c        |  8 +--
 board/freescale/mx6sabresd/mx6sabresd.c            |  8 +--
 board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c  |  6 +-
 board/freescale/mx6ullevk/mx6ullevk.c              |  4 +-
 board/freescale/qemu-ppce500/qemu-ppce500.c        |  4 +-
 board/gateworks/gw_ventana/gw_ventana.c            | 30 ++++-----
 board/grinn/chiliboard/board.c                     |  4 +-
 board/grinn/liteboard/board.c                      |  4 +-
 board/gumstix/pepper/board.c                       |  2 +-
 board/highbank/highbank.c                          |  4 +-
 board/htkw/mcx/mcx.c                               |  2 +-
 board/isee/igep003x/board.c                        |  8 +--
 board/isee/igep00x0/igep00x0.c                     |  4 +-
 board/keymile/common/common.c                      | 16 ++---
 board/keymile/common/ivm.c                         |  8 +--
 board/keymile/km83xx/km83xx.c                      |  8 +--
 board/keymile/km_arm/km_arm.c                      |  4 +-
 board/keymile/kmp204x/kmp204x.c                    |  2 +-
 board/kosagi/novena/novena.c                       |  2 +-
 board/lg/sniper/sniper.c                           |  2 +-
 board/liebherr/mccmon6/mccmon6.c                   |  2 +-
 board/logicpd/imx6/imx6logic.c                     |  6 +-
 board/logicpd/omap3som/omap3logic.c                |  2 +-
 board/logicpd/zoom1/zoom1.c                        |  2 +-
 board/nokia/rx51/rx51.c                            |  2 +-
 board/overo/overo.c                                | 44 ++++++-------
 board/phytec/pcm051/board.c                        |  2 +-
 board/qualcomm/dragonboard410c/dragonboard410c.c   |  2 +-
 board/raspberrypi/rpi/rpi.c                        | 18 +++---
 board/renesas/blanche/blanche.c                    |  2 +-
 board/renesas/ecovec/ecovec.c                      |  2 +-
 board/renesas/sh7752evb/sh7752evb.c                |  4 +-
 board/renesas/sh7753evb/sh7753evb.c                |  4 +-
 board/renesas/sh7757lcr/sh7757lcr.c                |  6 +-
 board/rockchip/kylin_rk3036/kylin_rk3036.c         |  2 +-
 board/rockchip/tinker_rk3288/tinker-rk3288.c       |  2 +-
 board/samsung/common/misc.c                        | 14 ++---
 board/samsung/trats/trats.c                        |  2 +-
 board/samsung/universal_c210/universal.c           |  2 +-
 board/samtec/vining_2000/vining_2000.c             |  8 +--
 board/samtec/vining_fpga/socfpga.c                 | 12 ++--
 board/siemens/common/factoryset.c                  |  8 +--
 board/siemens/common/factoryset.h                  |  2 +-
 board/siemens/draco/board.c                        |  8 +--
 board/siemens/pxm2/board.c                         |  6 +-
 board/siemens/rut/board.c                          |  4 +-
 board/siemens/taurus/taurus.c                      | 24 ++++----
 board/silica/pengwyn/board.c                       |  2 +-
 board/solidrun/mx6cuboxi/mx6cuboxi.c               |  8 +--
 board/spear/common/spr_misc.c                      | 10 +--
 board/st/stm32f429-discovery/stm32f429-discovery.c |  2 +-
 board/sunxi/board.c                                | 12 ++--
 board/syteco/zmx25/zmx25.c                         |  4 +-
 board/tcl/sl50/board.c                             |  6 +-
 board/technologic/ts4800/ts4800.c                  |  2 +-
 board/theobroma-systems/puma_rk3399/puma-rk3399.c  |  6 +-
 board/ti/am335x/board.c                            |  8 +--
 board/ti/am43xx/board.c                            |  6 +-
 board/ti/am57xx/board.c                            | 14 ++---
 board/ti/beagle/beagle.c                           | 38 ++++++------
 board/ti/common/board_detect.c                     | 18 +++---
 board/ti/dra7xx/evm.c                              |  6 +-
 board/ti/evm/evm.c                                 |  2 +-
 board/ti/ks2_evm/board_k2g.c                       |  4 +-
 board/ti/panda/panda.c                             |  4 +-
 board/ti/ti814x/evm.c                              |  2 +-
 board/ti/ti816x/evm.c                              |  2 +-
 board/timll/devkit8000/devkit8000.c                |  2 +-
 board/toradex/apalis_imx6/apalis_imx6.c            |  4 +-
 board/toradex/colibri_imx6/colibri_imx6.c          |  2 +-
 board/toradex/colibri_vf/colibri_vf.c              |  2 +-
 board/toradex/common/tdx-common.c                  |  6 +-
 board/tqc/tqma6/tqma6.c                            |  2 +-
 board/udoo/neo/neo.c                               |  2 +-
 board/udoo/udoo.c                                  |  4 +-
 board/varisys/common/sys_eeprom.c                  |  4 +-
 board/vscom/baltos/board.c                         |  6 +-
 board/wandboard/wandboard.c                        |  8 +--
 board/xilinx/zynq/board.c                          | 12 ++--
 board/xilinx/zynqmp/zynqmp.c                       |  2 +-
 cmd/cbfs.c                                         |  2 +-
 cmd/cramfs.c                                       |  2 +-
 cmd/fdt.c                                          | 29 +++++----
 cmd/gpt.c                                          |  2 +-
 cmd/ini.c                                          |  2 +-
 cmd/jffs2.c                                        |  2 +-
 cmd/load.c                                         |  6 +-
 cmd/lzmadec.c                                      |  2 +-
 cmd/md5sum.c                                       |  2 +-
 cmd/mtdparts.c                                     | 28 ++++-----
 cmd/nand.c                                         |  6 +-
 cmd/net.c                                          | 34 +++++-----
 cmd/nvedit.c                                       | 14 ++---
 cmd/part.c                                         |  8 +--
 cmd/pxe.c                                          |  6 +-
 cmd/qfw.c                                          |  2 +-
 cmd/reiser.c                                       |  2 +-
 cmd/setexpr.c                                      |  8 +--
 cmd/tpm.c                                          |  4 +-
 cmd/trace.c                                        | 12 ++--
 cmd/unzip.c                                        |  2 +-
 cmd/ximg.c                                         |  4 +-
 cmd/zfs.c                                          |  2 +-
 cmd/zip.c                                          |  2 +-
 common/autoboot.c                                  |  6 +-
 common/board_r.c                                   |  4 +-
 common/bootm.c                                     |  6 +-
 common/bootm_os.c                                  |  2 +-
 common/cli_hush.c                                  |  2 +-
 common/console.c                                   |  4 +-
 common/hash.c                                      |  2 +-
 common/hwconfig.c                                  |  4 +-
 common/image-android.c                             |  2 +-
 common/main.c                                      |  2 +-
 common/spl/Kconfig                                 |  2 +-
 common/spl/spl_dfu.c                               |  2 +-
 common/spl/spl_net.c                               |  4 +-
 common/update.c                                    |  4 +-
 doc/README.enetaddr                                |  6 +-
 drivers/bootcount/bootcount_env.c                  |  2 +-
 drivers/mtd/dataflash.c                            |  5 +-
 drivers/net/fec_mxc.c                              |  2 +-
 drivers/net/fm/fm.c                                |  2 +-
 drivers/net/lan91c96.c                             |  2 +-
 drivers/net/ne2000_base.c                          |  2 +-
 drivers/net/sandbox-raw.c                          |  4 +-
 drivers/scsi/scsi.c                                |  2 +-
 drivers/usb/gadget/ether.c                         |  2 +-
 fs/fs.c                                            | 10 +--
 fs/ubifs/ubifs.c                                   |  2 +-
 include/_exports.h                                 |  2 +-
 include/common.h                                   | 39 ++++++++++--
 include/configs/tam3517-common.h                   |  2 +-
 include/exports.h                                  |  2 +-
 include/fsl_validate.h                             |  2 +-
 include/net.h                                      |  6 +-
 include/search.h                                   |  2 +-
 lib/uuid.c                                         |  2 +-
 net/arp.c                                          |  2 +-
 net/bootp.c                                        |  2 +-
 net/dns.c                                          |  2 +-
 net/eth-uclass.c                                   |  2 +-
 net/eth_common.c                                   | 12 ++--
 net/eth_internal.h                                 |  4 +-
 net/eth_legacy.c                                   |  4 +-
 net/net.c                                          |  4 +-
 test/dm/eth.c                                      | 72 +++++++++++-----------
 tools/env/fw_env_main.c                            |  4 +-
 214 files changed, 632 insertions(+), 601 deletions(-)

diff --git a/api/api.c b/api/api.c
index c368511704..2e620e2a0f 100644
--- a/api/api.c
+++ b/api/api.c
@@ -481,7 +481,7 @@ static int API_env_set(va_list ap)
 	if ((value = (char *)va_arg(ap, uintptr_t)) == NULL)
 		return API_EINVAL;
 
-	setenv(name, value);
+	env_set(name, value);
 
 	return 0;
 }
@@ -663,7 +663,7 @@ void api_init(void)
 		return;
 	}
 
-	setenv_hex("api_address", (unsigned long)sig);
+	env_set_hex("api_address", (unsigned long)sig);
 	debugf("API sig @ 0x%lX\n", (unsigned long)sig);
 	memcpy(sig->magic, API_SIG_MAGIC, 8);
 	sig->version = API_SIG_VERSION;
diff --git a/arch/arm/cpu/armv7/vf610/generic.c b/arch/arm/cpu/armv7/vf610/generic.c
index ac2d8d1a3f..88f3f4dd16 100644
--- a/arch/arm/cpu/armv7/vf610/generic.c
+++ b/arch/arm/cpu/armv7/vf610/generic.c
@@ -329,7 +329,7 @@ int arch_misc_init(void)
 
 	strcpy(soc, "vf");
 	strcat(soc, soc_type);
-	setenv("soc", soc);
+	env_set("soc", soc);
 
 	return 0;
 }
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/soc.c b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
index aee1ffa7d4..23f3809418 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/soc.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
@@ -522,7 +522,7 @@ int board_late_init(void)
 	sata_init();
 #endif
 #ifdef CONFIG_CHAIN_OF_TRUST
-	fsl_setenv_chain_of_trust();
+	fsl_env_set_chain_of_trust();
 #endif
 #ifdef CONFIG_QSPI_AHB_INIT
 	qspi_ahb_init();
diff --git a/arch/arm/lib/semihosting.c b/arch/arm/lib/semihosting.c
index 415ac89de9..bcd16ee591 100644
--- a/arch/arm/lib/semihosting.c
+++ b/arch/arm/lib/semihosting.c
@@ -200,7 +200,7 @@ static int do_smhload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		/* Optionally save returned end to the environment */
 		if (argc == 4) {
 			sprintf(end_str, "0x%08lx", end_addr);
-			setenv(argv[3], end_str);
+			env_set(argv[3], end_str);
 		}
 	} else {
 		return CMD_RET_USAGE;
diff --git a/arch/arm/mach-davinci/misc.c b/arch/arm/mach-davinci/misc.c
index ec331ba6bb..4441242cc7 100644
--- a/arch/arm/mach-davinci/misc.c
+++ b/arch/arm/mach-davinci/misc.c
@@ -99,7 +99,7 @@ void davinci_sync_env_enetaddr(uint8_t *rom_enetaddr)
 		debug("### Setting environment from EEPROM MAC address = "
 			"\"%pM\"\n",
 			env_enetaddr);
-		ret = !eth_setenv_enetaddr("ethaddr", rom_enetaddr);
+		ret = !eth_env_set_enetaddr("ethaddr", rom_enetaddr);
 	}
 	if (!ret)
 		printf("Failed to set mac address from EEPROM: %d\n", ret);
diff --git a/arch/arm/mach-imx/mx6/opos6ul.c b/arch/arm/mach-imx/mx6/opos6ul.c
index 22b244079b..f8d7e8ee68 100644
--- a/arch/arm/mach-imx/mx6/opos6ul.c
+++ b/arch/arm/mach-imx/mx6/opos6ul.c
@@ -132,7 +132,7 @@ int board_late_init(void)
 	/* In bootstrap don't use the env vars */
 	if (((reg & 0x3000000) >> 24) == 0x1) {
 		set_default_env(NULL);
-		setenv("preboot", "");
+		env_set("preboot", "");
 	}
 
 	return opos6ul_board_late_init();
diff --git a/arch/arm/mach-imx/mx7/soc.c b/arch/arm/mach-imx/mx7/soc.c
index 4cf977e20a..7152c847d0 100644
--- a/arch/arm/mach-imx/mx7/soc.c
+++ b/arch/arm/mach-imx/mx7/soc.c
@@ -256,9 +256,9 @@ int arch_misc_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 	if (is_mx7d())
-		setenv("soc", "imx7d");
+		env_set("soc", "imx7d");
 	else
-		setenv("soc", "imx7s");
+		env_set("soc", "imx7s");
 #endif
 
 	return 0;
diff --git a/arch/arm/mach-omap2/boot-common.c b/arch/arm/mach-omap2/boot-common.c
index 2bcc8e9f97..26245aa169 100644
--- a/arch/arm/mach-omap2/boot-common.c
+++ b/arch/arm/mach-omap2/boot-common.c
@@ -241,7 +241,7 @@ void arch_preboot_os(void)
 int fb_set_reboot_flag(void)
 {
 	printf("Setting reboot to fastboot flag ...\n");
-	setenv("dofastboot", "1");
+	env_set("dofastboot", "1");
 	env_save();
 	return 0;
 }
diff --git a/arch/arm/mach-omap2/utils.c b/arch/arm/mach-omap2/utils.c
index 1946641eb9..c03e93878d 100644
--- a/arch/arm/mach-omap2/utils.c
+++ b/arch/arm/mach-omap2/utils.c
@@ -40,7 +40,7 @@ static void omap_set_fastboot_cpu(void)
 		printf("Warning: fastboot.cpu: unknown CPU rev: %u\n", cpu_rev);
 	}
 
-	setenv("fastboot.cpu", cpu);
+	env_set("fastboot.cpu", cpu);
 }
 
 static void omap_set_fastboot_secure(void)
@@ -63,7 +63,7 @@ static void omap_set_fastboot_secure(void)
 		printf("Warning: fastboot.secure: unknown CPU sec: %u\n", dev);
 	}
 
-	setenv("fastboot.secure", secure);
+	env_set("fastboot.secure", secure);
 }
 
 static void omap_set_fastboot_board_rev(void)
@@ -74,7 +74,7 @@ static void omap_set_fastboot_board_rev(void)
 	if (board_rev == NULL)
 		printf("Warning: fastboot.board_rev: unknown board revision\n");
 
-	setenv("fastboot.board_rev", board_rev);
+	env_set("fastboot.board_rev", board_rev);
 }
 
 #ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
@@ -118,7 +118,7 @@ static void omap_set_fastboot_userdata_size(void)
 		sprintf(buf, "%u", sz_kb);
 	}
 
-	setenv("fastboot.userdata_size", buf);
+	env_set("fastboot.userdata_size", buf);
 }
 #else
 static inline void omap_set_fastboot_userdata_size(void)
@@ -173,7 +173,7 @@ void omap_die_id_serial(void)
 		snprintf(serial_string, sizeof(serial_string),
 			"%08x%08x", die_id[0], die_id[3]);
 
-		setenv("serial#", serial_string);
+		env_set("serial#", serial_string);
 	}
 }
 
@@ -214,7 +214,7 @@ void omap_die_id_usbethaddr(void)
 		mac[4] = die_id[0] & 0xff;
 		mac[5] = (die_id[0] >> 8) & 0xff;
 
-		eth_setenv_enetaddr("usbethaddr", mac);
+		eth_env_set_enetaddr("usbethaddr", mac);
 	}
 }
 
diff --git a/arch/arm/mach-rockchip/rk3036-board.c b/arch/arm/mach-rockchip/rk3036-board.c
index 26ea23b014..a3457f3914 100644
--- a/arch/arm/mach-rockchip/rk3036-board.c
+++ b/arch/arm/mach-rockchip/rk3036-board.c
@@ -34,11 +34,11 @@ static void setup_boot_mode(void)
 	switch (boot_mode) {
 	case BOOT_FASTBOOT:
 		printf("enter fastboot!\n");
-		setenv("preboot", "setenv preboot; fastboot usb0");
+		env_set("preboot", "setenv preboot; fastboot usb0");
 		break;
 	case BOOT_UMS:
 		printf("enter UMS!\n");
-		setenv("preboot", "setenv preboot; ums mmc 0");
+		env_set("preboot", "setenv preboot; ums mmc 0");
 		break;
 	}
 }
diff --git a/arch/arm/mach-rockchip/rk322x-board.c b/arch/arm/mach-rockchip/rk322x-board.c
index b6543a5108..1e79c19309 100644
--- a/arch/arm/mach-rockchip/rk322x-board.c
+++ b/arch/arm/mach-rockchip/rk322x-board.c
@@ -30,11 +30,11 @@ static void setup_boot_mode(void)
 	switch (boot_mode) {
 	case BOOT_FASTBOOT:
 		printf("enter fastboot!\n");
-		setenv("preboot", "setenv preboot; fastboot usb0");
+		env_set("preboot", "setenv preboot; fastboot usb0");
 		break;
 	case BOOT_UMS:
 		printf("enter UMS!\n");
-		setenv("preboot", "setenv preboot; ums mmc 0");
+		env_set("preboot", "setenv preboot; ums mmc 0");
 		break;
 	}
 }
diff --git a/arch/arm/mach-rockchip/rk3288-board.c b/arch/arm/mach-rockchip/rk3288-board.c
index 613967c307..4a3f9e8df3 100644
--- a/arch/arm/mach-rockchip/rk3288-board.c
+++ b/arch/arm/mach-rockchip/rk3288-board.c
@@ -37,11 +37,11 @@ static void setup_boot_mode(void)
 	switch (boot_mode) {
 	case BOOT_FASTBOOT:
 		printf("enter fastboot!\n");
-		setenv("preboot", "setenv preboot; fastboot usb0");
+		env_set("preboot", "setenv preboot; fastboot usb0");
 		break;
 	case BOOT_UMS:
 		printf("enter UMS!\n");
-		setenv("preboot", "setenv preboot; if mmc dev 0;"
+		env_set("preboot", "setenv preboot; if mmc dev 0;"
 		       "then ums mmc 0; else ums mmc 1;fi");
 		break;
 	}
diff --git a/arch/arm/mach-socfpga/misc_gen5.c b/arch/arm/mach-socfpga/misc_gen5.c
index 49b26b3570..2f1da740fb 100644
--- a/arch/arm/mach-socfpga/misc_gen5.c
+++ b/arch/arm/mach-socfpga/misc_gen5.c
@@ -219,9 +219,9 @@ int arch_misc_init(void)
 {
 	const u32 bsel = readl(&sysmgr_regs->bootinfo) & 0x7;
 	const int fpga_id = socfpga_fpga_id(0);
-	setenv("bootmode", bsel_str[bsel].mode);
+	env_set("bootmode", bsel_str[bsel].mode);
 	if (fpga_id >= 0)
-		setenv("fpgatype", socfpga_fpga_model[fpga_id].var);
+		env_set("fpgatype", socfpga_fpga_model[fpga_id].var);
 	return socfpga_eth_reset();
 }
 #endif
diff --git a/arch/arm/mach-tegra/board2.c b/arch/arm/mach-tegra/board2.c
index 6b5fa7df62..621d0eea1f 100644
--- a/arch/arm/mach-tegra/board2.c
+++ b/arch/arm/mach-tegra/board2.c
@@ -220,9 +220,9 @@ int board_late_init(void)
 #if defined(CONFIG_TEGRA_SUPPORT_NON_SECURE)
 	if (tegra_cpu_is_non_secure()) {
 		printf("CPU is in NS mode\n");
-		setenv("cpu_ns_mode", "1");
+		env_set("cpu_ns_mode", "1");
 	} else {
-		setenv("cpu_ns_mode", "");
+		env_set("cpu_ns_mode", "");
 	}
 #endif
 	start_cpu_fan();
diff --git a/arch/arm/mach-tegra/tegra186/nvtboot_board.c b/arch/arm/mach-tegra/tegra186/nvtboot_board.c
index feb935f0d9..9cd3fe2f30 100644
--- a/arch/arm/mach-tegra/tegra186/nvtboot_board.c
+++ b/arch/arm/mach-tegra/tegra186/nvtboot_board.c
@@ -15,7 +15,7 @@ static int set_fdt_addr(void)
 {
 	int ret;
 
-	ret = setenv_hex("fdt_addr", nvtboot_boot_x0);
+	ret = env_set_hex("fdt_addr", nvtboot_boot_x0);
 	if (ret) {
 		printf("Failed to set fdt_addr to point at DTB: %d\n", ret);
 		return ret;
@@ -49,7 +49,7 @@ static int set_ethaddr_from_nvtboot(void)
 		return -ENOENT;
 	}
 
-	ret = setenv("ethaddr", (void *)prop);
+	ret = env_set("ethaddr", (void *)prop);
 	if (ret) {
 		printf("Failed to set ethaddr from nvtboot DTB: %d\n", ret);
 		return ret;
diff --git a/arch/arm/mach-uniphier/board_late_init.c b/arch/arm/mach-uniphier/board_late_init.c
index 4bfa10b374..e6d600e41f 100644
--- a/arch/arm/mach-uniphier/board_late_init.c
+++ b/arch/arm/mach-uniphier/board_late_init.c
@@ -55,7 +55,7 @@ static int uniphier_set_fdt_file(void)
 
 	strncat(dtb_name, ".dtb", buf_len);
 
-	return setenv("fdt_file", dtb_name);
+	return env_set("fdt_file", dtb_name);
 }
 
 int board_late_init(void)
@@ -65,20 +65,20 @@ int board_late_init(void)
 	switch (uniphier_boot_device_raw()) {
 	case BOOT_DEVICE_MMC1:
 		printf("eMMC Boot");
-		setenv("bootmode", "emmcboot");
+		env_set("bootmode", "emmcboot");
 		break;
 	case BOOT_DEVICE_NAND:
 		printf("NAND Boot");
-		setenv("bootmode", "nandboot");
+		env_set("bootmode", "nandboot");
 		nand_denali_wp_disable();
 		break;
 	case BOOT_DEVICE_NOR:
 		printf("NOR Boot");
-		setenv("bootmode", "norboot");
+		env_set("bootmode", "norboot");
 		break;
 	case BOOT_DEVICE_USB:
 		printf("USB Boot");
-		setenv("bootmode", "usbboot");
+		env_set("bootmode", "usbboot");
 		break;
 	default:
 		printf("Unknown");
diff --git a/arch/arm/mach-uniphier/mmc-first-dev.c b/arch/arm/mach-uniphier/mmc-first-dev.c
index 8c45229a89..acc859a6c3 100644
--- a/arch/arm/mach-uniphier/mmc-first-dev.c
+++ b/arch/arm/mach-uniphier/mmc-first-dev.c
@@ -35,7 +35,7 @@ static int do_mmcsetn(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	if (dev < 0)
 		return CMD_RET_FAILURE;
 
-	setenv_ulong("mmc_first_dev", dev);
+	env_set_ulong("mmc_first_dev", dev);
 	return CMD_RET_SUCCESS;
 }
 
diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c b/arch/powerpc/cpu/mpc85xx/cpu_init.c
index a3076d8d71..52a33ec53f 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c
@@ -1052,7 +1052,7 @@ void cpu_secondary_init_r(void)
 int board_late_init(void)
 {
 #ifdef CONFIG_CHAIN_OF_TRUST
-	fsl_setenv_chain_of_trust();
+	fsl_env_set_chain_of_trust();
 #endif
 
 	return 0;
diff --git a/arch/powerpc/include/asm/fsl_secure_boot.h b/arch/powerpc/include/asm/fsl_secure_boot.h
index 76921eea9a..13eee1bfcf 100644
--- a/arch/powerpc/include/asm/fsl_secure_boot.h
+++ b/arch/powerpc/include/asm/fsl_secure_boot.h
@@ -103,7 +103,7 @@
 
 #ifndef CONFIG_SPL_BUILD
 /*
- * fsl_setenv_chain_of_trust() must be called from
+ * fsl_env_set_chain_of_trust() must be called from
  * board_late_init()
  */
 
diff --git a/board/Arcturus/ucp1020/cmd_arc.c b/board/Arcturus/ucp1020/cmd_arc.c
index fa6b4853f9..c32f7df454 100644
--- a/board/Arcturus/ucp1020/cmd_arc.c
+++ b/board/Arcturus/ucp1020/cmd_arc.c
@@ -138,7 +138,7 @@ int get_arc_info(void)
 			printf("\t<not found>\n");
 		} else {
 			printf("\t%s\n", smac[3]);
-			setenv("SERIAL", smac[3]);
+			env_set("SERIAL", smac[3]);
 		}
 	}
 
@@ -152,7 +152,7 @@ int get_arc_info(void)
 		char *ret = getenv("ethaddr");
 
 		if (strcmp(ret, __stringify(CONFIG_ETHADDR)) == 0) {
-			setenv("ethaddr", smac[2]);
+			env_set("ethaddr", smac[2]);
 			printf("\t%s (factory)\n", smac[2]);
 		} else {
 			printf("\t%s\n", ret);
@@ -160,8 +160,8 @@ int get_arc_info(void)
 	}
 
 	if (strcmp(smac[1], "00:00:00:00:00:00") == 0) {
-		setenv("eth1addr", smac[2]);
-		setenv("eth2addr", smac[2]);
+		env_set("eth1addr", smac[2]);
+		env_set("eth2addr", smac[2]);
 		return 0;
 	}
 
@@ -172,7 +172,7 @@ int get_arc_info(void)
 		char *ret = getenv("eth1addr");
 
 		if (strcmp(ret, __stringify(CONFIG_ETH1ADDR)) == 0) {
-			setenv("eth1addr", smac[1]);
+			env_set("eth1addr", smac[1]);
 			printf("\t%s (factory)\n", smac[1]);
 		} else {
 			printf("\t%s\n", ret);
@@ -180,7 +180,7 @@ int get_arc_info(void)
 	}
 
 	if (strcmp(smac[0], "00:00:00:00:00:00") == 0) {
-		setenv("eth2addr", smac[1]);
+		env_set("eth2addr", smac[1]);
 		return 0;
 	}
 
@@ -191,7 +191,7 @@ int get_arc_info(void)
 		char *ret = getenv("eth2addr");
 
 		if (strcmp(ret, __stringify(CONFIG_ETH2ADDR)) == 0) {
-			setenv("eth2addr", smac[0]);
+			env_set("eth2addr", smac[0]);
 			printf("\t%s (factory)\n", smac[0]);
 		} else {
 			printf("\t%s\n", ret);
diff --git a/board/Arcturus/ucp1020/ucp1020.c b/board/Arcturus/ucp1020/ucp1020.c
index 0d086e87fa..2cc2e54d5b 100644
--- a/board/Arcturus/ucp1020/ucp1020.c
+++ b/board/Arcturus/ucp1020/ucp1020.c
@@ -230,9 +230,9 @@ int last_stage_init(void)
 				strcat(newkernelargs, mmckargs);
 				strcat(newkernelargs, " ");
 				strcat(newkernelargs, &tmp[n]);
-				setenv("kernelargs", newkernelargs);
+				env_set("kernelargs", newkernelargs);
 			} else {
-				setenv("kernelargs", mmckargs);
+				env_set("kernelargs", mmckargs);
 			}
 		}
 	get_arc_info();
@@ -244,7 +244,7 @@ int last_stage_init(void)
 			strcat(newkernelargs, sval);
 			strcat(newkernelargs, " ");
 			strcat(newkernelargs, kval);
-			setenv("kernelargs", newkernelargs);
+			env_set("kernelargs", newkernelargs);
 		}
 	} else {
 		printf("Error reading kernelargs env variable!\n");
diff --git a/board/BuR/brppt1/board.c b/board/BuR/brppt1/board.c
index a22722122b..6083479f2b 100644
--- a/board/BuR/brppt1/board.c
+++ b/board/BuR/brppt1/board.c
@@ -167,7 +167,7 @@ int board_late_init(void)
 		lcd_position_cursor(1, 8);
 		lcd_puts(
 		"switching to network-console ...       ");
-		setenv("bootcmd", "run netconsole");
+		env_set("bootcmd", "run netconsole");
 	}
 	return 0;
 }
diff --git a/board/BuR/brxre1/board.c b/board/BuR/brxre1/board.c
index f4bfa410cc..cdbc93a8ec 100644
--- a/board/BuR/brxre1/board.c
+++ b/board/BuR/brxre1/board.c
@@ -203,7 +203,7 @@ int board_late_init(void)
 				lcd_position_cursor(1, 8);
 				lcd_puts(
 				"switching to network-console ...       ");
-				setenv("bootcmd", "run netconsole");
+				env_set("bootcmd", "run netconsole");
 				cnt = 4;
 				break;
 			} else if (!gpio_get_value(ESC_KEY) &&
@@ -211,7 +211,7 @@ int board_late_init(void)
 				lcd_position_cursor(1, 8);
 				lcd_puts(
 				"starting u-boot script from USB ...    ");
-				setenv("bootcmd", "run usbscript");
+				env_set("bootcmd", "run usbscript");
 				cnt = 4;
 				break;
 			} else if ((!gpio_get_value(ESC_KEY) &&
@@ -221,7 +221,7 @@ int board_late_init(void)
 				lcd_position_cursor(1, 8);
 				lcd_puts(
 				"starting script from network ...      ");
-				setenv("bootcmd", "run netscript");
+				env_set("bootcmd", "run netscript");
 				cnt = 4;
 				break;
 			} else if (!gpio_get_value(ESC_KEY)) {
@@ -232,19 +232,19 @@ int board_late_init(void)
 		lcd_position_cursor(1, 8);
 		lcd_puts(
 		"starting vxworks from network ...      ");
-		setenv("bootcmd", "run netboot");
+		env_set("bootcmd", "run netboot");
 		cnt = 4;
 	} else if (scratchreg == 0xCD) {
 		lcd_position_cursor(1, 8);
 		lcd_puts(
 		"starting script from network ...      ");
-		setenv("bootcmd", "run netscript");
+		env_set("bootcmd", "run netscript");
 		cnt = 4;
 	} else if (scratchreg == 0xCE) {
 		lcd_position_cursor(1, 8);
 		lcd_puts(
 		"starting AR from eMMC ...             ");
-		setenv("bootcmd", "run mmcboot");
+		env_set("bootcmd", "run mmcboot");
 		cnt = 4;
 	}
 
@@ -252,7 +252,7 @@ int board_late_init(void)
 	switch (cnt) {
 	case 0:
 		lcd_puts("entering BOOT-mode.                    ");
-		setenv("bootcmd", "run defaultAR");
+		env_set("bootcmd", "run defaultAR");
 		buf = 0x0000;
 		break;
 	case 1:
@@ -285,7 +285,7 @@ int board_late_init(void)
 		 (u32)getenv_ulong("vx_memtop", 16, gd->fb_base-0x20),
 		 (u32)getenv_ulong("vx_romfsbase", 16, 0),
 		 (u32)getenv_ulong("vx_romfssize", 16, 0));
-	setenv("othbootargs", othbootargs);
+	env_set("othbootargs", othbootargs);
 	/*
 	 * reset VBAR registers to its reset location, VxWorks 6.9.3.2 does
 	 * expect that vectors are there, original u-boot moves them to _start
diff --git a/board/BuR/common/common.c b/board/BuR/common/common.c
index c3a56db76a..eb34de931e 100644
--- a/board/BuR/common/common.c
+++ b/board/BuR/common/common.c
@@ -184,7 +184,7 @@ int load_lcdtiming(struct am335x_lcdpanel *panel)
 		puts("no 'factory-settings / rotation' in dtb!\n");
 	}
 	snprintf(buf, sizeof(buf), "fbcon=rotate:%d", panel_info.vl_rot);
-	setenv("optargs_rot", buf);
+	env_set("optargs_rot", buf);
 #else
 	pnltmp.hactive = getenv_ulong("ds1_hactive", 10, ~0UL);
 	pnltmp.vactive = getenv_ulong("ds1_vactive", 10, ~0UL);
@@ -670,7 +670,7 @@ int board_eth_init(bd_t *bis)
 
 		if (mac) {
 			printf("using: %pM on ", mac);
-			eth_setenv_enetaddr("ethaddr", (const u8 *)mac);
+			eth_env_set_enetaddr("ethaddr", (const u8 *)mac);
 		}
 	}
 	writel(MII_MODE_ENABLE, &cdev->miisel);
diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c
index 86926f8050..a4d1725b13 100644
--- a/board/CZ.NIC/turris_omnia/turris_omnia.c
+++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
@@ -280,7 +280,7 @@ static int set_regdomain(void)
 		puts("EEPROM regdomain read failed.\n");
 
 	printf("Regdomain set to %s\n", rd);
-	return setenv("regdomain", rd);
+	return env_set("regdomain", rd);
 }
 #endif
 
@@ -510,17 +510,17 @@ int misc_init_r(void)
 	mac[5] = mac1[3];
 
 	if (is_valid_ethaddr(mac))
-		eth_setenv_enetaddr("ethaddr", mac);
+		eth_env_set_enetaddr("ethaddr", mac);
 
 	increment_mac(mac);
 
 	if (is_valid_ethaddr(mac))
-		eth_setenv_enetaddr("eth1addr", mac);
+		eth_env_set_enetaddr("eth1addr", mac);
 
 	increment_mac(mac);
 
 	if (is_valid_ethaddr(mac))
-		eth_setenv_enetaddr("eth2addr", mac);
+		eth_env_set_enetaddr("eth2addr", mac);
 
 out:
 #endif
diff --git a/board/LaCie/net2big_v2/net2big_v2.c b/board/LaCie/net2big_v2/net2big_v2.c
index 2e6e9ef916..416af469fa 100644
--- a/board/LaCie/net2big_v2/net2big_v2.c
+++ b/board/LaCie/net2big_v2/net2big_v2.c
@@ -224,7 +224,7 @@ int misc_init_r(void)
 	if (!getenv("ethaddr")) {
 		uchar mac[6];
 		if (lacie_read_mac_address(mac) == 0)
-			eth_setenv_enetaddr("ethaddr", mac);
+			eth_env_set_enetaddr("ethaddr", mac);
 	}
 #endif
 	init_leds();
diff --git a/board/LaCie/netspace_v2/netspace_v2.c b/board/LaCie/netspace_v2/netspace_v2.c
index 16d694716f..fa07288d6e 100644
--- a/board/LaCie/netspace_v2/netspace_v2.c
+++ b/board/LaCie/netspace_v2/netspace_v2.c
@@ -86,7 +86,7 @@ int misc_init_r(void)
 	if (!getenv("ethaddr")) {
 		uchar mac[6];
 		if (lacie_read_mac_address(mac) == 0)
-			eth_setenv_enetaddr("ethaddr", mac);
+			eth_env_set_enetaddr("ethaddr", mac);
 	}
 #endif
 	return 0;
diff --git a/board/Synology/ds414/cmd_syno.c b/board/Synology/ds414/cmd_syno.c
index 20544e29c4..6313882a52 100644
--- a/board/Synology/ds414/cmd_syno.c
+++ b/board/Synology/ds414/cmd_syno.c
@@ -81,7 +81,7 @@ static int do_syno_populate(int argc, char * const argv[])
 		         ethaddr[0], ethaddr[1], ethaddr[2],
 			 ethaddr[3], ethaddr[4], ethaddr[5]);
 		printf("parsed %s = %s\n", var, val);
-		setenv(var, val);
+		env_set(var, val);
 	}
 	if (!strncmp(buf + 32, SYNO_SN_TAG, strlen(SYNO_SN_TAG))) {
 		char *snp, *csump;
@@ -111,7 +111,7 @@ static int do_syno_populate(int argc, char * const argv[])
 			goto out_unmap;
 		}
 		printf("parsed SN = %s\n", snp);
-		setenv("SN", snp);
+		env_set("SN", snp);
 	} else {	/* old style format */
 		unsigned char csum = 0;
 
@@ -125,7 +125,7 @@ static int do_syno_populate(int argc, char * const argv[])
 		}
 		bufp[n] = '\0';
 		printf("parsed SN = %s\n", buf + 32);
-		setenv("SN", buf + 32);
+		env_set("SN", buf + 32);
 	}
 out_unmap:
 	unmap_physmem(buf, len);
diff --git a/board/amazon/kc1/kc1.c b/board/amazon/kc1/kc1.c
index 13a9c6a0fe..2d8be1804a 100644
--- a/board/amazon/kc1/kc1.c
+++ b/board/amazon/kc1/kc1.c
@@ -119,7 +119,7 @@ int misc_init_r(void)
 
 	if (reboot_mode[0] > 0 && isascii(reboot_mode[0])) {
 		if (!getenv("reboot-mode"))
-			setenv("reboot-mode", (char *)reboot_mode);
+			env_set("reboot-mode", (char *)reboot_mode);
 	}
 
 	omap_reboot_mode_clear();
diff --git a/board/amlogic/odroid-c2/odroid-c2.c b/board/amlogic/odroid-c2/odroid-c2.c
index b29f56d5eb..ca9c13bcc1 100644
--- a/board/amlogic/odroid-c2/odroid-c2.c
+++ b/board/amlogic/odroid-c2/odroid-c2.c
@@ -48,14 +48,14 @@ int misc_init_r(void)
 		len = meson_sm_read_efuse(EFUSE_MAC_OFFSET,
 					  mac_addr, EFUSE_MAC_SIZE);
 		if (len == EFUSE_MAC_SIZE && is_valid_ethaddr(mac_addr))
-			eth_setenv_enetaddr("ethaddr", mac_addr);
+			eth_env_set_enetaddr("ethaddr", mac_addr);
 	}
 
 	if (!getenv("serial#")) {
 		len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial,
 			EFUSE_SN_SIZE);
 		if (len == EFUSE_SN_SIZE) 
-			setenv("serial#", serial);
+			env_set("serial#", serial);
 	}
 
 	return 0;
diff --git a/board/aries/ma5d4evk/ma5d4evk.c b/board/aries/ma5d4evk/ma5d4evk.c
index b9294fc881..956c297e72 100644
--- a/board/aries/ma5d4evk/ma5d4evk.c
+++ b/board/aries/ma5d4evk/ma5d4evk.c
@@ -325,7 +325,7 @@ int board_init(void)
 
 int board_late_init(void)
 {
-	setenv("bootmode", boot_mode_sf ? "sf" : "emmc");
+	env_set("bootmode", boot_mode_sf ? "sf" : "emmc");
 	return 0;
 }
 
diff --git a/board/aristainetos/aristainetos-v2.c b/board/aristainetos/aristainetos-v2.c
index 6abc2159bb..bdf41b99c8 100644
--- a/board/aristainetos/aristainetos-v2.c
+++ b/board/aristainetos/aristainetos-v2.c
@@ -670,9 +670,9 @@ int board_late_init(void)
 	if (bootmode == 7) {
 		my_bootdelay = getenv("nor_bootdelay");
 		if (my_bootdelay != NULL)
-			setenv("bootdelay", my_bootdelay);
+			env_set("bootdelay", my_bootdelay);
 		else
-			setenv("bootdelay", "-2");
+			env_set("bootdelay", "-2");
 	}
 
 	/* if we have the lg panel, we can initialze it now */
diff --git a/board/armltd/integrator/integrator.c b/board/armltd/integrator/integrator.c
index c3bafd453e..858f74e5cf 100644
--- a/board/armltd/integrator/integrator.c
+++ b/board/armltd/integrator/integrator.c
@@ -116,7 +116,7 @@ extern void cm_remap(void);
 
 int misc_init_r (void)
 {
-	setenv("verify", "n");
+	env_set("verify", "n");
 	return (0);
 }
 
diff --git a/board/atmel/sama5d2_xplained/sama5d2_xplained.c b/board/atmel/sama5d2_xplained/sama5d2_xplained.c
index 48f45b35ce..4a06cda6f4 100644
--- a/board/atmel/sama5d2_xplained/sama5d2_xplained.c
+++ b/board/atmel/sama5d2_xplained/sama5d2_xplained.c
@@ -192,7 +192,7 @@ static int set_ethaddr_from_eeprom(void)
 		return -1;
 	}
 
-	return eth_setenv_enetaddr(ETHADDR_NAME, ethaddr);
+	return eth_env_set_enetaddr(ETHADDR_NAME, ethaddr);
 }
 #else
 static int set_ethaddr_from_eeprom(void)
diff --git a/board/atmel/sama5d3xek/sama5d3xek.c b/board/atmel/sama5d3xek/sama5d3xek.c
index c1f2769f1c..88bcd876c9 100644
--- a/board/atmel/sama5d3xek/sama5d3xek.c
+++ b/board/atmel/sama5d3xek/sama5d3xek.c
@@ -267,7 +267,7 @@ int board_late_init(void)
 		*p = tolower(*p);
 
 	strcat(name, "ek.dtb");
-	setenv("dtb_name", name);
+	env_set("dtb_name", name);
 #endif
 	return 0;
 }
diff --git a/board/bachmann/ot1200/ot1200.c b/board/bachmann/ot1200/ot1200.c
index 1ad4ef93cf..df10d6a0d0 100644
--- a/board/bachmann/ot1200/ot1200.c
+++ b/board/bachmann/ot1200/ot1200.c
@@ -312,9 +312,9 @@ int board_eth_init(bd_t *bis)
 
 	/* depending on the phy address we can detect our board version */
 	if (phydev->addr == 0)
-		setenv("boardver", "");
+		env_set("boardver", "");
 	else
-		setenv("boardver", "mr");
+		env_set("boardver", "mr");
 
 	printf("using phy at %d\n", phydev->addr);
 	ret = fec_probe(bis, -1, base, bus, phydev);
diff --git a/board/birdland/bav335x/board.c b/board/birdland/bav335x/board.c
index b49365e157..a9d9ce6fa5 100644
--- a/board/birdland/bav335x/board.c
+++ b/board/birdland/bav335x/board.c
@@ -301,8 +301,8 @@ int board_init(void)
 int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-	setenv("board_name", "BAV335xB");
-	setenv("board_rev", "B"); /* Fix me, but why bother.. */
+	env_set("board_name", "BAV335xB");
+	env_set("board_rev", "B"); /* Fix me, but why bother.. */
 #endif
 	return 0;
 }
@@ -396,7 +396,7 @@ int board_eth_init(bd_t *bis)
 		printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
 		if (is_valid_ethaddr(mac_addr))
-			eth_setenv_enetaddr("ethaddr", mac_addr);
+			eth_env_set_enetaddr("ethaddr", mac_addr);
 	}
 
 #ifdef CONFIG_DRIVER_TI_CPSW
diff --git a/board/bosch/shc/board.c b/board/bosch/shc/board.c
index 38577f30f1..b4c6a0b45d 100644
--- a/board/bosch/shc/board.c
+++ b/board/bosch/shc/board.c
@@ -251,7 +251,7 @@ static void check_button_status(void)
 
 	if (value == 0) {
 		printf("front button activated !\n");
-		setenv("harakiri", "1");
+		env_set("harakiri", "1");
 	}
 }
 
@@ -460,7 +460,7 @@ int board_late_init(void)
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 	if (shc_eeprom_valid)
 		if (is_valid_ethaddr(header.mac_addr))
-			eth_setenv_enetaddr("ethaddr", header.mac_addr);
+			eth_env_set_enetaddr("ethaddr", header.mac_addr);
 #endif
 
 	return 0;
@@ -549,7 +549,7 @@ int board_eth_init(bd_t *bis)
 		printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
 		if (is_valid_ethaddr(mac_addr))
-			eth_setenv_enetaddr("ethaddr", mac_addr);
+			eth_env_set_enetaddr("ethaddr", mac_addr);
 	}
 
 	writel(MII_MODE_ENABLE, &cdev->miisel);
@@ -565,7 +565,7 @@ int board_eth_init(bd_t *bis)
 #if defined(CONFIG_USB_ETHER) && \
 	(!defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_USBETH_SUPPORT))
 	if (is_valid_ethaddr(mac_addr))
-		eth_setenv_enetaddr("usbnet_devaddr", mac_addr);
+		eth_env_set_enetaddr("usbnet_devaddr", mac_addr);
 
 	rv = usb_eth_initialize(bis);
 	if (rv < 0)
diff --git a/board/boundary/nitrogen6x/nitrogen6x.c b/board/boundary/nitrogen6x/nitrogen6x.c
index 17fd6f56ea..0e2c4fc0ef 100644
--- a/board/boundary/nitrogen6x/nitrogen6x.c
+++ b/board/boundary/nitrogen6x/nitrogen6x.c
@@ -954,7 +954,7 @@ static int do_kbd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	char envvalue[ARRAY_SIZE(buttons)+1];
 	int numpressed = read_keys(envvalue);
-	setenv("keybd", envvalue);
+	env_set("keybd", envvalue);
 	return numpressed == 0;
 }
 
@@ -995,7 +995,7 @@ static void preboot_keys(void)
 			sprintf(cmd_name, "%s%c", kbd_command_prefix, *suffix);
 			cmd = getenv(cmd_name);
 			if (cmd) {
-				setenv("preboot", cmd);
+				env_set("preboot", cmd);
 				return;
 			}
 		}
@@ -1021,6 +1021,6 @@ int misc_init_r(void)
 #ifdef CONFIG_CMD_BMODE
 	add_board_boot_modes(board_boot_modes);
 #endif
-	setenv_hex("reset_cause", get_imx_reset_cause());
+	env_set_hex("reset_cause", get_imx_reset_cause());
 	return 0;
 }
diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c
index 0f3734587a..5b31e056ba 100644
--- a/board/buffalo/lsxl/lsxl.c
+++ b/board/buffalo/lsxl/lsxl.c
@@ -228,7 +228,7 @@ static void erase_environment(void)
 static void rescue_mode(void)
 {
 	printf("Entering rescue mode..\n");
-	setenv("bootsource", "rescue");
+	env_set("bootsource", "rescue");
 }
 
 static void check_push_button(void)
diff --git a/board/cadence/xtfpga/xtfpga.c b/board/cadence/xtfpga/xtfpga.c
index 0265e9bb36..83244c3ad4 100644
--- a/board/cadence/xtfpga/xtfpga.c
+++ b/board/cadence/xtfpga/xtfpga.c
@@ -93,7 +93,7 @@ int misc_init_r(void)
 		x = (*(volatile u32 *)CONFIG_SYS_FPGAREG_DIPSW)
 			& FPGAREG_MAC_MASK;
 		sprintf(&s[15], "%02x", x);
-		setenv("ethaddr", s);
+		env_set("ethaddr", s);
 	}
 #endif /* CONFIG_CMD_NET */
 
diff --git a/board/ccv/xpress/xpress.c b/board/ccv/xpress/xpress.c
index 542e534270..b65646588a 100644
--- a/board/ccv/xpress/xpress.c
+++ b/board/ccv/xpress/xpress.c
@@ -318,7 +318,7 @@ static const struct boot_mode board_boot_modes[] = {
 int board_late_init(void)
 {
 	add_board_boot_modes(board_boot_modes);
-	setenv("board_name", "xpress");
+	env_set("board_name", "xpress");
 
 	return 0;
 }
diff --git a/board/compulab/cl-som-am57x/eth.c b/board/compulab/cl-som-am57x/eth.c
index 0c4bf91c13..d2992d3a63 100644
--- a/board/compulab/cl-som-am57x/eth.c
+++ b/board/compulab/cl-som-am57x/eth.c
@@ -107,7 +107,7 @@ static int cl_som_am57x_handle_mac_address(char *env_name, uint port_num)
 	if (!is_valid_ethaddr(enetaddr))
 		return -1;
 
-	ret = eth_setenv_enetaddr(env_name, enetaddr);
+	ret = eth_env_set_enetaddr(env_name, enetaddr);
 	if (ret)
 		printf("cl-som-am57x: Failed to set Eth port %d MAC address\n",
 		       port_num);
diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c
index c59884a8c3..2368226546 100644
--- a/board/compulab/cm_fx6/cm_fx6.c
+++ b/board/compulab/cm_fx6/cm_fx6.c
@@ -481,7 +481,7 @@ static int handle_mac_address(char *env_var, uint eeprom_bus)
 	if (!is_valid_ethaddr(enetaddr))
 		return -1;
 
-	return eth_setenv_enetaddr(env_var, enetaddr);
+	return eth_env_set_enetaddr(env_var, enetaddr);
 }
 
 #define SB_FX6_I2C_EEPROM_BUS	0
diff --git a/board/compulab/cm_t335/cm_t335.c b/board/compulab/cm_t335/cm_t335.c
index c4506b910e..f6030ddf29 100644
--- a/board/compulab/cm_t335/cm_t335.c
+++ b/board/compulab/cm_t335/cm_t335.c
@@ -117,7 +117,7 @@ static int handle_mac_address(void)
 	if (!is_valid_ethaddr(enetaddr))
 		return -1;
 
-	return eth_setenv_enetaddr("ethaddr", enetaddr);
+	return eth_env_set_enetaddr("ethaddr", enetaddr);
 }
 
 #define AR8051_PHY_DEBUG_ADDR_REG	0x1d
diff --git a/board/compulab/cm_t35/cm_t35.c b/board/compulab/cm_t35/cm_t35.c
index f1691257e7..a8696aea83 100644
--- a/board/compulab/cm_t35/cm_t35.c
+++ b/board/compulab/cm_t35/cm_t35.c
@@ -445,7 +445,7 @@ static int handle_mac_address(void)
 	if (!is_valid_ethaddr(enetaddr))
 		return -1;
 
-	return eth_setenv_enetaddr("ethaddr", enetaddr);
+	return eth_env_set_enetaddr("ethaddr", enetaddr);
 }
 
 /*
diff --git a/board/compulab/cm_t3517/cm_t3517.c b/board/compulab/cm_t3517/cm_t3517.c
index 38eb641bc4..0568234f66 100644
--- a/board/compulab/cm_t3517/cm_t3517.c
+++ b/board/compulab/cm_t3517/cm_t3517.c
@@ -182,7 +182,7 @@ static int cm_t3517_handle_mac_address(void)
 	if (!is_valid_ethaddr(enetaddr))
 		return -1;
 
-	return eth_setenv_enetaddr("ethaddr", enetaddr);
+	return eth_env_set_enetaddr("ethaddr", enetaddr);
 }
 
 #define SB_T35_ETH_RST_GPIO 164
diff --git a/board/compulab/cm_t54/cm_t54.c b/board/compulab/cm_t54/cm_t54.c
index 6437718415..582512dbe4 100644
--- a/board/compulab/cm_t54/cm_t54.c
+++ b/board/compulab/cm_t54/cm_t54.c
@@ -172,7 +172,7 @@ static int handle_mac_address(void)
 	if (!is_valid_ethaddr(enetaddr))
 		return -1;
 
-	return eth_setenv_enetaddr("usbethaddr", enetaddr);
+	return eth_env_set_enetaddr("usbethaddr", enetaddr);
 }
 
 int board_eth_init(bd_t *bis)
diff --git a/board/congatec/cgtqmx6eval/cgtqmx6eval.c b/board/congatec/cgtqmx6eval/cgtqmx6eval.c
index 5cb97b4778..ac66248b3f 100644
--- a/board/congatec/cgtqmx6eval/cgtqmx6eval.c
+++ b/board/congatec/cgtqmx6eval/cgtqmx6eval.c
@@ -755,9 +755,9 @@ int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 	if (is_mx6dq())
-		setenv("board_rev", "MX6Q");
+		env_set("board_rev", "MX6Q");
 	else
-		setenv("board_rev", "MX6DL");
+		env_set("board_rev", "MX6DL");
 #endif
 
 	return 0;
diff --git a/board/cssi/MCR3000/MCR3000.c b/board/cssi/MCR3000/MCR3000.c
index 43c4cb77bb..c928881804 100644
--- a/board/cssi/MCR3000/MCR3000.c
+++ b/board/cssi/MCR3000/MCR3000.c
@@ -123,7 +123,7 @@ int misc_init_r(void)
 
 	/* if BTN_ACQ_AL is pressed then bootdelay is changed to 60 second */
 	if ((in_be16(&iop->iop_pcdat) & 0x0004) == 0)
-		setenv("bootdelay", "60");
+		env_set("bootdelay", "60");
 
 	return 0;
 }
diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index 11ea52f240..8cab357a92 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -147,7 +147,7 @@ int misc_init_r(void)
 	if (!enetaddr_found) {
 		if (!spi_mac_read) {
 			if (is_valid_ethaddr(buff)) {
-				if (eth_setenv_enetaddr("ethaddr", buff)) {
+				if (eth_env_set_enetaddr("ethaddr", buff)) {
 					printf("Warning: Failed to "
 					"set MAC address from SPI flash\n");
 				}
diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c b/board/davinci/da8xxevm/omapl138_lcdk.c
index 52bb7363a7..29296b0478 100644
--- a/board/davinci/da8xxevm/omapl138_lcdk.c
+++ b/board/davinci/da8xxevm/omapl138_lcdk.c
@@ -337,7 +337,7 @@ int misc_init_r(void)
 				addr[0], addr[1], addr[2], addr[3], addr[4],
 				addr[5]);
 
-			setenv("ethaddr", (char *)tmp);
+			env_set("ethaddr", (char *)tmp);
 		} else {
 			printf("Invalid MAC address read.\n");
 		}
diff --git a/board/el/el6x/el6x.c b/board/el/el6x/el6x.c
index cbe355a600..6b98b5c3eb 100644
--- a/board/el/el6x/el6x.c
+++ b/board/el/el6x/el6x.c
@@ -466,7 +466,7 @@ int board_late_init(void)
 	add_board_boot_modes(board_boot_modes);
 #endif
 
-	setenv("board_name", BOARD_NAME);
+	env_set("board_name", BOARD_NAME);
 	return 0;
 }
 
diff --git a/board/engicam/common/board.c b/board/engicam/common/board.c
index e3bb5698f6..c4a3a0f290 100644
--- a/board/engicam/common/board.c
+++ b/board/engicam/common/board.c
@@ -21,11 +21,11 @@ static void mmc_late_init(void)
 	char mmcblk[32];
 	u32 dev_no = mmc_get_env_dev();
 
-	setenv_ulong("mmcdev", dev_no);
+	env_set_ulong("mmcdev", dev_no);
 
 	/* Set mmcblk env */
 	sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw", dev_no);
-	setenv("mmcroot", mmcblk);
+	env_set("mmcroot", mmcblk);
 
 	sprintf(cmd, "mmc dev %d", dev_no);
 	run_command(cmd, 0);
@@ -43,22 +43,22 @@ int board_late_init(void)
 #ifdef CONFIG_ENV_IS_IN_MMC
 		mmc_late_init();
 #endif
-		setenv("modeboot", "mmcboot");
+		env_set("modeboot", "mmcboot");
 		break;
 	case IMX6_BMODE_NAND:
-		setenv("modeboot", "nandboot");
+		env_set("modeboot", "nandboot");
 		break;
 	default:
-		setenv("modeboot", "");
+		env_set("modeboot", "");
 		break;
 	}
 
 	if (is_mx6ul())
-		setenv("console", "ttymxc0");
+		env_set("console", "ttymxc0");
 	else
-		setenv("console", "ttymxc3");
+		env_set("console", "ttymxc3");
 
-	setenv_fdt_file();
+	env_set_fdt_file();
 
 	return 0;
 }
diff --git a/board/engicam/common/board.h b/board/engicam/common/board.h
index f364a23296..434926c36c 100644
--- a/board/engicam/common/board.h
+++ b/board/engicam/common/board.h
@@ -6,7 +6,7 @@
 
 #ifndef _BOARD_H_
 #define _BOARD_H_
-void setenv_fdt_file(void);
+void env_set_fdt_file(void);
 void setup_gpmi_nand(void);
 void setup_display(void);
 #endif /* _BOARD_H_ */
diff --git a/board/engicam/geam6ul/geam6ul.c b/board/engicam/geam6ul/geam6ul.c
index bc36fc77ee..fd7e25f0e5 100644
--- a/board/engicam/geam6ul/geam6ul.c
+++ b/board/engicam/geam6ul/geam6ul.c
@@ -90,10 +90,10 @@ void setup_gpmi_nand(void)
 }
 #endif /* CONFIG_NAND_MXS */
 
-void setenv_fdt_file(void)
+void env_set_fdt_file(void)
 {
 	if (is_mx6ul())
-		setenv("fdt_file", "imx6ul-geam-kit.dtb");
+		env_set("fdt_file", "imx6ul-geam-kit.dtb");
 }
 
 #ifdef CONFIG_SPL_BUILD
diff --git a/board/engicam/icorem6/icorem6.c b/board/engicam/icorem6/icorem6.c
index 5b2ed066b4..6dfd64e851 100644
--- a/board/engicam/icorem6/icorem6.c
+++ b/board/engicam/icorem6/icorem6.c
@@ -192,12 +192,12 @@ void setup_display(void)
 }
 #endif /* CONFIG_VIDEO_IPUV3 */
 
-void setenv_fdt_file(void)
+void env_set_fdt_file(void)
 {
 	if (is_mx6dq())
-		setenv("fdt_file", "imx6q-icore.dtb");
+		env_set("fdt_file", "imx6q-icore.dtb");
 	else if(is_mx6dl() || is_mx6solo())
-		setenv("fdt_file", "imx6dl-icore.dtb");
+		env_set("fdt_file", "imx6dl-icore.dtb");
 }
 
 #ifdef CONFIG_SPL_BUILD
diff --git a/board/engicam/icorem6_rqs/icorem6_rqs.c b/board/engicam/icorem6_rqs/icorem6_rqs.c
index 10a9471730..a5741adb31 100644
--- a/board/engicam/icorem6_rqs/icorem6_rqs.c
+++ b/board/engicam/icorem6_rqs/icorem6_rqs.c
@@ -32,12 +32,12 @@ int board_mmc_get_env_dev(int devno)
 }
 #endif
 
-void setenv_fdt_file(void)
+void env_set_fdt_file(void)
 {
 	if (is_mx6dq())
-		setenv("fdt_file", "imx6q-icore-rqs.dtb");
+		env_set("fdt_file", "imx6q-icore-rqs.dtb");
 	else if(is_mx6dl() || is_mx6solo())
-		setenv("fdt_file", "imx6dl-icore-rqs.dtb");
+		env_set("fdt_file", "imx6dl-icore-rqs.dtb");
 }
 
 #ifdef CONFIG_SPL_BUILD
diff --git a/board/engicam/isiotmx6ul/isiotmx6ul.c b/board/engicam/isiotmx6ul/isiotmx6ul.c
index 4dcc9ea11b..d6daa3e3c5 100644
--- a/board/engicam/isiotmx6ul/isiotmx6ul.c
+++ b/board/engicam/isiotmx6ul/isiotmx6ul.c
@@ -98,13 +98,13 @@ int board_mmc_get_env_dev(int devno)
 }
 #endif
 
-void setenv_fdt_file(void)
+void env_set_fdt_file(void)
 {
 	if (is_mx6ul()) {
 #ifdef CONFIG_ENV_IS_IN_MMC
-		setenv("fdt_file", "imx6ul-isiot-emmc.dtb");
+		env_set("fdt_file", "imx6ul-isiot-emmc.dtb");
 #else
-		setenv("fdt_file", "imx6ul-isiot-nand.dtb");
+		env_set("fdt_file", "imx6ul-isiot-nand.dtb");
 #endif
 	}
 }
diff --git a/board/freescale/common/cmd_esbc_validate.c b/board/freescale/common/cmd_esbc_validate.c
index cefe3cc531..b3e5f019b8 100644
--- a/board/freescale/common/cmd_esbc_validate.c
+++ b/board/freescale/common/cmd_esbc_validate.c
@@ -52,7 +52,7 @@ static int do_esbc_validate(cmd_tbl_t *cmdtp, int flag, int argc,
 	 * to continue U-Boot
 	 */
 	sprintf(buf, "%lx", img_addr);
-	setenv("img_addr", buf);
+	env_set("img_addr", buf);
 
 	if (ret)
 		return 1;
diff --git a/board/freescale/common/fsl_chain_of_trust.c b/board/freescale/common/fsl_chain_of_trust.c
index 2cd4fba13f..a9ba9beef5 100644
--- a/board/freescale/common/fsl_chain_of_trust.c
+++ b/board/freescale/common/fsl_chain_of_trust.c
@@ -68,7 +68,7 @@ int fsl_check_boot_mode_secure(void)
 }
 
 #ifndef CONFIG_SPL_BUILD
-int fsl_setenv_chain_of_trust(void)
+int fsl_env_set_chain_of_trust(void)
 {
 	/* Check Boot Mode
 	 * If Boot Mode is Non-Secure, no changes are required
@@ -80,8 +80,8 @@ int fsl_setenv_chain_of_trust(void)
 	 * bootdelay = 0 (To disable Boot Prompt)
 	 * bootcmd = CONFIG_CHAIN_BOOT_CMD (Validate and execute Boot script)
 	 */
-	setenv("bootdelay", "0");
-	setenv("bootcmd", CONFIG_CHAIN_BOOT_CMD);
+	env_set("bootdelay", "0");
+	env_set("bootcmd", CONFIG_CHAIN_BOOT_CMD);
 	return 0;
 }
 #endif
diff --git a/board/freescale/common/sys_eeprom.c b/board/freescale/common/sys_eeprom.c
index 29aa778dbe..c593cff5e7 100644
--- a/board/freescale/common/sys_eeprom.c
+++ b/board/freescale/common/sys_eeprom.c
@@ -479,7 +479,7 @@ int mac_read_from_eeprom(void)
 			 * (i.e. have not yet been set)
 			 */
 			if (!getenv(enetvar))
-				setenv(enetvar, ethaddr);
+				env_set(enetvar, ethaddr);
 		}
 	}
 
diff --git a/board/freescale/ls1021aqds/ls1021aqds.c b/board/freescale/ls1021aqds/ls1021aqds.c
index d81d8abc9b..66c28fd333 100644
--- a/board/freescale/ls1021aqds/ls1021aqds.c
+++ b/board/freescale/ls1021aqds/ls1021aqds.c
@@ -368,7 +368,7 @@ int board_late_init(void)
 	ls1021a_sata_init();
 #endif
 #ifdef CONFIG_CHAIN_OF_TRUST
-	fsl_setenv_chain_of_trust();
+	fsl_env_set_chain_of_trust();
 #endif
 
 	return 0;
diff --git a/board/freescale/ls1021atwr/ls1021atwr.c b/board/freescale/ls1021atwr/ls1021atwr.c
index ff32d5cb28..c56769afbf 100644
--- a/board/freescale/ls1021atwr/ls1021atwr.c
+++ b/board/freescale/ls1021atwr/ls1021atwr.c
@@ -523,7 +523,7 @@ int board_late_init(void)
 	ls1021a_sata_init();
 #endif
 #ifdef CONFIG_CHAIN_OF_TRUST
-	fsl_setenv_chain_of_trust();
+	fsl_env_set_chain_of_trust();
 #endif
 
 	return 0;
diff --git a/board/freescale/mpc8323erdb/mpc8323erdb.c b/board/freescale/mpc8323erdb/mpc8323erdb.c
index f30a1510ee..b715d8363e 100644
--- a/board/freescale/mpc8323erdb/mpc8323erdb.c
+++ b/board/freescale/mpc8323erdb/mpc8323erdb.c
@@ -216,7 +216,7 @@ int mac_read_from_eeprom(void)
 						buf[i * 6 + 4], buf[i * 6 + 5]);
 					sprintf((char *)enetvar,
 						i ? "eth%daddr" : "ethaddr", i);
-					setenv((char *)enetvar, str);
+					env_set((char *)enetvar, str);
 				}
 			}
 		}
diff --git a/board/freescale/mx53loco/mx53loco.c b/board/freescale/mx53loco/mx53loco.c
index 27d606f310..ea36603686 100644
--- a/board/freescale/mx53loco/mx53loco.c
+++ b/board/freescale/mx53loco/mx53loco.c
@@ -246,7 +246,7 @@ static int power_init(void)
 		if (!p)
 			return -ENODEV;
 
-		setenv("fdt_file", "imx53-qsb.dtb");
+		env_set("fdt_file", "imx53-qsb.dtb");
 
 		/* Set VDDA to 1.25V */
 		val = DA9052_BUCKCORE_BCOREEN | DA_BUCKCORE_VBCORE_1_250V;
@@ -289,7 +289,7 @@ static int power_init(void)
 		if (!p)
 			return -ENODEV;
 
-		setenv("fdt_file", "imx53-qsrb.dtb");
+		env_set("fdt_file", "imx53-qsrb.dtb");
 
 		/* Set VDDGP to 1.25V for 1GHz on SW1 */
 		pmic_reg_read(p, REG_SW_0, &val);
diff --git a/board/freescale/mx6sabreauto/mx6sabreauto.c b/board/freescale/mx6sabreauto/mx6sabreauto.c
index a5703a35b1..ea78091744 100644
--- a/board/freescale/mx6sabreauto/mx6sabreauto.c
+++ b/board/freescale/mx6sabreauto/mx6sabreauto.c
@@ -687,14 +687,14 @@ int board_late_init(void)
 #endif
 
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-	setenv("board_name", "SABREAUTO");
+	env_set("board_name", "SABREAUTO");
 
 	if (is_mx6dqp())
-		setenv("board_rev", "MX6QP");
+		env_set("board_rev", "MX6QP");
 	else if (is_mx6dq())
-		setenv("board_rev", "MX6Q");
+		env_set("board_rev", "MX6Q");
 	else if (is_mx6sdl())
-		setenv("board_rev", "MX6DL");
+		env_set("board_rev", "MX6DL");
 #endif
 
 	return 0;
diff --git a/board/freescale/mx6sabresd/mx6sabresd.c b/board/freescale/mx6sabresd/mx6sabresd.c
index e4160420fa..19aa6f44d0 100644
--- a/board/freescale/mx6sabresd/mx6sabresd.c
+++ b/board/freescale/mx6sabresd/mx6sabresd.c
@@ -700,14 +700,14 @@ int board_late_init(void)
 #endif
 
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-	setenv("board_name", "SABRESD");
+	env_set("board_name", "SABRESD");
 
 	if (is_mx6dqp())
-		setenv("board_rev", "MX6QP");
+		env_set("board_rev", "MX6QP");
 	else if (is_mx6dq())
-		setenv("board_rev", "MX6Q");
+		env_set("board_rev", "MX6Q");
 	else if (is_mx6sdl())
-		setenv("board_rev", "MX6DL");
+		env_set("board_rev", "MX6DL");
 #endif
 
 	return 0;
diff --git a/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c b/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
index a30c379e4d..cf7a069c56 100644
--- a/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
+++ b/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
@@ -674,12 +674,12 @@ int board_late_init(void)
 #endif
 
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-	setenv("board_name", "EVK");
+	env_set("board_name", "EVK");
 
 	if (is_mx6ul_9x9_evk())
-		setenv("board_rev", "9X9");
+		env_set("board_rev", "9X9");
 	else
-		setenv("board_rev", "14X14");
+		env_set("board_rev", "14X14");
 #endif
 
 	return 0;
diff --git a/board/freescale/mx6ullevk/mx6ullevk.c b/board/freescale/mx6ullevk/mx6ullevk.c
index 66b08f823e..cebcec738f 100644
--- a/board/freescale/mx6ullevk/mx6ullevk.c
+++ b/board/freescale/mx6ullevk/mx6ullevk.c
@@ -84,8 +84,8 @@ int board_late_init(void)
 #endif
 
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-	setenv("board_name", "EVK");
-	setenv("board_rev", "14X14");
+	env_set("board_name", "EVK");
+	env_set("board_rev", "14X14");
 #endif
 
 	return 0;
diff --git a/board/freescale/qemu-ppce500/qemu-ppce500.c b/board/freescale/qemu-ppce500/qemu-ppce500.c
index 6cb5692eda..d40e62af4f 100644
--- a/board/freescale/qemu-ppce500/qemu-ppce500.c
+++ b/board/freescale/qemu-ppce500/qemu-ppce500.c
@@ -205,10 +205,10 @@ int last_stage_init(void)
 	/* -kernel boot */
 	prop = fdt_getprop(fdt, chosen, "qemu,boot-kernel", &len);
 	if (prop && (len >= 8))
-		setenv_hex("qemu_kernel_addr", *prop);
+		env_set_hex("qemu_kernel_addr", *prop);
 
 	/* Give the user a variable for the host fdt */
-	setenv_hex("fdt_addr_r", (ulong)fdt);
+	env_set_hex("fdt_addr_r", (ulong)fdt);
 
 	return 0;
 }
diff --git a/board/gateworks/gw_ventana/gw_ventana.c b/board/gateworks/gw_ventana/gw_ventana.c
index 89848c8f07..61298ab2fd 100644
--- a/board/gateworks/gw_ventana/gw_ventana.c
+++ b/board/gateworks/gw_ventana/gw_ventana.c
@@ -301,7 +301,7 @@ int board_eth_init(bd_t *bis)
 	if (!getenv("ethprime")) {
 		struct eth_device *dev = eth_get_dev_by_index(0);
 		if (dev) {
-			setenv("ethprime", dev->name);
+			env_set("ethprime", dev->name);
 			printf("set ethprime to %s\n", getenv("ethprime"));
 		}
 	}
@@ -662,7 +662,7 @@ int checkboard(void)
 	if (p)
 		quiet = simple_strtol(p, NULL, 10);
 	else
-		setenv("quiet", "0");
+		env_set("quiet", "0");
 
 	puts("\nGateworks Corporation Copyright 2014\n");
 	if (info->model[0]) {
@@ -737,26 +737,26 @@ int misc_init_r(void)
 		else if (is_cpu_type(MXC_CPU_MX6DL) ||
 			 is_cpu_type(MXC_CPU_MX6SOLO))
 			cputype = "imx6dl";
-		setenv("soctype", cputype);
+		env_set("soctype", cputype);
 		if (8 << (ventana_info.nand_flash_size-1) >= 2048)
-			setenv("flash_layout", "large");
+			env_set("flash_layout", "large");
 		else
-			setenv("flash_layout", "normal");
+			env_set("flash_layout", "normal");
 		memset(str, 0, sizeof(str));
 		for (i = 0; i < (sizeof(str)-1) && info->model[i]; i++)
 			str[i] = tolower(info->model[i]);
-		setenv("model", str);
+		env_set("model", str);
 		if (!getenv("fdt_file")) {
 			sprintf(fdt, "%s-%s.dtb", cputype, str);
-			setenv("fdt_file", fdt);
+			env_set("fdt_file", fdt);
 		}
 		p = strchr(str, '-');
 		if (p) {
 			*p++ = 0;
 
-			setenv("model_base", str);
+			env_set("model_base", str);
 			sprintf(fdt, "%s-%s.dtb", cputype, str);
-			setenv("fdt_file1", fdt);
+			env_set("fdt_file1", fdt);
 			if (board_type != GW551x &&
 			    board_type != GW552x &&
 			    board_type != GW553x &&
@@ -765,26 +765,26 @@ int misc_init_r(void)
 			str[5] = 'x';
 			str[6] = 0;
 			sprintf(fdt, "%s-%s.dtb", cputype, str);
-			setenv("fdt_file2", fdt);
+			env_set("fdt_file2", fdt);
 		}
 
 		/* initialize env from EEPROM */
 		if (test_bit(EECONFIG_ETH0, info->config) &&
 		    !getenv("ethaddr")) {
-			eth_setenv_enetaddr("ethaddr", info->mac0);
+			eth_env_set_enetaddr("ethaddr", info->mac0);
 		}
 		if (test_bit(EECONFIG_ETH1, info->config) &&
 		    !getenv("eth1addr")) {
-			eth_setenv_enetaddr("eth1addr", info->mac1);
+			eth_env_set_enetaddr("eth1addr", info->mac1);
 		}
 
 		/* board serial-number */
 		sprintf(str, "%6d", info->serial);
-		setenv("serial#", str);
+		env_set("serial#", str);
 
 		/* memory MB */
 		sprintf(str, "%d", (int) (gd->ram_size >> 20));
-		setenv("mem_mb", str);
+		env_set("mem_mb", str);
 	}
 
 	/* Set a non-initialized hwconfig based on board configuration */
@@ -798,7 +798,7 @@ int misc_init_r(void)
 			if (strlen(buf) + strlen(buf1) < sizeof(buf))
 				strcat(buf, buf1);
 		}
-		setenv("hwconfig", buf);
+		env_set("hwconfig", buf);
 	}
 
 	/* setup baseboard specific GPIO based on board and env */
diff --git a/board/grinn/chiliboard/board.c b/board/grinn/chiliboard/board.c
index e3f82b0a80..2900109bbd 100644
--- a/board/grinn/chiliboard/board.c
+++ b/board/grinn/chiliboard/board.c
@@ -130,7 +130,7 @@ int board_late_init(void)
 		printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
 		if (is_valid_ethaddr(mac_addr))
-			eth_setenv_enetaddr("ethaddr", mac_addr);
+			eth_env_set_enetaddr("ethaddr", mac_addr);
 	}
 
 	mac_lo = readl(&cdev->macid1l);
@@ -144,7 +144,7 @@ int board_late_init(void)
 
 	if (!getenv("eth1addr")) {
 		if (is_valid_ethaddr(mac_addr))
-			eth_setenv_enetaddr("eth1addr", mac_addr);
+			eth_env_set_enetaddr("eth1addr", mac_addr);
 	}
 #endif
 
diff --git a/board/grinn/liteboard/board.c b/board/grinn/liteboard/board.c
index 817e22fd45..24956927ac 100644
--- a/board/grinn/liteboard/board.c
+++ b/board/grinn/liteboard/board.c
@@ -168,12 +168,12 @@ void board_late_mmc_init(void)
 	if (!check_mmc_autodetect())
 		return;
 
-	setenv_ulong("mmcdev", dev_no);
+	env_set_ulong("mmcdev", dev_no);
 
 	/* Set mmcblk env */
 	sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw",
 		dev_no);
-	setenv("mmcroot", mmcblk);
+	env_set("mmcroot", mmcblk);
 
 	sprintf(cmd, "mmc dev %d", dev_no);
 	run_command(cmd, 0);
diff --git a/board/gumstix/pepper/board.c b/board/gumstix/pepper/board.c
index d76c28bd3c..7e8b014e3d 100644
--- a/board/gumstix/pepper/board.c
+++ b/board/gumstix/pepper/board.c
@@ -250,7 +250,7 @@ int board_eth_init(bd_t *bis)
 		mac_addr[4] = mac_lo & 0xFF;
 		mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 		if (is_valid_ethaddr(mac_addr))
-			eth_setenv_enetaddr("ethaddr", mac_addr);
+			eth_env_set_enetaddr("ethaddr", mac_addr);
 	}
 
 	writel((RGMII_MODE_ENABLE | RGMII_INT_DELAY), &cdev->miisel);
diff --git a/board/highbank/highbank.c b/board/highbank/highbank.c
index 1af2207867..e51043aa91 100644
--- a/board/highbank/highbank.c
+++ b/board/highbank/highbank.c
@@ -82,9 +82,9 @@ int misc_init_r(void)
 	sprintf(envbuffer, "bootcmd%d", boot_choice);
 	if (getenv(envbuffer)) {
 		sprintf(envbuffer, "run bootcmd%d", boot_choice);
-		setenv("bootcmd", envbuffer);
+		env_set("bootcmd", envbuffer);
 	} else
-		setenv("bootcmd", "");
+		env_set("bootcmd", "");
 
 	return 0;
 }
diff --git a/board/htkw/mcx/mcx.c b/board/htkw/mcx/mcx.c
index 1deb2bdd8b..0a02e44046 100644
--- a/board/htkw/mcx/mcx.c
+++ b/board/htkw/mcx/mcx.c
@@ -83,7 +83,7 @@ int board_late_init(void)
 	if (gpio_get_value(HOT_WATER_BUTTON))
 		return 0;
 
-	setenv("bootcmd", "run swupdate");
+	env_set("bootcmd", "run swupdate");
 
 	return 0;
 }
diff --git a/board/isee/igep003x/board.c b/board/isee/igep003x/board.c
index e33170d65f..1aa2f52069 100644
--- a/board/isee/igep003x/board.c
+++ b/board/isee/igep003x/board.c
@@ -194,13 +194,13 @@ int board_late_init(void)
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 	switch (get_board_revision()) {
 		case 0:
-			setenv("board_name", "igep0034-lite");
+			env_set("board_name", "igep0034-lite");
 			break;
 		case 1:
-			setenv("board_name", "igep0034");
+			env_set("board_name", "igep0034");
 			break;
 		default:
-			setenv("board_name", "igep0033");
+			env_set("board_name", "igep0033");
 			break;
 	}
 #endif
@@ -275,7 +275,7 @@ int board_eth_init(bd_t *bis)
 		mac_addr[4] = mac_lo & 0xFF;
 		mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 		if (is_valid_ethaddr(mac_addr))
-			eth_setenv_enetaddr("ethaddr", mac_addr);
+			eth_env_set_enetaddr("ethaddr", mac_addr);
 	}
 
 	writel((GMII1_SEL_RMII | RMII1_IO_CLK_EN),
diff --git a/board/isee/igep00x0/igep00x0.c b/board/isee/igep00x0/igep00x0.c
index 843d35eb2d..a7a75601dd 100644
--- a/board/isee/igep00x0/igep00x0.c
+++ b/board/isee/igep00x0/igep00x0.c
@@ -251,10 +251,10 @@ void set_fdt(void)
 {
 	switch (gd->bd->bi_arch_number) {
 	case MACH_TYPE_IGEP0020:
-		setenv("fdtfile", "omap3-igep0020.dtb");
+		env_set("fdtfile", "omap3-igep0020.dtb");
 		break;
 	case MACH_TYPE_IGEP0030:
-		setenv("fdtfile", "omap3-igep0030.dtb");
+		env_set("fdtfile", "omap3-igep0030.dtb");
 		break;
 	}
 }
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
index 408079c9a1..56d3044241 100644
--- a/board/keymile/common/common.c
+++ b/board/keymile/common/common.c
@@ -51,7 +51,7 @@ int set_km_env(void)
 	pnvramaddr = gd->ram_size - CONFIG_KM_RESERVED_PRAM - CONFIG_KM_PHRAM
 			- CONFIG_KM_PNVRAM;
 	sprintf((char *)buf, "0x%x", pnvramaddr);
-	setenv("pnvramaddr", (char *)buf);
+	env_set("pnvramaddr", (char *)buf);
 
 	/* try to read rootfssize (ram image) from environment */
 	p = getenv("rootfssize");
@@ -60,15 +60,15 @@ int set_km_env(void)
 	pram = (rootfssize + CONFIG_KM_RESERVED_PRAM + CONFIG_KM_PHRAM +
 		CONFIG_KM_PNVRAM) / 0x400;
 	sprintf((char *)buf, "0x%x", pram);
-	setenv("pram", (char *)buf);
+	env_set("pram", (char *)buf);
 
 	varaddr = gd->ram_size - CONFIG_KM_RESERVED_PRAM - CONFIG_KM_PHRAM;
 	sprintf((char *)buf, "0x%x", varaddr);
-	setenv("varaddr", (char *)buf);
+	env_set("varaddr", (char *)buf);
 
 	kernelmem = gd->ram_size - 0x400 * pram;
 	sprintf((char *)buf, "0x%x", kernelmem);
-	setenv("kernelmem", (char *)buf);
+	env_set("kernelmem", (char *)buf);
 
 	return 0;
 }
@@ -169,7 +169,7 @@ static int do_setboardid(cmd_tbl_t *cmdtp, int flag, int argc,
 		return 1;
 	}
 	strcpy((char *)buf, p);
-	setenv("boardid", (char *)buf);
+	env_set("boardid", (char *)buf);
 	printf("set boardid=%s\n", buf);
 
 	p = get_local_var("IVM_HWKey");
@@ -178,7 +178,7 @@ static int do_setboardid(cmd_tbl_t *cmdtp, int flag, int argc,
 		return 1;
 	}
 	strcpy((char *)buf, p);
-	setenv("hwkey", (char *)buf);
+	env_set("hwkey", (char *)buf);
 	printf("set hwkey=%s\n", buf);
 	printf("Execute manually saveenv for persistent storage.\n");
 
@@ -311,9 +311,9 @@ static int do_checkboardidhwk(cmd_tbl_t *cmdtp, int flag, int argc,
 					envbid   = bid;
 					envhwkey = hwkey;
 					sprintf(buf, "%lx", bid);
-					setenv("boardid", buf);
+					env_set("boardid", buf);
 					sprintf(buf, "%lx", hwkey);
-					setenv("hwkey", buf);
+					env_set("hwkey", buf);
 				}
 			} /* end while( ! found ) */
 		}
diff --git a/board/keymile/common/ivm.c b/board/keymile/common/ivm.c
index e9e518cf72..dc40a83fc0 100644
--- a/board/keymile/common/ivm.c
+++ b/board/keymile/common/ivm.c
@@ -310,11 +310,11 @@ static int ivm_populate_env(unsigned char *buf, int len)
 #ifndef CONFIG_KMTEGR1
 	/* if an offset is defined, add it */
 	process_mac(valbuf, page2, CONFIG_PIGGY_MAC_ADRESS_OFFSET, true);
-	setenv((char *)"ethaddr", (char *)valbuf);
+	env_set((char *)"ethaddr", (char *)valbuf);
 #ifdef CONFIG_KMVECT1
 /* KMVECT1 has two ethernet interfaces */
 	process_mac(valbuf, page2, 1, true);
-	setenv((char *)"eth1addr", (char *)valbuf);
+	env_set((char *)"eth1addr", (char *)valbuf);
 #endif
 #else
 /* KMTEGR1 has a special setup. eth0 has no connection to the outside and
@@ -322,9 +322,9 @@ static int ivm_populate_env(unsigned char *buf, int len)
  * gets the official MAC address from the IVM
  */
 	process_mac(valbuf, page2, CONFIG_PIGGY_MAC_ADRESS_OFFSET, false);
-	setenv((char *)"ethaddr", (char *)valbuf);
+	env_set((char *)"ethaddr", (char *)valbuf);
 	process_mac(valbuf, page2, CONFIG_PIGGY_MAC_ADRESS_OFFSET, true);
-	setenv((char *)"eth1addr", (char *)valbuf);
+	env_set((char *)"eth1addr", (char *)valbuf);
 #endif
 
 	return 0;
diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c
index 8020c379fd..5e07faa818 100644
--- a/board/keymile/km83xx/km83xx.c
+++ b/board/keymile/km83xx/km83xx.c
@@ -263,11 +263,11 @@ int last_stage_init(void)
 	mv88e_sw_reset(name, CONFIG_KM_MVEXTSW_ADDR);
 
 	if (piggy_present()) {
-		setenv("ethact", "UEC2");
-		setenv("netdev", "eth1");
+		env_set("ethact", "UEC2");
+		env_set("netdev", "eth1");
 		puts("using PIGGY for network boot\n");
 	} else {
-		setenv("netdev", "eth0");
+		env_set("netdev", "eth0");
 		puts("using frontport for network boot\n");
 	}
 #endif
@@ -280,7 +280,7 @@ int last_stage_init(void)
 	if (dip_switch != 0) {
 		/* start bootloader */
 		puts("DIP:   Enabled\n");
-		setenv("actual_bank", "0");
+		env_set("actual_bank", "0");
 	}
 #endif
 	set_km_env();
diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index 85785ffc02..08ae9ae346 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -193,7 +193,7 @@ static void set_bootcount_addr(void)
 	unsigned int bootcountaddr;
 	bootcountaddr = gd->ram_size - BOOTCOUNT_ADDR;
 	sprintf((char *)buf, "0x%x", bootcountaddr);
-	setenv("bootcountaddr", (char *)buf);
+	env_set("bootcountaddr", (char *)buf);
 }
 
 int misc_init_r(void)
@@ -299,7 +299,7 @@ int board_late_init(void)
 	if (dip_switch != 0) {
 		/* start bootloader */
 		puts("DIP:   Enabled\n");
-		setenv("actual_bank", "0");
+		env_set("actual_bank", "0");
 	}
 #endif
 
diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c
index abb20196c5..095e467ac0 100644
--- a/board/keymile/kmp204x/kmp204x.c
+++ b/board/keymile/kmp204x/kmp204x.c
@@ -222,7 +222,7 @@ int last_stage_init(void)
 	if (dip_switch != 0) {
 		/* start bootloader */
 		puts("DIP:   Enabled\n");
-		setenv("actual_bank", "0");
+		env_set("actual_bank", "0");
 	}
 #endif
 	set_km_env();
diff --git a/board/kosagi/novena/novena.c b/board/kosagi/novena/novena.c
index 980cd6288c..baca7223fa 100644
--- a/board/kosagi/novena/novena.c
+++ b/board/kosagi/novena/novena.c
@@ -264,7 +264,7 @@ int misc_init_r(void)
 	}
 
 	/* Set ethernet address from EEPROM. */
-	eth_setenv_enetaddr("ethaddr", data.mac);
+	eth_env_set_enetaddr("ethaddr", data.mac);
 
 	return ret;
 }
diff --git a/board/lg/sniper/sniper.c b/board/lg/sniper/sniper.c
index f924645dc0..4906e4f9d2 100644
--- a/board/lg/sniper/sniper.c
+++ b/board/lg/sniper/sniper.c
@@ -134,7 +134,7 @@ int misc_init_r(void)
 
 	if (reboot_mode[0] > 0 && isascii(reboot_mode[0])) {
 		if (!getenv("reboot-mode"))
-			setenv("reboot-mode", (char *)reboot_mode);
+			env_set("reboot-mode", (char *)reboot_mode);
 	}
 
 	omap_reboot_mode_clear();
diff --git a/board/liebherr/mccmon6/mccmon6.c b/board/liebherr/mccmon6/mccmon6.c
index e265e2a732..8d0a66621d 100644
--- a/board/liebherr/mccmon6/mccmon6.c
+++ b/board/liebherr/mccmon6/mccmon6.c
@@ -367,7 +367,7 @@ int board_init(void)
 
 int board_late_init(void)
 {
-	setenv("board_name", "mccmon6");
+	env_set("board_name", "mccmon6");
 
 	return 0;
 }
diff --git a/board/logicpd/imx6/imx6logic.c b/board/logicpd/imx6/imx6logic.c
index 0a7d4124a6..78fc5466b6 100644
--- a/board/logicpd/imx6/imx6logic.c
+++ b/board/logicpd/imx6/imx6logic.c
@@ -173,11 +173,11 @@ int board_init(void)
 
 int board_late_init(void)
 {
-	setenv("board_name", "imx6logic");
+	env_set("board_name", "imx6logic");
 
 	if (is_mx6dq()) {
-		setenv("board_rev", "MX6DQ");
-		setenv("fdt_file", "imx6q-logicpd.dtb");
+		env_set("board_rev", "MX6DQ");
+		env_set("fdt_file", "imx6q-logicpd.dtb");
 	}
 
 	return 0;
diff --git a/board/logicpd/omap3som/omap3logic.c b/board/logicpd/omap3som/omap3logic.c
index 7990dd2513..8885d1e6a9 100644
--- a/board/logicpd/omap3som/omap3logic.c
+++ b/board/logicpd/omap3som/omap3logic.c
@@ -220,7 +220,7 @@ int board_late_init(void)
 
 		/* If the user has not set fdtimage, set the default */
 		if (!getenv("fdtimage"))
-			setenv("fdtimage", board->fdtfile);
+			env_set("fdtimage", board->fdtfile);
 	}
 
 	/* restore hsusb0_data5 pin as hsusb0_data5 */
diff --git a/board/logicpd/zoom1/zoom1.c b/board/logicpd/zoom1/zoom1.c
index e91f874a2b..f76223cacd 100644
--- a/board/logicpd/zoom1/zoom1.c
+++ b/board/logicpd/zoom1/zoom1.c
@@ -133,7 +133,7 @@ int board_eth_init(bd_t *bis)
 	if (!eth_getenv_enetaddr(STR_ENV_ETHADDR, eth_addr)) {
 		dev = eth_get_dev_by_index(0);
 		if (dev) {
-			eth_setenv_enetaddr(STR_ENV_ETHADDR, dev->enetaddr);
+			eth_env_set_enetaddr(STR_ENV_ETHADDR, dev->enetaddr);
 		} else {
 			printf("zoom1: Couldn't get eth device\n");
 			rc = -1;
diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c
index 6a4427a42e..889e748f98 100644
--- a/board/nokia/rx51/rx51.c
+++ b/board/nokia/rx51/rx51.c
@@ -413,7 +413,7 @@ int misc_init_r(void)
 
 	/* set env variable attkernaddr for relocated kernel */
 	sprintf(buf, "%#x", KERNEL_ADDRESS);
-	setenv("attkernaddr", buf);
+	env_set("attkernaddr", buf);
 
 	/* initialize omap tags */
 	init_omap_tags();
diff --git a/board/overo/overo.c b/board/overo/overo.c
index adf33cfd37..140e34d4dd 100644
--- a/board/overo/overo.c
+++ b/board/overo/overo.c
@@ -172,47 +172,47 @@ int misc_init_r(void)
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
-		setenv("defaultdisplay", "dvi");
-		setenv("expansionname", "summit");
+		env_set("defaultdisplay", "dvi");
+		env_set("expansionname", "summit");
 		break;
 	case GUMSTIX_TOBI:
 		printf("Recognized Tobi expansion board (rev %d %s)\n",
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
-		setenv("defaultdisplay", "dvi");
-		setenv("expansionname", "tobi");
+		env_set("defaultdisplay", "dvi");
+		env_set("expansionname", "tobi");
 		break;
 	case GUMSTIX_TOBI_DUO:
 		printf("Recognized Tobi Duo expansion board (rev %d %s)\n",
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
-		setenv("expansionname", "tobiduo");
+		env_set("expansionname", "tobiduo");
 		break;
 	case GUMSTIX_PALO35:
 		printf("Recognized Palo35 expansion board (rev %d %s)\n",
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
-		setenv("defaultdisplay", "lcd35");
-		setenv("expansionname", "palo35");
+		env_set("defaultdisplay", "lcd35");
+		env_set("expansionname", "palo35");
 		break;
 	case GUMSTIX_PALO43:
 		printf("Recognized Palo43 expansion board (rev %d %s)\n",
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
-		setenv("defaultdisplay", "lcd43");
-		setenv("expansionname", "palo43");
+		env_set("defaultdisplay", "lcd43");
+		env_set("expansionname", "palo43");
 		break;
 	case GUMSTIX_CHESTNUT43:
 		printf("Recognized Chestnut43 expansion board (rev %d %s)\n",
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
-		setenv("defaultdisplay", "lcd43");
-		setenv("expansionname", "chestnut43");
+		env_set("defaultdisplay", "lcd43");
+		env_set("expansionname", "chestnut43");
 		break;
 	case GUMSTIX_PINTO:
 		printf("Recognized Pinto expansion board (rev %d %s)\n",
@@ -225,8 +225,8 @@ int misc_init_r(void)
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
-		setenv("defaultdisplay", "lcd43");
-		setenv("expansionname", "gallop43");
+		env_set("defaultdisplay", "lcd43");
+		env_set("expansionname", "gallop43");
 		break;
 	case GUMSTIX_ALTO35:
 		printf("Recognized Alto35 expansion board (rev %d %s)\n",
@@ -234,8 +234,8 @@ int misc_init_r(void)
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
 		MUX_ALTO35();
-		setenv("defaultdisplay", "lcd35");
-		setenv("expansionname", "alto35");
+		env_set("defaultdisplay", "lcd35");
+		env_set("expansionname", "alto35");
 		break;
 	case GUMSTIX_STAGECOACH:
 		printf("Recognized Stagecoach expansion board (rev %d %s)\n",
@@ -261,8 +261,8 @@ int misc_init_r(void)
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
 		MUX_ARBOR43C();
-		setenv("defaultdisplay", "lcd43");
-		setenv("expansionname", "arbor43c");
+		env_set("defaultdisplay", "lcd43");
+		env_set("expansionname", "arbor43c");
 		break;
 	case ETTUS_USRP_E:
 		printf("Recognized Ettus Research USRP-E (rev %d %s)\n",
@@ -270,13 +270,13 @@ int misc_init_r(void)
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
 		MUX_USRP_E();
-		setenv("defaultdisplay", "dvi");
+		env_set("defaultdisplay", "dvi");
 		break;
 	case GUMSTIX_NO_EEPROM:
 	case GUMSTIX_EMPTY_EEPROM:
 		puts("No or empty EEPROM on expansion board\n");
 		MUX_GUMSTIX();
-		setenv("expansionname", "tobi");
+		env_set("expansionname", "tobi");
 		break;
 	default:
 		printf("Unrecognized expansion board 0x%08x\n", expansion_id);
@@ -284,14 +284,14 @@ int misc_init_r(void)
 	}
 
 	if (expansion_config.content == 1)
-		setenv(expansion_config.env_var, expansion_config.env_setting);
+		env_set(expansion_config.env_var, expansion_config.env_setting);
 
 	omap_die_id_display();
 
 	if (get_cpu_family() == CPU_OMAP34XX)
-		setenv("boardname", "overo");
+		env_set("boardname", "overo");
 	else
-		setenv("boardname", "overo-storm");
+		env_set("boardname", "overo-storm");
 
 	return 0;
 }
diff --git a/board/phytec/pcm051/board.c b/board/phytec/pcm051/board.c
index 4f3853ac42..0da96e7413 100644
--- a/board/phytec/pcm051/board.c
+++ b/board/phytec/pcm051/board.c
@@ -229,7 +229,7 @@ int board_eth_init(bd_t *bis)
 		mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
 		if (is_valid_ethaddr(mac_addr))
-			eth_setenv_enetaddr("ethaddr", mac_addr);
+			eth_env_set_enetaddr("ethaddr", mac_addr);
 		else
 			goto try_usbether;
 	}
diff --git a/board/qualcomm/dragonboard410c/dragonboard410c.c b/board/qualcomm/dragonboard410c/dragonboard410c.c
index 37d0b85e0e..848e27848b 100644
--- a/board/qualcomm/dragonboard410c/dragonboard410c.c
+++ b/board/qualcomm/dragonboard410c/dragonboard410c.c
@@ -128,7 +128,7 @@ int misc_init_r(void)
 	}
 
 	if (dm_gpio_get_value(&resin)) {
-		setenv("bootdelay", "-1");
+		env_set("bootdelay", "-1");
 		printf("Power button pressed - dropping to console.\n");
 	}
 
diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
index d3c6ba580f..7ff7b269f9 100644
--- a/board/raspberrypi/rpi/rpi.c
+++ b/board/raspberrypi/rpi/rpi.c
@@ -251,7 +251,7 @@ static void set_fdtfile(void)
 		return;
 
 	fdtfile = model->fdtfile;
-	setenv("fdtfile", fdtfile);
+	env_set("fdtfile", fdtfile);
 }
 
 /*
@@ -266,7 +266,7 @@ static void set_fdt_addr(void)
 	if (fdt_magic(fw_dtb_pointer) != FDT_MAGIC)
 		return;
 
-	setenv_hex("fdt_addr", fw_dtb_pointer);
+	env_set_hex("fdt_addr", fw_dtb_pointer);
 }
 
 /*
@@ -300,10 +300,10 @@ static void set_usbethaddr(void)
 		return;
 	}
 
-	eth_setenv_enetaddr("usbethaddr", msg->get_mac_address.body.resp.mac);
+	eth_env_set_enetaddr("usbethaddr", msg->get_mac_address.body.resp.mac);
 
 	if (!getenv("ethaddr"))
-		setenv("ethaddr", getenv("usbethaddr"));
+		env_set("ethaddr", getenv("usbethaddr"));
 
 	return;
 }
@@ -314,13 +314,13 @@ static void set_board_info(void)
 	char s[11];
 
 	snprintf(s, sizeof(s), "0x%X", revision);
-	setenv("board_revision", s);
+	env_set("board_revision", s);
 	snprintf(s, sizeof(s), "%d", rev_scheme);
-	setenv("board_rev_scheme", s);
+	env_set("board_rev_scheme", s);
 	/* Can't rename this to board_rev_type since it's an ABI for scripts */
 	snprintf(s, sizeof(s), "0x%X", rev_type);
-	setenv("board_rev", s);
-	setenv("board_name", model->name);
+	env_set("board_rev", s);
+	env_set("board_name", model->name);
 }
 #endif /* CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG */
 
@@ -345,7 +345,7 @@ static void set_serial_number(void)
 
 	snprintf(serial_string, sizeof(serial_string), "%016" PRIx64,
 		 msg->get_board_serial.body.resp.serial);
-	setenv("serial#", serial_string);
+	env_set("serial#", serial_string);
 }
 
 int misc_init_r(void)
diff --git a/board/renesas/blanche/blanche.c b/board/renesas/blanche/blanche.c
index 5156eafeb4..e3262f779a 100644
--- a/board/renesas/blanche/blanche.c
+++ b/board/renesas/blanche/blanche.c
@@ -421,7 +421,7 @@ int board_eth_init(bd_t *bis)
 	if (!eth_getenv_enetaddr(STR_ENV_ETHADDR, eth_addr)) {
 		dev = eth_get_dev_by_index(0);
 		if (dev) {
-			eth_setenv_enetaddr(STR_ENV_ETHADDR, dev->enetaddr);
+			eth_env_set_enetaddr(STR_ENV_ETHADDR, dev->enetaddr);
 		} else {
 			printf("blanche: Couldn't get eth device\n");
 			rc = -1;
diff --git a/board/renesas/ecovec/ecovec.c b/board/renesas/ecovec/ecovec.c
index 28b557a5b0..e4bb440d24 100644
--- a/board/renesas/ecovec/ecovec.c
+++ b/board/renesas/ecovec/ecovec.c
@@ -55,7 +55,7 @@ int board_late_init(void)
 	/* Set MAC address */
 	sprintf(env_mac, "%02X:%02X:%02X:%02X:%02X:%02X",
 		mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
-	setenv("ethaddr", env_mac);
+	env_set("ethaddr", env_mac);
 
 	debug_led(0x0F);
 
diff --git a/board/renesas/sh7752evb/sh7752evb.c b/board/renesas/sh7752evb/sh7752evb.c
index 525d979724..4a76fb73ee 100644
--- a/board/renesas/sh7752evb/sh7752evb.c
+++ b/board/renesas/sh7752evb/sh7752evb.c
@@ -221,10 +221,10 @@ static void init_ethernet_mac(void)
 	for (i = 0; i < SH7752EVB_ETHERNET_NUM_CH; i++) {
 		get_sh_eth_mac(i, mac_string, buf);
 		if (i == 0)
-			setenv("ethaddr", mac_string);
+			env_set("ethaddr", mac_string);
 		else {
 			sprintf(env_string, "eth%daddr", i);
-			setenv(env_string, mac_string);
+			env_set(env_string, mac_string);
 		}
 		set_mac_to_sh_giga_eth_register(i, mac_string);
 	}
diff --git a/board/renesas/sh7753evb/sh7753evb.c b/board/renesas/sh7753evb/sh7753evb.c
index 3d1eedaa5f..ca9e144743 100644
--- a/board/renesas/sh7753evb/sh7753evb.c
+++ b/board/renesas/sh7753evb/sh7753evb.c
@@ -237,10 +237,10 @@ static void init_ethernet_mac(void)
 	for (i = 0; i < SH7753EVB_ETHERNET_NUM_CH; i++) {
 		get_sh_eth_mac(i, mac_string, buf);
 		if (i == 0)
-			setenv("ethaddr", mac_string);
+			env_set("ethaddr", mac_string);
 		else {
 			sprintf(env_string, "eth%daddr", i);
-			setenv(env_string, mac_string);
+			env_set(env_string, mac_string);
 		}
 		set_mac_to_sh_giga_eth_register(i, mac_string);
 	}
diff --git a/board/renesas/sh7757lcr/sh7757lcr.c b/board/renesas/sh7757lcr/sh7757lcr.c
index 0a04a9d39d..3f970fc401 100644
--- a/board/renesas/sh7757lcr/sh7757lcr.c
+++ b/board/renesas/sh7757lcr/sh7757lcr.c
@@ -278,10 +278,10 @@ static void init_ethernet_mac(void)
 	for (i = 0; i < SH7757LCR_ETHERNET_NUM_CH; i++) {
 		get_sh_eth_mac(i, mac_string, buf);
 		if (i == 0)
-			setenv("ethaddr", mac_string);
+			env_set("ethaddr", mac_string);
 		else {
 			sprintf(env_string, "eth%daddr", i);
-			setenv(env_string, mac_string);
+			env_set(env_string, mac_string);
 		}
 
 		set_mac_to_sh_eth_register(i, mac_string);
@@ -291,7 +291,7 @@ static void init_ethernet_mac(void)
 	for (i = 0; i < SH7757LCR_GIGA_ETHERNET_NUM_CH; i++) {
 		get_sh_eth_mac(i + SH7757LCR_ETHERNET_NUM_CH, mac_string, buf);
 		sprintf(env_string, "eth%daddr", i + SH7757LCR_ETHERNET_NUM_CH);
-		setenv(env_string, mac_string);
+		env_set(env_string, mac_string);
 
 		set_mac_to_sh_giga_eth_register(i, mac_string);
 	}
diff --git a/board/rockchip/kylin_rk3036/kylin_rk3036.c b/board/rockchip/kylin_rk3036/kylin_rk3036.c
index 7e2edf4a56..9134994874 100644
--- a/board/rockchip/kylin_rk3036/kylin_rk3036.c
+++ b/board/rockchip/kylin_rk3036/kylin_rk3036.c
@@ -44,7 +44,7 @@ int rk_board_late_init(void)
 {
 	if (fastboot_key_pressed()) {
 		printf("enter fastboot!\n");
-		setenv("preboot", "setenv preboot; fastboot usb0");
+		env_set("preboot", "setenv preboot; fastboot usb0");
 	}
 
 	return 0;
diff --git a/board/rockchip/tinker_rk3288/tinker-rk3288.c b/board/rockchip/tinker_rk3288/tinker-rk3288.c
index c2872e7330..790a921515 100644
--- a/board/rockchip/tinker_rk3288/tinker-rk3288.c
+++ b/board/rockchip/tinker_rk3288/tinker-rk3288.c
@@ -29,7 +29,7 @@ int rk_board_late_init(void)
 		return 0;
 
 	if (is_valid_ethaddr(ethaddr))
-		eth_setenv_enetaddr("ethaddr", ethaddr);
+		eth_env_set_enetaddr("ethaddr", ethaddr);
 
 	return 0;
 }
diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index b18eed2fac..4157349d02 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -51,7 +51,7 @@ void set_dfu_alt_info(char *interface, char *devstr)
 
 	alt_setting = get_dfu_alt_boot(interface, devstr);
 	if (alt_setting) {
-		setenv("dfu_alt_boot", alt_setting);
+		env_set("dfu_alt_boot", alt_setting);
 		offset = snprintf(buf, buf_size, "%s", alt_setting);
 	}
 
@@ -71,7 +71,7 @@ void set_dfu_alt_info(char *interface, char *devstr)
 		status = "done\n";
 	}
 
-	setenv("dfu_alt_info", alt_info);
+	env_set("dfu_alt_info", alt_info);
 	puts(status);
 }
 #endif
@@ -83,14 +83,14 @@ void set_board_info(void)
 
 	snprintf(info, ARRAY_SIZE(info), "%u.%u", (s5p_cpu_rev & 0xf0) >> 4,
 		 s5p_cpu_rev & 0xf);
-	setenv("soc_rev", info);
+	env_set("soc_rev", info);
 
 	snprintf(info, ARRAY_SIZE(info), "%x", s5p_cpu_id);
-	setenv("soc_id", info);
+	env_set("soc_id", info);
 
 #ifdef CONFIG_REVISION_TAG
 	snprintf(info, ARRAY_SIZE(info), "%x", get_board_rev());
-	setenv("board_rev", info);
+	env_set("board_rev", info);
 #endif
 #ifdef CONFIG_OF_LIBFDT
 	const char *bdtype = "";
@@ -102,11 +102,11 @@ void set_board_info(void)
 		bdtype = "";
 
 	sprintf(info, "%s%s", bdname, bdtype);
-	setenv("boardname", info);
+	env_set("boardname", info);
 #endif
 	snprintf(info, ARRAY_SIZE(info),  "%s%x-%s%s.dtb",
 		 CONFIG_SYS_SOC, s5p_cpu_id, bdname, bdtype);
-	setenv("fdtfile", info);
+	env_set("fdtfile", info);
 #endif
 }
 #endif /* CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG */
diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index 00059a1317..f0913383b9 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -469,7 +469,7 @@ void exynos_lcd_misc_init(vidinfo_t *vid)
 #endif
 #ifdef CONFIG_S6E8AX0
 	s6e8ax0_init();
-	setenv("lcdinfo", "lcd=s6e8ax0");
+	env_set("lcdinfo", "lcd=s6e8ax0");
 #endif
 }
 #endif
diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
index cc6eaf7ad0..549ac8b48a 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -397,6 +397,6 @@ void exynos_lcd_misc_init(vidinfo_t *vid)
 	vid->pclk_name = 1;	/* MPLL */
 	vid->sclk_div = 1;
 
-	setenv("lcdinfo", "lcd=ld9040");
+	env_set("lcdinfo", "lcd=ld9040");
 }
 #endif
diff --git a/board/samtec/vining_2000/vining_2000.c b/board/samtec/vining_2000/vining_2000.c
index 5c8b436776..125f6e7070 100644
--- a/board/samtec/vining_2000/vining_2000.c
+++ b/board/samtec/vining_2000/vining_2000.c
@@ -132,7 +132,7 @@ int board_eth_init(bd_t *bis)
 	/* just to get secound mac address */
 	imx_get_mac_from_fuse(1, eth1addr);
 	if (!getenv("eth1addr") && is_valid_ethaddr(eth1addr))
-		eth_setenv_enetaddr("eth1addr", eth1addr);
+		eth_env_set_enetaddr("eth1addr", eth1addr);
 
 	imx_iomux_v3_setup_multiple_pads(fec1_pads, ARRAY_SIZE(fec1_pads));
 
@@ -413,11 +413,11 @@ static int set_pin_state(void)
 		return ret;
 
 	if (val >= VAL_UPPER)
-		setenv("pin_state", "connected");
+		env_set("pin_state", "connected");
 	else if (val < VAL_UPPER && val > VAL_LOWER)
-		setenv("pin_state", "open");
+		env_set("pin_state", "open");
 	else
-		setenv("pin_state", "button");
+		env_set("pin_state", "button");
 
 	return ret;
 }
diff --git a/board/samtec/vining_fpga/socfpga.c b/board/samtec/vining_fpga/socfpga.c
index f888ecbbc1..760fc71217 100644
--- a/board/samtec/vining_fpga/socfpga.c
+++ b/board/samtec/vining_fpga/socfpga.c
@@ -69,9 +69,9 @@ int misc_init_r(void)
 	/* Check EEPROM signature. */
 	if (!(data[0] == 0xa5 && data[1] == 0x5a)) {
 		puts("Invalid I2C EEPROM signature.\n");
-		setenv("unit_serial", "invalid");
-		setenv("unit_ident", "VINing-xxxx-STD");
-		setenv("hostname", "vining-invalid");
+		env_set("unit_serial", "invalid");
+		env_set("unit_ident", "VINing-xxxx-STD");
+		env_set("hostname", "vining-invalid");
 		return 0;
 	}
 
@@ -82,18 +82,18 @@ int misc_init_r(void)
 			 (data[0x56] << 8) | (data[0x57] << 0);
 		memset(str, 0, sizeof(str));
 		sprintf(str, "%07i", serial);
-		setenv("unit_serial", str);
+		env_set("unit_serial", str);
 	}
 
 	if (!getenv("unit_ident")) {
 		memset(str, 0, sizeof(str));
 		memcpy(str, &data[0x2e], 18);
-		setenv("unit_ident", str);
+		env_set("unit_ident", str);
 	}
 
 	/* Set ethernet address from EEPROM. */
 	if (!getenv("ethaddr") && is_valid_ethaddr(&data[0x62]))
-		eth_setenv_enetaddr("ethaddr", &data[0x62]);
+		eth_env_set_enetaddr("ethaddr", &data[0x62]);
 
 	return 0;
 }
diff --git a/board/siemens/common/factoryset.c b/board/siemens/common/factoryset.c
index 6c869ed2b0..b4f027af28 100644
--- a/board/siemens/common/factoryset.c
+++ b/board/siemens/common/factoryset.c
@@ -266,7 +266,7 @@ err:
 
 static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
 
-static int factoryset_mac_setenv(void)
+static int factoryset_mac_env_set(void)
 {
 	uint8_t mac_addr[6];
 
@@ -292,15 +292,15 @@ static int factoryset_mac_setenv(void)
 		}
 	}
 
-	eth_setenv_enetaddr("ethaddr", mac_addr);
+	eth_env_set_enetaddr("ethaddr", mac_addr);
 	return 0;
 }
 
-int factoryset_setenv(void)
+int factoryset_env_set(void)
 {
 	int ret = 0;
 
-	if (factoryset_mac_setenv() < 0)
+	if (factoryset_mac_env_set() < 0)
 		ret = -1;
 
 	return ret;
diff --git a/board/siemens/common/factoryset.h b/board/siemens/common/factoryset.h
index 3f23d5ebf4..8602627d2e 100644
--- a/board/siemens/common/factoryset.h
+++ b/board/siemens/common/factoryset.h
@@ -25,7 +25,7 @@ struct factorysetcontainer {
 };
 
 int factoryset_read_eeprom(int i2c_addr);
-int factoryset_setenv(void);
+int factoryset_env_set(void);
 extern struct factorysetcontainer factory_dat;
 
 #endif /* __FACTORYSET_H */
diff --git a/board/siemens/draco/board.c b/board/siemens/draco/board.c
index d8869a09dd..c705b5ab0f 100644
--- a/board/siemens/draco/board.c
+++ b/board/siemens/draco/board.c
@@ -272,13 +272,13 @@ int board_late_init(void)
 #ifdef CONFIG_FACTORYSET
 	/* Set ASN in environment*/
 	if (factory_dat.asn[0] != 0) {
-		setenv("dtb_name", (char *)factory_dat.asn);
+		env_set("dtb_name", (char *)factory_dat.asn);
 	} else {
 		/* dtb suffix gets added in load script */
-		setenv("dtb_name", "am335x-draco");
+		env_set("dtb_name", "am335x-draco");
 	}
 #else
-	setenv("dtb_name", "am335x-draco");
+	env_set("dtb_name", "am335x-draco");
 #endif
 
 	return 0;
@@ -330,7 +330,7 @@ int board_eth_init(bd_t *bis)
 	int n = 0;
 	int rv;
 
-	factoryset_setenv();
+	factoryset_env_set();
 
 	/* Set rgmii mode and enable rmii clock to be sourced from chip */
 	writel((RMII_MODE_ENABLE | RMII_CHIPCKL_ENABLE), &cdev->miisel);
diff --git a/board/siemens/pxm2/board.c b/board/siemens/pxm2/board.c
index 750f338897..8bbb03561b 100644
--- a/board/siemens/pxm2/board.c
+++ b/board/siemens/pxm2/board.c
@@ -225,7 +225,7 @@ int board_eth_init(bd_t *bis)
 	if (!is_valid_ethaddr(factory_dat.mac))
 		printf("Error: no valid mac address\n");
 	else
-		eth_setenv_enetaddr("ethaddr", factory_dat.mac);
+		eth_env_set_enetaddr("ethaddr", factory_dat.mac);
 #endif /* #ifdef CONFIG_FACTORYSET */
 
 	/* Set rgmii mode and enable rmii clock to be sourced from chip */
@@ -446,12 +446,12 @@ int board_late_init(void)
 			factory_dat.pxm50 = 0;
 		sprintf(tmp, "%s_%s", factory_dat.asn,
 			factory_dat.comp_version);
-		ret = setenv("boardid", tmp);
+		ret = env_set("boardid", tmp);
 		if (ret)
 			printf("error setting board id\n");
 	} else {
 		factory_dat.pxm50 = 1;
-		ret = setenv("boardid", "PXM50_1.0");
+		ret = env_set("boardid", "PXM50_1.0");
 		if (ret)
 			printf("error setting board id\n");
 	}
diff --git a/board/siemens/rut/board.c b/board/siemens/rut/board.c
index b3c666c054..2a97414baf 100644
--- a/board/siemens/rut/board.c
+++ b/board/siemens/rut/board.c
@@ -182,7 +182,7 @@ int board_eth_init(bd_t *bis)
 	int rv;
 
 #ifndef CONFIG_SPL_BUILD
-	factoryset_setenv();
+	factoryset_env_set();
 #endif
 
 	/* Set rgmii mode and enable rmii clock to be sourced from chip */
@@ -482,7 +482,7 @@ int board_late_init(void)
 	else
 		strcpy(tmp, "QMX7.E38_4.0");
 
-	ret = setenv("boardid", tmp);
+	ret = env_set("boardid", tmp);
 	if (ret)
 		printf("error setting board id\n");
 
diff --git a/board/siemens/taurus/taurus.c b/board/siemens/taurus/taurus.c
index 3b742ebc22..d877a9c771 100644
--- a/board/siemens/taurus/taurus.c
+++ b/board/siemens/taurus/taurus.c
@@ -380,9 +380,9 @@ static int upgrade_failure_fallback(void)
 	partitionset_active = getenv("partitionset_active");
 	if (partitionset_active) {
 		if (partitionset_active[0] == 'A')
-			setenv("partitionset_active", "B");
+			env_set("partitionset_active", "B");
 		else
-			setenv("partitionset_active", "A");
+			env_set("partitionset_active", "A");
 	} else {
 		printf("partitionset_active missing.\n");
 		return -ENOENT;
@@ -390,22 +390,22 @@ static int upgrade_failure_fallback(void)
 
 	rootfs = getenv("rootfs");
 	rootfs_fallback = getenv("rootfs_fallback");
-	setenv("rootfs", rootfs_fallback);
-	setenv("rootfs_fallback", rootfs);
+	env_set("rootfs", rootfs_fallback);
+	env_set("rootfs_fallback", rootfs);
 
 	kern_size = getenv("kernel_size");
 	kern_size_fb = getenv("kernel_size_fallback");
-	setenv("kernel_size", kern_size_fb);
-	setenv("kernel_size_fallback", kern_size);
+	env_set("kernel_size", kern_size_fb);
+	env_set("kernel_size_fallback", kern_size);
 
 	kern_off = getenv("kernel_Off");
 	kern_off_fb = getenv("kernel_Off_fallback");
-	setenv("kernel_Off", kern_off_fb);
-	setenv("kernel_Off_fallback", kern_off);
+	env_set("kernel_Off", kern_off_fb);
+	env_set("kernel_Off_fallback", kern_off);
 
-	setenv("bootargs", '\0');
-	setenv("upgrade_available", '\0');
-	setenv("boot_retries", '\0');
+	env_set("bootargs", '\0');
+	env_set("upgrade_available", '\0');
+	env_set("boot_retries", '\0');
 	env_save();
 
 	return 0;
@@ -424,7 +424,7 @@ static int do_upgrade_available(cmd_tbl_t *cmdtp, int flag, int argc,
 		boot_retry = simple_strtoul(getenv("boot_retries"), NULL, 10);
 		boot_retry++;
 		sprintf(boot_buf, "%lx", boot_retry);
-		setenv("boot_retries", boot_buf);
+		env_set("boot_retries", boot_buf);
 		env_save();
 
 		/*
diff --git a/board/silica/pengwyn/board.c b/board/silica/pengwyn/board.c
index 1f5a5868cb..057691b045 100644
--- a/board/silica/pengwyn/board.c
+++ b/board/silica/pengwyn/board.c
@@ -184,7 +184,7 @@ int board_eth_init(bd_t *bis)
 		mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
 		if (is_valid_ethaddr(mac_addr))
-			eth_setenv_enetaddr("ethaddr", mac_addr);
+			eth_env_set_enetaddr("ethaddr", mac_addr);
 		else
 			return n;
 	}
diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c
index 1ccdfa8e05..7e59fb259e 100644
--- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
+++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
@@ -376,14 +376,14 @@ int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 	if (is_hummingboard())
-		setenv("board_name", "HUMMINGBOARD");
+		env_set("board_name", "HUMMINGBOARD");
 	else
-		setenv("board_name", "CUBOXI");
+		env_set("board_name", "CUBOXI");
 
 	if (is_mx6dq())
-		setenv("board_rev", "MX6Q");
+		env_set("board_rev", "MX6Q");
 	else
-		setenv("board_rev", "MX6DL");
+		env_set("board_rev", "MX6DL");
 #endif
 
 	return 0;
diff --git a/board/spear/common/spr_misc.c b/board/spear/common/spr_misc.c
index d6a84dba60..67de28e7ea 100644
--- a/board/spear/common/spr_misc.c
+++ b/board/spear/common/spr_misc.c
@@ -54,14 +54,14 @@ int misc_init_r(void)
 	uchar mac_id[6];
 
 	if (!eth_getenv_enetaddr("ethaddr", mac_id) && !i2c_read_mac(mac_id))
-		eth_setenv_enetaddr("ethaddr", mac_id);
+		eth_env_set_enetaddr("ethaddr", mac_id);
 #endif
-	setenv("verify", "n");
+	env_set("verify", "n");
 
 #if defined(CONFIG_SPEAR_USBTTY)
-	setenv("stdin", "usbtty");
-	setenv("stdout", "usbtty");
-	setenv("stderr", "usbtty");
+	env_set("stdin", "usbtty");
+	env_set("stdout", "usbtty");
+	env_set("stderr", "usbtty");
 
 #ifndef CONFIG_SYS_NO_DCACHE
 	dcache_enable();
diff --git a/board/st/stm32f429-discovery/stm32f429-discovery.c b/board/st/stm32f429-discovery/stm32f429-discovery.c
index 8c8abf6a06..673e7728f1 100644
--- a/board/st/stm32f429-discovery/stm32f429-discovery.c
+++ b/board/st/stm32f429-discovery/stm32f429-discovery.c
@@ -320,7 +320,7 @@ int misc_init_r(void)
 		u_id_high = readl(&STM32_U_ID->u_id_high);
 		sprintf(serialno, "%08x%08x%08x",
 			u_id_high, u_id_mid, u_id_low);
-		setenv("serial#", serialno);
+		env_set("serial#", serialno);
 	}
 
 	return 0;
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 800f412b38..26732dc40f 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -646,7 +646,7 @@ static void parse_spl_header(const uint32_t spl_addr)
 		return;
 	}
 	/* otherwise assume .scr format (mkimage-type script) */
-	setenv_hex("fel_scriptaddr", spl->fel_script_address);
+	env_set_hex("fel_scriptaddr", spl->fel_script_address);
 }
 
 /*
@@ -705,14 +705,14 @@ static void setup_environment(const void *fdt)
 			mac_addr[4] = (sid[3] >>  8) & 0xff;
 			mac_addr[5] = (sid[3] >>  0) & 0xff;
 
-			eth_setenv_enetaddr(ethaddr, mac_addr);
+			eth_env_set_enetaddr(ethaddr, mac_addr);
 		}
 
 		if (!getenv("serial#")) {
 			snprintf(serial_string, sizeof(serial_string),
 				"%08x%08x", sid[0], sid[3]);
 
-			setenv("serial#", serial_string);
+			env_set("serial#", serial_string);
 		}
 	}
 }
@@ -721,11 +721,11 @@ int misc_init_r(void)
 {
 	__maybe_unused int ret;
 
-	setenv("fel_booted", NULL);
-	setenv("fel_scriptaddr", NULL);
+	env_set("fel_booted", NULL);
+	env_set("fel_scriptaddr", NULL);
 	/* determine if we are running in FEL mode */
 	if (!is_boot0_magic(SPL_ADDR + 4)) { /* eGON.BT0 */
-		setenv("fel_booted", "1");
+		env_set("fel_booted", "1");
 		parse_spl_header(SPL_ADDR);
 	}
 
diff --git a/board/syteco/zmx25/zmx25.c b/board/syteco/zmx25/zmx25.c
index bdbf02a067..e02dcf2995 100644
--- a/board/syteco/zmx25/zmx25.c
+++ b/board/syteco/zmx25/zmx25.c
@@ -156,9 +156,9 @@ int board_late_init(void)
 				gpio_set_value(IMX_GPIO_NR(1, 29), 0);
 				gpio_set_value(IMX_GPIO_NR(4, 21), 0);
 
-				setenv("preboot", "run gs_slow_boot");
+				env_set("preboot", "run gs_slow_boot");
 			} else
-				setenv("preboot", "run gs_fast_boot");
+				env_set("preboot", "run gs_fast_boot");
 		}
 	}
 
diff --git a/board/tcl/sl50/board.c b/board/tcl/sl50/board.c
index d3c953e993..cc65c7b84b 100644
--- a/board/tcl/sl50/board.c
+++ b/board/tcl/sl50/board.c
@@ -326,7 +326,7 @@ int board_eth_init(bd_t *bis)
 		printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
 		if (is_valid_ethaddr(mac_addr))
-			eth_setenv_enetaddr("ethaddr", mac_addr);
+			eth_env_set_enetaddr("ethaddr", mac_addr);
 	}
 
 #ifdef CONFIG_DRIVER_TI_CPSW
@@ -342,7 +342,7 @@ int board_eth_init(bd_t *bis)
 
 	if (!getenv("eth1addr")) {
 		if (is_valid_ethaddr(mac_addr))
-			eth_setenv_enetaddr("eth1addr", mac_addr);
+			eth_env_set_enetaddr("eth1addr", mac_addr);
 	}
 
 
@@ -373,7 +373,7 @@ int board_eth_init(bd_t *bis)
 #if defined(CONFIG_USB_ETHER) && \
 	(!defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_USBETH_SUPPORT))
 	if (is_valid_ether_addr(mac_addr))
-		eth_setenv_enetaddr("usbnet_devaddr", mac_addr);
+		eth_env_set_enetaddr("usbnet_devaddr", mac_addr);
 
 	rv = usb_eth_initialize(bis);
 	if (rv < 0)
diff --git a/board/technologic/ts4800/ts4800.c b/board/technologic/ts4800/ts4800.c
index 94251c6d91..8fe26a75e8 100644
--- a/board/technologic/ts4800/ts4800.c
+++ b/board/technologic/ts4800/ts4800.c
@@ -178,7 +178,7 @@ static int fec_get_mac_from_register(uint32_t base_addr)
 		ethaddr[i] = (reg_mac[i / 4] >> ((i % 4) * 8)) & 0xFF;
 
 	if (is_valid_ethaddr(ethaddr)) {
-		eth_setenv_enetaddr("ethaddr", ethaddr);
+		eth_env_set_enetaddr("ethaddr", ethaddr);
 		return 0;
 	}
 
diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
index 36e9cd7f84..d8c8083e16 100644
--- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c
+++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
@@ -98,7 +98,7 @@ static void setup_macaddr(void)
 	/* Make this a valid MAC address and set it */
 	mac_addr[0] &= 0xfe;  /* clear multicast bit */
 	mac_addr[0] |= 0x02;  /* set local assignment bit (IEEE802) */
-	eth_setenv_enetaddr("ethaddr", mac_addr);
+	eth_env_set_enetaddr("ethaddr", mac_addr);
 #endif
 
 	return;
@@ -150,8 +150,8 @@ static void setup_serial(void)
 	serialno |= (u64)crc32_no_comp(serialno, high, 8) << 32;
 	snprintf(serialno_str, sizeof(serialno_str), "%llx", serialno);
 
-	setenv("cpuid#", cpuid_str);
-	setenv("serial#", serialno_str);
+	env_set("cpuid#", cpuid_str);
+	env_set("serial#", serialno_str);
 #endif
 
 	return;
diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
index ac0592b725..7bdbc89d5e 100644
--- a/board/ti/am335x/board.c
+++ b/board/ti/am335x/board.c
@@ -731,7 +731,7 @@ int board_late_init(void)
 	 * on HS devices.
 	 */
 	if (get_device_type() == HS_DEVICE)
-		setenv("boot_fit", "1");
+		env_set("boot_fit", "1");
 #endif
 
 #if !defined(CONFIG_SPL_BUILD)
@@ -749,7 +749,7 @@ int board_late_init(void)
 		printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
 		if (is_valid_ethaddr(mac_addr))
-			eth_setenv_enetaddr("ethaddr", mac_addr);
+			eth_env_set_enetaddr("ethaddr", mac_addr);
 	}
 
 	mac_lo = readl(&cdev->macid1l);
@@ -763,7 +763,7 @@ int board_late_init(void)
 
 	if (!getenv("eth1addr")) {
 		if (is_valid_ethaddr(mac_addr))
-			eth_setenv_enetaddr("eth1addr", mac_addr);
+			eth_env_set_enetaddr("eth1addr", mac_addr);
 	}
 #endif
 
@@ -908,7 +908,7 @@ int board_eth_init(bd_t *bis)
 #if defined(CONFIG_USB_ETHER) && \
 	(!defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_USBETH_SUPPORT))
 	if (is_valid_ethaddr(mac_addr))
-		eth_setenv_enetaddr("usbnet_devaddr", mac_addr);
+		eth_env_set_enetaddr("usbnet_devaddr", mac_addr);
 
 	rv = usb_eth_initialize(bis);
 	if (rv < 0)
diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c
index 933596d59c..933ff31a8e 100644
--- a/board/ti/am43xx/board.c
+++ b/board/ti/am43xx/board.c
@@ -626,7 +626,7 @@ int board_late_init(void)
 	 * on HS devices.
 	 */
 	if (get_device_type() == HS_DEVICE)
-		setenv("boot_fit", "1");
+		env_set("boot_fit", "1");
 #endif
 	return 0;
 }
@@ -794,7 +794,7 @@ int board_eth_init(bd_t *bis)
 	if (!getenv("ethaddr")) {
 		puts("<ethaddr> not set. Validating first E-fuse MAC\n");
 		if (is_valid_ethaddr(mac_addr))
-			eth_setenv_enetaddr("ethaddr", mac_addr);
+			eth_env_set_enetaddr("ethaddr", mac_addr);
 	}
 
 	mac_lo = readl(&cdev->macid1l);
@@ -808,7 +808,7 @@ int board_eth_init(bd_t *bis)
 
 	if (!getenv("eth1addr")) {
 		if (is_valid_ethaddr(mac_addr))
-			eth_setenv_enetaddr("eth1addr", mac_addr);
+			eth_env_set_enetaddr("eth1addr", mac_addr);
 	}
 
 	if (board_is_eposevm()) {
diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c
index e4f1681860..b656f88163 100644
--- a/board/ti/am57xx/board.c
+++ b/board/ti/am57xx/board.c
@@ -588,7 +588,7 @@ void am57x_idk_lcd_detect(void)
 		/* we will let default be "no lcd" */
 	}
 out:
-	setenv("idk_lcd", idk_lcd);
+	env_set("idk_lcd", idk_lcd);
 	return;
 }
 
@@ -608,7 +608,7 @@ int board_late_init(void)
 	 * on HS devices.
 	 */
 	if (get_device_type() == HS_DEVICE)
-		setenv("boot_fit", "1");
+		env_set("boot_fit", "1");
 
 	/*
 	 * Set the GPIO7 Pad to POWERHOLD. This has higher priority
@@ -932,7 +932,7 @@ int board_eth_init(bd_t *bis)
 		printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
 		if (is_valid_ethaddr(mac_addr))
-			eth_setenv_enetaddr("ethaddr", mac_addr);
+			eth_env_set_enetaddr("ethaddr", mac_addr);
 	}
 
 	mac_lo = readl((*ctrl)->control_core_mac_id_1_lo);
@@ -946,7 +946,7 @@ int board_eth_init(bd_t *bis)
 
 	if (!getenv("eth1addr")) {
 		if (is_valid_ethaddr(mac_addr))
-			eth_setenv_enetaddr("eth1addr", mac_addr);
+			eth_env_set_enetaddr("eth1addr", mac_addr);
 	}
 
 	ctrl_val = readl((*ctrl)->control_core_control_io1) & (~0x33);
@@ -981,9 +981,9 @@ int board_eth_init(bd_t *bis)
 			for (i = 0; i < num_macs; i++) {
 				u64_to_mac(mac1 + i, mac_addr);
 				if (is_valid_ethaddr(mac_addr)) {
-					eth_setenv_enetaddr_by_index("eth",
-								     i + 2,
-								     mac_addr);
+					eth_env_set_enetaddr_by_index("eth",
+								      i + 2,
+								      mac_addr);
 				}
 			}
 		}
diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c
index 887b577b6a..2f62fbec69 100644
--- a/board/ti/beagle/beagle.c
+++ b/board/ti/beagle/beagle.c
@@ -341,16 +341,16 @@ int misc_init_r(void)
 	switch (get_board_revision()) {
 	case REVISION_AXBX:
 		printf("Beagle Rev Ax/Bx\n");
-		setenv("beaglerev", "AxBx");
+		env_set("beaglerev", "AxBx");
 		break;
 	case REVISION_CX:
 		printf("Beagle Rev C1/C2/C3\n");
-		setenv("beaglerev", "Cx");
+		env_set("beaglerev", "Cx");
 		MUX_BEAGLE_C();
 		break;
 	case REVISION_C4:
 		printf("Beagle Rev C4\n");
-		setenv("beaglerev", "C4");
+		env_set("beaglerev", "C4");
 		MUX_BEAGLE_C();
 		/* Set VAUX2 to 1.8V for EHCI PHY */
 		twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
@@ -360,7 +360,7 @@ int misc_init_r(void)
 		break;
 	case REVISION_XM_AB:
 		printf("Beagle xM Rev A/B\n");
-		setenv("beaglerev", "xMAB");
+		env_set("beaglerev", "xMAB");
 		MUX_BEAGLE_XM();
 		/* Set VAUX2 to 1.8V for EHCI PHY */
 		twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
@@ -371,7 +371,7 @@ int misc_init_r(void)
 		break;
 	case REVISION_XM_C:
 		printf("Beagle xM Rev C\n");
-		setenv("beaglerev", "xMC");
+		env_set("beaglerev", "xMC");
 		MUX_BEAGLE_XM();
 		/* Set VAUX2 to 1.8V for EHCI PHY */
 		twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
@@ -397,14 +397,14 @@ int misc_init_r(void)
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		MUX_TINCANTOOLS_ZIPPY();
-		setenv("buddy", "zippy");
+		env_set("buddy", "zippy");
 		break;
 	case TINCANTOOLS_ZIPPY2:
 		printf("Recognized Tincantools Zippy2 board (rev %d %s)\n",
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		MUX_TINCANTOOLS_ZIPPY();
-		setenv("buddy", "zippy2");
+		env_set("buddy", "zippy2");
 		break;
 	case TINCANTOOLS_TRAINER:
 		printf("Recognized Tincantools Trainer board (rev %d %s)\n",
@@ -412,37 +412,37 @@ int misc_init_r(void)
 			expansion_config.fab_revision);
 		MUX_TINCANTOOLS_ZIPPY();
 		MUX_TINCANTOOLS_TRAINER();
-		setenv("buddy", "trainer");
+		env_set("buddy", "trainer");
 		break;
 	case TINCANTOOLS_SHOWDOG:
 		printf("Recognized Tincantools Showdow board (rev %d %s)\n",
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		/* Place holder for DSS2 definition for showdog lcd */
-		setenv("defaultdisplay", "showdoglcd");
-		setenv("buddy", "showdog");
+		env_set("defaultdisplay", "showdoglcd");
+		env_set("buddy", "showdog");
 		break;
 	case KBADC_BEAGLEFPGA:
 		printf("Recognized KBADC Beagle FPGA board\n");
 		MUX_KBADC_BEAGLEFPGA();
-		setenv("buddy", "beaglefpga");
+		env_set("buddy", "beaglefpga");
 		break;
 	case LW_BEAGLETOUCH:
 		printf("Recognized Liquidware BeagleTouch board\n");
-		setenv("buddy", "beagletouch");
+		env_set("buddy", "beagletouch");
 		break;
 	case BRAINMUX_LCDOG:
 		printf("Recognized Brainmux LCDog board\n");
-		setenv("buddy", "lcdog");
+		env_set("buddy", "lcdog");
 		break;
 	case BRAINMUX_LCDOGTOUCH:
 		printf("Recognized Brainmux LCDog Touch board\n");
-		setenv("buddy", "lcdogtouch");
+		env_set("buddy", "lcdogtouch");
 		break;
 	case BBTOYS_WIFI:
 		printf("Recognized BeagleBoardToys WiFi board\n");
 		MUX_BBTOYS_WIFI()
-		setenv("buddy", "bbtoys-wifi");
+		env_set("buddy", "bbtoys-wifi");
 		break;
 	case BBTOYS_VGA:
 		printf("Recognized BeagleBoardToys VGA board\n");
@@ -459,20 +459,20 @@ int misc_init_r(void)
 	case LSR_COM6L_ADPT:
 		printf("Recognized LSR COM6L Adapter Board\n");
 		MUX_BBTOYS_WIFI()
-		setenv("buddy", "lsr-com6l-adpt");
+		env_set("buddy", "lsr-com6l-adpt");
 		break;
 	case BEAGLE_NO_EEPROM:
 		printf("No EEPROM on expansion board\n");
-		setenv("buddy", "none");
+		env_set("buddy", "none");
 		break;
 	default:
 		printf("Unrecognized expansion board: %x\n",
 			expansion_config.device_vendor);
-		setenv("buddy", "unknown");
+		env_set("buddy", "unknown");
 	}
 
 	if (expansion_config.content == 1)
-		setenv(expansion_config.env_var, expansion_config.env_setting);
+		env_set(expansion_config.env_var, expansion_config.env_setting);
 
 	twl4030_power_init();
 	switch (get_board_revision()) {
diff --git a/board/ti/common/board_detect.c b/board/ti/common/board_detect.c
index 1da5ace923..6f07ec331a 100644
--- a/board/ti/common/board_detect.c
+++ b/board/ti/common/board_detect.c
@@ -379,21 +379,21 @@ void __maybe_unused set_board_info_env(char *name)
 	struct ti_common_eeprom *ep = TI_EEPROM_DATA;
 
 	if (name)
-		setenv("board_name", name);
+		env_set("board_name", name);
 	else if (ep->name)
-		setenv("board_name", ep->name);
+		env_set("board_name", ep->name);
 	else
-		setenv("board_name", unknown);
+		env_set("board_name", unknown);
 
 	if (ep->version)
-		setenv("board_rev", ep->version);
+		env_set("board_rev", ep->version);
 	else
-		setenv("board_rev", unknown);
+		env_set("board_rev", unknown);
 
 	if (ep->serial)
-		setenv("board_serial", ep->serial);
+		env_set("board_serial", ep->serial);
 	else
-		setenv("board_serial", unknown);
+		env_set("board_serial", unknown);
 }
 
 static u64 mac_to_u64(u8 mac[6])
@@ -451,8 +451,8 @@ void board_ti_set_ethaddr(int index)
 		for (i = 0; i < num_macs; i++) {
 			u64_to_mac(mac1 + i, mac_addr);
 			if (is_valid_ethaddr(mac_addr)) {
-				eth_setenv_enetaddr_by_index("eth", i + index,
-							     mac_addr);
+				eth_env_set_enetaddr_by_index("eth", i + index,
+							      mac_addr);
 			}
 		}
 	}
diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
index 23be2c70e4..4252074e74 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -558,7 +558,7 @@ int board_late_init(void)
 	 * on HS devices.
 	 */
 	if (get_device_type() == HS_DEVICE)
-		setenv("boot_fit", "1");
+		env_set("boot_fit", "1");
 
 	omap_die_id_serial();
 	omap_set_fastboot_vars();
@@ -897,7 +897,7 @@ int board_eth_init(bd_t *bis)
 		printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
 		if (is_valid_ethaddr(mac_addr))
-			eth_setenv_enetaddr("ethaddr", mac_addr);
+			eth_env_set_enetaddr("ethaddr", mac_addr);
 	}
 
 	mac_lo = readl((*ctrl)->control_core_mac_id_1_lo);
@@ -911,7 +911,7 @@ int board_eth_init(bd_t *bis)
 
 	if (!getenv("eth1addr")) {
 		if (is_valid_ethaddr(mac_addr))
-			eth_setenv_enetaddr("eth1addr", mac_addr);
+			eth_env_set_enetaddr("eth1addr", mac_addr);
 	}
 
 	ctrl_val = readl((*ctrl)->control_core_control_io1) & (~0x33);
diff --git a/board/ti/evm/evm.c b/board/ti/evm/evm.c
index fe8e79312f..ac8e093e5a 100644
--- a/board/ti/evm/evm.c
+++ b/board/ti/evm/evm.c
@@ -248,7 +248,7 @@ int board_eth_init(bd_t *bis)
 	if (!eth_getenv_enetaddr(STR_ENV_ETHADDR, eth_addr)) {
 		dev = eth_get_dev_by_index(0);
 		if (dev) {
-			eth_setenv_enetaddr(STR_ENV_ETHADDR, dev->enetaddr);
+			eth_env_set_enetaddr(STR_ENV_ETHADDR, dev->enetaddr);
 		} else {
 			printf("omap3evm: Couldn't get eth device\n");
 			rc = -1;
diff --git a/board/ti/ks2_evm/board_k2g.c b/board/ti/ks2_evm/board_k2g.c
index 21605762ef..15f0f54af6 100644
--- a/board/ti/ks2_evm/board_k2g.c
+++ b/board/ti/ks2_evm/board_k2g.c
@@ -310,9 +310,9 @@ int board_late_init(void)
 
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 	if (board_is_k2g_gp())
-		setenv("board_name", "66AK2GGP\0");
+		env_set("board_name", "66AK2GGP\0");
 	else if (board_is_k2g_ice())
-		setenv("board_name", "66AK2GIC\0");
+		env_set("board_name", "66AK2GIC\0");
 #endif
 	return 0;
 }
diff --git a/board/ti/panda/panda.c b/board/ti/panda/panda.c
index 6ffb53c4c6..c59e58a82a 100644
--- a/board/ti/panda/panda.c
+++ b/board/ti/panda/panda.c
@@ -103,7 +103,7 @@ int get_board_revision(void)
 		board_id4 = gpio_get_value(PANDA_ES_BOARD_ID_4_GPIO);
 
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-		setenv("board_name", "panda-es");
+		env_set("board_name", "panda-es");
 #endif
 		board_id = ((board_id4 << 4) | (board_id3 << 3) |
 			(board_id2 << 2) | (board_id1 << 1) | (board_id0));
@@ -117,7 +117,7 @@ int get_board_revision(void)
 
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 		if ((board_id >= 0x3) && (processor_rev == OMAP4430_ES2_3))
-			setenv("board_name", "panda-a4");
+			env_set("board_name", "panda-a4");
 #endif
 	}
 
diff --git a/board/ti/ti814x/evm.c b/board/ti/ti814x/evm.c
index 055a29d9c6..38f9c57606 100644
--- a/board/ti/ti814x/evm.c
+++ b/board/ti/ti814x/evm.c
@@ -179,7 +179,7 @@ int board_eth_init(bd_t *bis)
 		mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
 		if (is_valid_ethaddr(mac_addr))
-			eth_setenv_enetaddr("ethaddr", mac_addr);
+			eth_env_set_enetaddr("ethaddr", mac_addr);
 		else
 			printf("Unable to read MAC address. Set <ethaddr>\n");
 	}
diff --git a/board/ti/ti816x/evm.c b/board/ti/ti816x/evm.c
index 9d6c3d6b5d..1a8fe27c9f 100644
--- a/board/ti/ti816x/evm.c
+++ b/board/ti/ti816x/evm.c
@@ -51,7 +51,7 @@ int board_eth_init(bd_t *bis)
 		mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
 		if (is_valid_ethaddr(mac_addr))
-			eth_setenv_enetaddr("ethaddr", mac_addr);
+			eth_env_set_enetaddr("ethaddr", mac_addr);
 		else
 			printf("Unable to read MAC address. Set <ethaddr>\n");
 	}
diff --git a/board/timll/devkit8000/devkit8000.c b/board/timll/devkit8000/devkit8000.c
index d31eeb878a..2f80d15666 100644
--- a/board/timll/devkit8000/devkit8000.c
+++ b/board/timll/devkit8000/devkit8000.c
@@ -111,7 +111,7 @@ int misc_init_r(void)
 		enetaddr[3] = (die_id_0 & 0x00ff0000) >> 16;
 		enetaddr[4] = (die_id_0 & 0x0000ff00) >> 8;
 		enetaddr[5] = (die_id_0 & 0x000000ff);
-		eth_setenv_enetaddr("ethaddr", enetaddr);
+		eth_env_set_enetaddr("ethaddr", enetaddr);
 	}
 #endif
 
diff --git a/board/toradex/apalis_imx6/apalis_imx6.c b/board/toradex/apalis_imx6/apalis_imx6.c
index e41547bbee..86a7a159e8 100644
--- a/board/toradex/apalis_imx6/apalis_imx6.c
+++ b/board/toradex/apalis_imx6/apalis_imx6.c
@@ -804,7 +804,7 @@ int board_late_init(void)
 
 	rev = get_board_rev();
 	snprintf(env_str, ARRAY_SIZE(env_str), "%.4x", rev);
-	setenv("board_rev", env_str);
+	env_set("board_rev", env_str);
 
 #ifndef CONFIG_TDX_APALIS_IMX6_V1_0
 	if ((rev & 0xfff0) == 0x0100) {
@@ -816,7 +816,7 @@ int board_late_init(void)
 		/* if using the default device tree, use version for V1.0 HW */
 		fdt_env = getenv("fdt_file");
 		if ((fdt_env != NULL) && (strcmp(FDT_FILE, fdt_env) == 0)) {
-			setenv("fdt_file", FDT_FILE_V1_0);
+			env_set("fdt_file", FDT_FILE_V1_0);
 			printf("patching fdt_file to " FDT_FILE_V1_0 "\n");
 #ifndef CONFIG_ENV_IS_NOWHERE
 			env_save();
diff --git a/board/toradex/colibri_imx6/colibri_imx6.c b/board/toradex/colibri_imx6/colibri_imx6.c
index cbf7aa952a..dbcd233782 100644
--- a/board/toradex/colibri_imx6/colibri_imx6.c
+++ b/board/toradex/colibri_imx6/colibri_imx6.c
@@ -676,7 +676,7 @@ int board_late_init(void)
 
 	rev = get_board_rev();
 	snprintf(env_str, ARRAY_SIZE(env_str), "%.4x", rev);
-	setenv("board_rev", env_str);
+	env_set("board_rev", env_str);
 #endif
 
 	return 0;
diff --git a/board/toradex/colibri_vf/colibri_vf.c b/board/toradex/colibri_vf/colibri_vf.c
index 46dd15bac8..3858af9c40 100644
--- a/board/toradex/colibri_vf/colibri_vf.c
+++ b/board/toradex/colibri_vf/colibri_vf.c
@@ -535,7 +535,7 @@ int board_late_init(void)
 	if (((src->sbmr2 & SRC_SBMR2_BMOD_MASK) >> SRC_SBMR2_BMOD_SHIFT)
 			== SRC_SBMR2_BMOD_SERIAL) {
 		printf("Serial Downloader recovery mode, disable autoboot\n");
-		setenv("bootdelay", "-1");
+		env_set("bootdelay", "-1");
 	}
 
 	return 0;
diff --git a/board/toradex/common/tdx-common.c b/board/toradex/common/tdx-common.c
index 0d267877fa..78b2bc0c2b 100644
--- a/board/toradex/common/tdx-common.c
+++ b/board/toradex/common/tdx-common.c
@@ -80,14 +80,14 @@ int show_board_info(void)
 		tdx_hw_tag.ver_minor,
 		(char)tdx_hw_tag.ver_assembly + 'A');
 
-	setenv("serial#", tdx_serial_str);
+	env_set("serial#", tdx_serial_str);
 
 	/*
 	 * Check if environment contains a valid MAC address,
 	 * set the one from config block if not
 	 */
 	if (!eth_getenv_enetaddr("ethaddr", ethaddr))
-		eth_setenv_enetaddr("ethaddr", (u8 *)&tdx_eth_addr);
+		eth_env_set_enetaddr("ethaddr", (u8 *)&tdx_eth_addr);
 
 #ifdef CONFIG_TDX_CFG_BLOCK_2ND_ETHADDR
 	if (!eth_getenv_enetaddr("eth1addr", ethaddr)) {
@@ -97,7 +97,7 @@ int show_board_info(void)
 		 */
 		memcpy(ethaddr, &tdx_eth_addr, 6);
 		ethaddr[3] += 0x10;
-		eth_setenv_enetaddr("eth1addr", ethaddr);
+		eth_env_set_enetaddr("eth1addr", ethaddr);
 	}
 #endif
 
diff --git a/board/tqc/tqma6/tqma6.c b/board/tqc/tqma6/tqma6.c
index fcdea34f05..14991fdb00 100644
--- a/board/tqc/tqma6/tqma6.c
+++ b/board/tqc/tqma6/tqma6.c
@@ -251,7 +251,7 @@ int power_init_board(void)
 
 int board_late_init(void)
 {
-	setenv("board_name", tqma6_get_boardname());
+	env_set("board_name", tqma6_get_boardname());
 
 	tqma6_bb_board_late_init();
 
diff --git a/board/udoo/neo/neo.c b/board/udoo/neo/neo.c
index 276c625cfd..7fa1289de0 100644
--- a/board/udoo/neo/neo.c
+++ b/board/udoo/neo/neo.c
@@ -437,7 +437,7 @@ int checkboard(void)
 int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-	setenv("board_name", board_string());
+	env_set("board_name", board_string());
 #endif
 
 	return 0;
diff --git a/board/udoo/udoo.c b/board/udoo/udoo.c
index 7534935dde..a359626b81 100644
--- a/board/udoo/udoo.c
+++ b/board/udoo/udoo.c
@@ -255,9 +255,9 @@ int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 	if (is_cpu_type(MXC_CPU_MX6Q))
-		setenv("board_rev", "MX6Q");
+		env_set("board_rev", "MX6Q");
 	else
-		setenv("board_rev", "MX6DL");
+		env_set("board_rev", "MX6DL");
 #endif
 	return 0;
 }
diff --git a/board/varisys/common/sys_eeprom.c b/board/varisys/common/sys_eeprom.c
index b55ab818e6..d235897311 100644
--- a/board/varisys/common/sys_eeprom.c
+++ b/board/varisys/common/sys_eeprom.c
@@ -401,7 +401,7 @@ int mac_read_from_generic_eeprom(const char *envvar, int chip,
 			mac[5]);
 
 		printf("MAC: %s\n", ethaddr);
-		setenv(envvar, ethaddr);
+		env_set(envvar, ethaddr);
 	}
 
 	return ret;
@@ -487,7 +487,7 @@ int mac_read_from_eeprom_common(void)
 			 * (i.e. have not yet been set)
 			 */
 			if (!getenv(enetvar))
-				setenv(enetvar, ethaddr);
+				env_set(enetvar, ethaddr);
 		}
 	}
 
diff --git a/board/vscom/baltos/board.c b/board/vscom/baltos/board.c
index d3b1f1564f..2e3baeb118 100644
--- a/board/vscom/baltos/board.c
+++ b/board/vscom/baltos/board.c
@@ -68,7 +68,7 @@ static int baltos_set_console(void)
 	printf("DIPs: 0x%1x\n", (~dips) & 0xf);
 
 	if ((dips & 0xf) == 0xe)
-		setenv("console", "ttyUSB0,115200n8");
+		env_set("console", "ttyUSB0,115200n8");
 
 	return 0;
 }
@@ -373,7 +373,7 @@ int board_late_init(void)
 		return -ENODEV;
 	}
 
-	setenv("board_name", model);
+	env_set("board_name", model);
 #endif
 
 	return 0;
@@ -457,7 +457,7 @@ int board_eth_init(bd_t *bis)
 		printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
 		if (is_valid_ethaddr(mac_addr))
-			eth_setenv_enetaddr("ethaddr", mac_addr);
+			eth_env_set_enetaddr("ethaddr", mac_addr);
 	}
 
 #ifdef CONFIG_DRIVER_TI_CPSW
diff --git a/board/wandboard/wandboard.c b/board/wandboard/wandboard.c
index 1dbc966b6e..adfcf48562 100644
--- a/board/wandboard/wandboard.c
+++ b/board/wandboard/wandboard.c
@@ -425,14 +425,14 @@ int board_late_init(void)
 
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 	if (is_mx6dq())
-		setenv("board_rev", "MX6Q");
+		env_set("board_rev", "MX6Q");
 	else
-		setenv("board_rev", "MX6DL");
+		env_set("board_rev", "MX6DL");
 
 	if (is_revc1())
-		setenv("board_name", "C1");
+		env_set("board_name", "C1");
 	else
-		setenv("board_name", "B1");
+		env_set("board_name", "B1");
 #endif
 	return 0;
 }
diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c
index b2fbecf6de..90ef542458 100644
--- a/board/xilinx/zynq/board.c
+++ b/board/xilinx/zynq/board.c
@@ -86,22 +86,22 @@ int board_late_init(void)
 {
 	switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) {
 	case ZYNQ_BM_QSPI:
-		setenv("modeboot", "qspiboot");
+		env_set("modeboot", "qspiboot");
 		break;
 	case ZYNQ_BM_NAND:
-		setenv("modeboot", "nandboot");
+		env_set("modeboot", "nandboot");
 		break;
 	case ZYNQ_BM_NOR:
-		setenv("modeboot", "norboot");
+		env_set("modeboot", "norboot");
 		break;
 	case ZYNQ_BM_SD:
-		setenv("modeboot", "sdboot");
+		env_set("modeboot", "sdboot");
 		break;
 	case ZYNQ_BM_JTAG:
-		setenv("modeboot", "jtagboot");
+		env_set("modeboot", "jtagboot");
 		break;
 	default:
-		setenv("modeboot", "");
+		env_set("modeboot", "");
 		break;
 	}
 
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index 51a3d9f276..89ab24417d 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -285,7 +285,7 @@ int board_late_init(void)
 				strlen(getenv("boot_targets")) + 2);
 
 	sprintf(new_targets, "%s %s", mode, getenv("boot_targets"));
-	setenv("boot_targets", new_targets);
+	env_set("boot_targets", new_targets);
 
 	return 0;
 }
diff --git a/cmd/cbfs.c b/cmd/cbfs.c
index 95a11a3616..799ba01fcc 100644
--- a/cmd/cbfs.c
+++ b/cmd/cbfs.c
@@ -80,7 +80,7 @@ static int do_cbfs_fsload(cmd_tbl_t *cmdtp, int flag, int argc,
 
 	printf("\n%ld bytes read\n", size);
 
-	setenv_hex("filesize", size);
+	env_set_hex("filesize", size);
 
 	return 0;
 }
diff --git a/cmd/cramfs.c b/cmd/cramfs.c
index 49ee36c74a..7b23c5b3dd 100644
--- a/cmd/cramfs.c
+++ b/cmd/cramfs.c
@@ -138,7 +138,7 @@ int do_cramfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	if (size > 0) {
 		printf("### CRAMFS load complete: %d bytes loaded to 0x%lx\n",
 			size, offset);
-		setenv_hex("filesize", size);
+		env_set_hex("filesize", size);
 	} else {
 		printf("### CRAMFS LOAD ERROR<%x> for %s!\n", size, filename);
 	}
diff --git a/cmd/fdt.c b/cmd/fdt.c
index 05e19f8a72..eb01a889ad 100644
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -43,21 +43,21 @@ void set_working_fdt_addr(ulong addr)
 
 	buf = map_sysmem(addr, 0);
 	working_fdt = buf;
-	setenv_hex("fdtaddr", addr);
+	env_set_hex("fdtaddr", addr);
 }
 
 /*
  * Get a value from the fdt and format it to be set in the environment
  */
-static int fdt_value_setenv(const void *nodep, int len, const char *var)
+static int fdt_value_env_set(const void *nodep, int len, const char *var)
 {
 	if (is_printable_string(nodep, len))
-		setenv(var, (void *)nodep);
+		env_set(var, (void *)nodep);
 	else if (len == 4) {
 		char buf[11];
 
 		sprintf(buf, "0x%08X", fdt32_to_cpu(*(fdt32_t *)nodep));
-		setenv(var, buf);
+		env_set(var, buf);
 	} else if (len%4 == 0 && len <= 20) {
 		/* Needed to print things like sha1 hashes. */
 		char buf[41];
@@ -66,7 +66,7 @@ static int fdt_value_setenv(const void *nodep, int len, const char *var)
 		for (i = 0; i < len; i += sizeof(unsigned int))
 			sprintf(buf + (i * 2), "%08x",
 				*(unsigned int *)(nodep + i));
-		setenv(var, buf);
+		env_set(var, buf);
 	} else {
 		printf("error: unprintable value\n");
 		return 1;
@@ -358,10 +358,12 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 				if (curDepth == startDepth + 1)
 					curIndex++;
 				if (subcmd[0] == 'n' && curIndex == reqIndex) {
-					const char *nodeName = fdt_get_name(
-					    working_fdt, nextNodeOffset, NULL);
+					const char *node_name;
 
-					setenv(var, (char *)nodeName);
+					node_name = fdt_get_name(working_fdt,
+								 nextNodeOffset,
+								 NULL);
+					env_set(var, node_name);
 					return 0;
 				}
 				nextNodeOffset = fdt_next_node(
@@ -371,7 +373,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			}
 			if (subcmd[0] == 's') {
 				/* get the num nodes at this level */
-				setenv_ulong(var, curIndex + 1);
+				env_set_ulong(var, curIndex + 1);
 			} else {
 				/* node index not found */
 				printf("libfdt node not found\n");
@@ -382,13 +384,14 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 				working_fdt, nodeoffset, prop, &len);
 			if (len == 0) {
 				/* no property value */
-				setenv(var, "");
+				env_set(var, "");
 				return 0;
 			} else if (nodep && len > 0) {
 				if (subcmd[0] == 'v') {
 					int ret;
 
-					ret = fdt_value_setenv(nodep, len, var);
+					ret = fdt_value_env_set(nodep, len,
+								var);
 					if (ret != 0)
 						return ret;
 				} else if (subcmd[0] == 'a') {
@@ -396,13 +399,13 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 					char buf[11];
 
 					sprintf(buf, "0x%p", nodep);
-					setenv(var, buf);
+					env_set(var, buf);
 				} else if (subcmd[0] == 's') {
 					/* Get size */
 					char buf[11];
 
 					sprintf(buf, "0x%08X", len);
-					setenv(var, buf);
+					env_set(var, buf);
 				} else
 					return CMD_RET_USAGE;
 				return 0;
diff --git a/cmd/gpt.c b/cmd/gpt.c
index 3e98821868..cb76d5e540 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -55,7 +55,7 @@ static int extract_env(const char *str, char **env)
 #ifdef CONFIG_RANDOM_UUID
 		debug("%s unset. ", str);
 		gen_rand_uuid_str(uuid_str, UUID_STR_FORMAT_GUID);
-		setenv(s, uuid_str);
+		env_set(s, uuid_str);
 
 		e = getenv(s);
 		if (e) {
diff --git a/cmd/ini.c b/cmd/ini.c
index 727fd1c664..449f6e9f51 100644
--- a/cmd/ini.c
+++ b/cmd/ini.c
@@ -219,7 +219,7 @@ static int ini_handler(void *user, char *section, char *name, char *value)
 		for (i = 0; i < strlen(value); i++)
 			value[i] = tolower(value[i]);
 #endif
-		setenv(name, value);
+		env_set(name, value);
 		printf("ini: Imported %s as %s\n", name, value);
 	}
 
diff --git a/cmd/jffs2.c b/cmd/jffs2.c
index dc94705ccd..add89dee6a 100644
--- a/cmd/jffs2.c
+++ b/cmd/jffs2.c
@@ -512,7 +512,7 @@ int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		if (size > 0) {
 			printf("### %s load complete: %d bytes loaded to 0x%lx\n",
 				fsname, size, offset);
-			setenv_hex("filesize", size);
+			env_set_hex("filesize", size);
 		} else {
 			printf("### %s LOAD ERROR<%x> for %s!\n", fsname, size, filename);
 		}
diff --git a/cmd/load.c b/cmd/load.c
index 4597ec5618..ec3730e0f6 100644
--- a/cmd/load.c
+++ b/cmd/load.c
@@ -182,7 +182,7 @@ static ulong load_serial(long offset)
 			    start_addr, end_addr, size, size
 		    );
 		    flush_cache(start_addr, size);
-		    setenv_hex("filesize", size);
+		    env_set_hex("filesize", size);
 		    return (addr);
 		case SREC_START:
 		    break;
@@ -529,7 +529,7 @@ static ulong load_serial_bin(ulong offset)
 	flush_cache(offset, size);
 
 	printf("## Total Size      = 0x%08x = %d Bytes\n", size, size);
-	setenv_hex("filesize", size);
+	env_set_hex("filesize", size);
 
 	return offset;
 }
@@ -1000,7 +1000,7 @@ static ulong load_serial_ymodem(ulong offset, int mode)
 	flush_cache(offset, ALIGN(size, ARCH_DMA_MINALIGN));
 
 	printf("## Total Size      = 0x%08x = %d Bytes\n", size, size);
-	setenv_hex("filesize", size);
+	env_set_hex("filesize", size);
 
 	return offset;
 }
diff --git a/cmd/lzmadec.c b/cmd/lzmadec.c
index c78df825e8..1b482edb58 100644
--- a/cmd/lzmadec.c
+++ b/cmd/lzmadec.c
@@ -42,7 +42,7 @@ static int do_lzmadec(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 		return 1;
 	printf("Uncompressed size: %ld = %#lX\n", (ulong)src_len,
 	       (ulong)src_len);
-	setenv_hex("filesize", src_len);
+	env_set_hex("filesize", src_len);
 
 	return 0;
 }
diff --git a/cmd/md5sum.c b/cmd/md5sum.c
index 23bb81e88c..1b2352ea55 100644
--- a/cmd/md5sum.c
+++ b/cmd/md5sum.c
@@ -35,7 +35,7 @@ static void store_result(const u8 *sum, const char *dest)
 			sprintf(str_ptr, "%02x", sum[i]);
 			str_ptr += 2;
 		}
-		setenv(dest, str_output);
+		env_set(dest, str_output);
 	}
 }
 
diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c
index 683c48bdad..d3fde77ef0 100644
--- a/cmd/mtdparts.c
+++ b/cmd/mtdparts.c
@@ -239,19 +239,19 @@ static void index_partitions(void)
 			dev = list_entry(dentry, struct mtd_device, link);
 			if (dev == current_mtd_dev) {
 				mtddevnum += current_mtd_partnum;
-				setenv_ulong("mtddevnum", mtddevnum);
+				env_set_ulong("mtddevnum", mtddevnum);
 				break;
 			}
 			mtddevnum += dev->num_parts;
 		}
 
 		part = mtd_part_info(current_mtd_dev, current_mtd_partnum);
-		setenv("mtddevname", part->name);
+		env_set("mtddevname", part->name);
 
 		debug("=> mtddevnum %d,\n=> mtddevname %s\n", mtddevnum, part->name);
 	} else {
-		setenv("mtddevnum", NULL);
-		setenv("mtddevname", NULL);
+		env_set("mtddevnum", NULL);
+		env_set("mtddevname", NULL);
 
 		debug("=> mtddevnum NULL\n=> mtddevname NULL\n");
 	}
@@ -270,12 +270,12 @@ static void current_save(void)
 		sprintf(buf, "%s%d,%d", MTD_DEV_TYPE(current_mtd_dev->id->type),
 					current_mtd_dev->id->num, current_mtd_partnum);
 
-		setenv("partition", buf);
+		env_set("partition", buf);
 		strncpy(last_partition, buf, 16);
 
 		debug("=> partition %s\n", buf);
 	} else {
-		setenv("partition", NULL);
+		env_set("partition", NULL);
 		last_partition[0] = '\0';
 
 		debug("=> partition NULL\n");
@@ -1213,9 +1213,9 @@ static int generate_mtdparts_save(char *buf, u32 buflen)
 	ret = generate_mtdparts(buf, buflen);
 
 	if ((buf[0] != '\0') && (ret == 0))
-		setenv("mtdparts", buf);
+		env_set("mtdparts", buf);
 	else
-		setenv("mtdparts", NULL);
+		env_set("mtdparts", NULL);
 
 	return ret;
 }
@@ -1764,7 +1764,7 @@ int mtdparts_init(void)
 		if (mtdids_default) {
 			debug("mtdids variable not defined, using default\n");
 			ids = mtdids_default;
-			setenv("mtdids", (char *)ids);
+			env_set("mtdids", (char *)ids);
 		} else {
 			printf("mtdids not defined, no default present\n");
 			return 1;
@@ -1780,7 +1780,7 @@ int mtdparts_init(void)
 	if (!parts) {
 		if (mtdparts_default && use_defaults) {
 			parts = mtdparts_default;
-			if (setenv("mtdparts", (char *)parts) == 0)
+			if (env_set("mtdparts", (char *)parts) == 0)
 				use_defaults = 0;
 		} else
 			printf("mtdparts variable not set, see 'help mtdparts'\n");
@@ -1956,9 +1956,9 @@ static int do_mtdparts(cmd_tbl_t *cmdtp, int flag, int argc,
 {
 	if (argc == 2) {
 		if (strcmp(argv[1], "default") == 0) {
-			setenv("mtdids", NULL);
-			setenv("mtdparts", NULL);
-			setenv("partition", NULL);
+			env_set("mtdids", NULL);
+			env_set("mtdparts", NULL);
+			env_set("partition", NULL);
 			use_defaults = 1;
 
 			mtdparts_init();
@@ -1967,7 +1967,7 @@ static int do_mtdparts(cmd_tbl_t *cmdtp, int flag, int argc,
 			/* this may be the first run, initialize lists if needed */
 			mtdparts_init();
 
-			setenv("mtdparts", NULL);
+			env_set("mtdparts", NULL);
 
 			/* mtd_devices_init() calls current_save() */
 			return mtd_devices_init();
diff --git a/cmd/nand.c b/cmd/nand.c
index a2152ec826..0f5d431e5c 100644
--- a/cmd/nand.c
+++ b/cmd/nand.c
@@ -305,9 +305,9 @@ static void nand_print_and_set_info(int idx)
 	printf("  bbt options 0x%08x\n", chip->bbt_options);
 
 	/* Set geometry info */
-	setenv_hex("nand_writesize", mtd->writesize);
-	setenv_hex("nand_oobsize", mtd->oobsize);
-	setenv_hex("nand_erasesize", mtd->erasesize);
+	env_set_hex("nand_writesize", mtd->writesize);
+	env_set_hex("nand_oobsize", mtd->oobsize);
+	env_set_hex("nand_erasesize", mtd->erasesize);
 }
 
 static int raw_access(struct mtd_info *mtd, ulong addr, loff_t off,
diff --git a/cmd/net.c b/cmd/net.c
index df8b6c9b53..fa6d02f90d 100644
--- a/cmd/net.c
+++ b/cmd/net.c
@@ -116,23 +116,23 @@ static void netboot_update_env(void)
 
 	if (net_gateway.s_addr) {
 		ip_to_string(net_gateway, tmp);
-		setenv("gatewayip", tmp);
+		env_set("gatewayip", tmp);
 	}
 
 	if (net_netmask.s_addr) {
 		ip_to_string(net_netmask, tmp);
-		setenv("netmask", tmp);
+		env_set("netmask", tmp);
 	}
 
 	if (net_hostname[0])
-		setenv("hostname", net_hostname);
+		env_set("hostname", net_hostname);
 
 	if (net_root_path[0])
-		setenv("rootpath", net_root_path);
+		env_set("rootpath", net_root_path);
 
 	if (net_ip.s_addr) {
 		ip_to_string(net_ip, tmp);
-		setenv("ipaddr", tmp);
+		env_set("ipaddr", tmp);
 	}
 #if !defined(CONFIG_BOOTP_SERVERIP)
 	/*
@@ -141,32 +141,32 @@ static void netboot_update_env(void)
 	 */
 	if (net_server_ip.s_addr) {
 		ip_to_string(net_server_ip, tmp);
-		setenv("serverip", tmp);
+		env_set("serverip", tmp);
 	}
 #endif
 	if (net_dns_server.s_addr) {
 		ip_to_string(net_dns_server, tmp);
-		setenv("dnsip", tmp);
+		env_set("dnsip", tmp);
 	}
 #if defined(CONFIG_BOOTP_DNS2)
 	if (net_dns_server2.s_addr) {
 		ip_to_string(net_dns_server2, tmp);
-		setenv("dnsip2", tmp);
+		env_set("dnsip2", tmp);
 	}
 #endif
 	if (net_nis_domain[0])
-		setenv("domain", net_nis_domain);
+		env_set("domain", net_nis_domain);
 
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_TIMEOFFSET)
 	if (net_ntp_time_offset) {
 		sprintf(tmp, "%d", net_ntp_time_offset);
-		setenv("timeoffset", tmp);
+		env_set("timeoffset", tmp);
 	}
 #endif
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER)
 	if (net_ntp_server.s_addr) {
 		ip_to_string(net_ntp_server, tmp);
-		setenv("ntpserverip", tmp);
+		env_set("ntpserverip", tmp);
 	}
 #endif
 }
@@ -291,14 +291,14 @@ static void cdp_update_env(void)
 		printf("CDP offered appliance VLAN %d\n",
 		       ntohs(cdp_appliance_vlan));
 		vlan_to_string(cdp_appliance_vlan, tmp);
-		setenv("vlan", tmp);
+		env_set("vlan", tmp);
 		net_our_vlan = cdp_appliance_vlan;
 	}
 
 	if (cdp_native_vlan != htons(-1)) {
 		printf("CDP offered native VLAN %d\n", ntohs(cdp_native_vlan));
 		vlan_to_string(cdp_native_vlan, tmp);
-		setenv("nvlan", tmp);
+		env_set("nvlan", tmp);
 		net_native_vlan = cdp_native_vlan;
 	}
 }
@@ -423,14 +423,14 @@ static int do_link_local(cmd_tbl_t *cmdtp, int flag, int argc,
 
 	net_gateway.s_addr = 0;
 	ip_to_string(net_gateway, tmp);
-	setenv("gatewayip", tmp);
+	env_set("gatewayip", tmp);
 
 	ip_to_string(net_netmask, tmp);
-	setenv("netmask", tmp);
+	env_set("netmask", tmp);
 
 	ip_to_string(net_ip, tmp);
-	setenv("ipaddr", tmp);
-	setenv("llipaddr", tmp); /* store this for next time */
+	env_set("ipaddr", tmp);
+	env_set("llipaddr", tmp); /* store this for next time */
 
 	return CMD_RET_SUCCESS;
 }
diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index 4431ef66d8..a649004850 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -283,7 +283,7 @@ static int _do_env_set(int flag, int argc, char * const argv[], int env_flag)
 	return 0;
 }
 
-int setenv(const char *varname, const char *varvalue)
+int env_set(const char *varname, const char *varvalue)
 {
 	const char * const argv[4] = { "setenv", varname, varvalue, NULL };
 
@@ -304,12 +304,12 @@ int setenv(const char *varname, const char *varvalue)
  * @param value		Value to set it to
  * @return 0 if ok, 1 on error
  */
-int setenv_ulong(const char *varname, ulong value)
+int env_set_ulong(const char *varname, ulong value)
 {
 	/* TODO: this should be unsigned */
 	char *str = simple_itoa(value);
 
-	return setenv(varname, str);
+	return env_set(varname, str);
 }
 
 /**
@@ -319,12 +319,12 @@ int setenv_ulong(const char *varname, ulong value)
  * @param value		Value to set it to
  * @return 0 if ok, 1 on error
  */
-int setenv_hex(const char *varname, ulong value)
+int env_set_hex(const char *varname, ulong value)
 {
 	char str[17];
 
 	sprintf(str, "%lx", value);
-	return setenv(varname, str);
+	return env_set(varname, str);
 }
 
 ulong getenv_hex(const char *varname, ulong default_val)
@@ -931,7 +931,7 @@ NXTARG:		;
 			return 1;
 		}
 		sprintf(buf, "%zX", (size_t)len);
-		setenv("filesize", buf);
+		env_set("filesize", buf);
 
 		return 0;
 	}
@@ -957,7 +957,7 @@ NXTARG:		;
 		envp->flags = ACTIVE_FLAG;
 #endif
 	}
-	setenv_hex("filesize", len + offsetof(env_t, data));
+	env_set_hex("filesize", len + offsetof(env_t, data));
 
 	return 0;
 
diff --git a/cmd/part.c b/cmd/part.c
index 8ba05984e4..746bf40b2d 100644
--- a/cmd/part.c
+++ b/cmd/part.c
@@ -38,7 +38,7 @@ static int do_part_uuid(int argc, char * const argv[])
 		return 1;
 
 	if (argc > 2)
-		setenv(argv[2], info.uuid);
+		env_set(argv[2], info.uuid);
 	else
 		printf("%s\n", info.uuid);
 
@@ -99,7 +99,7 @@ static int do_part_list(int argc, char * const argv[])
 			sprintf(t, "%s%x", str[0] ? " " : "", p);
 			strcat(str, t);
 		}
-		setenv(var, str);
+		env_set(var, str);
 		return 0;
 	}
 
@@ -135,7 +135,7 @@ static int do_part_start(int argc, char * const argv[])
 	snprintf(buf, sizeof(buf), LBAF, info.start);
 
 	if (argc > 3)
-		setenv(argv[3], buf);
+		env_set(argv[3], buf);
 	else
 		printf("%s\n", buf);
 
@@ -169,7 +169,7 @@ static int do_part_size(int argc, char * const argv[])
 	snprintf(buf, sizeof(buf), LBAF, info.size);
 
 	if (argc > 3)
-		setenv(argv[3], buf);
+		env_set(argv[3], buf);
 	else
 		printf("%s\n", buf);
 
diff --git a/cmd/pxe.c b/cmd/pxe.c
index 0a07f14ca8..357b96940c 100644
--- a/cmd/pxe.c
+++ b/cmd/pxe.c
@@ -591,7 +591,7 @@ static int label_localboot(struct pxe_label *label)
 		char bootargs[CONFIG_SYS_CBSIZE];
 
 		cli_simple_process_macros(label->append, bootargs);
-		setenv("bootargs", bootargs);
+		env_set("bootargs", bootargs);
 	}
 
 	debug("running: %s\n", localcmd);
@@ -695,7 +695,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
 		strcat(bootargs, mac_str);
 
 		cli_simple_process_macros(bootargs, finalbootargs);
-		setenv("bootargs", finalbootargs);
+		env_set("bootargs", finalbootargs);
 		printf("append: %s\n", finalbootargs);
 	}
 
@@ -1674,7 +1674,7 @@ static int do_sysboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		filename = getenv("bootfile");
 	else {
 		filename = argv[5];
-		setenv("bootfile", filename);
+		env_set("bootfile", filename);
 	}
 
 	if (strstr(argv[3], "ext2"))
diff --git a/cmd/qfw.c b/cmd/qfw.c
index 12436ec9b4..9b12ab40ca 100644
--- a/cmd/qfw.c
+++ b/cmd/qfw.c
@@ -55,7 +55,7 @@ static int qemu_fwcfg_setup_kernel(void *load_addr, void *initrd_addr)
 		 * when invoking qemu), do not update bootargs
 		 */
 		if (*data_addr != '\0') {
-			if (setenv("bootargs", data_addr) < 0)
+			if (env_set("bootargs", data_addr) < 0)
 				printf("warning: unable to change bootargs\n");
 		}
 	}
diff --git a/cmd/reiser.c b/cmd/reiser.c
index 9c3e9e9e58..4df9c5f5db 100644
--- a/cmd/reiser.c
+++ b/cmd/reiser.c
@@ -157,7 +157,7 @@ int do_reiserload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	load_addr = addr;
 
 	printf ("\n%ld bytes read\n", filelen);
-	setenv_hex("filesize", filelen);
+	env_set_hex("filesize", filelen);
 
 	return filelen;
 }
diff --git a/cmd/setexpr.c b/cmd/setexpr.c
index e7194fc4f4..91a5a9a770 100644
--- a/cmd/setexpr.c
+++ b/cmd/setexpr.c
@@ -282,11 +282,11 @@ static int regex_sub(const char *name,
 		if (!global)
 			break;
 	}
-	debug("## FINAL (now setenv()) :  %s\n", data);
+	debug("## FINAL (now env_set()) :  %s\n", data);
 
 	printf("%s=%s\n", name, data);
 
-	return setenv(name, data);
+	return env_set(name, data);
 }
 #endif
 
@@ -314,7 +314,7 @@ static int do_setexpr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	/* plain assignment: "setexpr name value" */
 	if (argc == 3) {
-		setenv_hex(argv[1], a);
+		env_set_hex(argv[1], a);
 		return 0;
 	}
 
@@ -370,7 +370,7 @@ static int do_setexpr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		return 1;
 	}
 
-	setenv_hex(argv[1], value);
+	env_set_hex(argv[1], value);
 
 	return 0;
 }
diff --git a/cmd/tpm.c b/cmd/tpm.c
index 0c4bc73ca6..d9b433582c 100644
--- a/cmd/tpm.c
+++ b/cmd/tpm.c
@@ -231,7 +231,7 @@ static int type_string_write_vars(const char *type_str, uint8_t *data,
 		default:
 			return -1;
 		}
-		if (setenv_ulong(*vars, value))
+		if (env_set_ulong(*vars, value))
 			return -1;
 	}
 
@@ -624,7 +624,7 @@ static int do_tpm_load_key_by_sha1(cmd_tbl_t *cmdtp, int flag, int argc, char *
 				 &key_handle);
 	if (!err) {
 		printf("Key handle is 0x%x\n", key_handle);
-		setenv_hex("key_handle", key_handle);
+		env_set_hex("key_handle", key_handle);
 	}
 
 	return report_return_code(err);
diff --git a/cmd/trace.c b/cmd/trace.c
index 1a6d8c3047..e6c08e4ba5 100644
--- a/cmd/trace.c
+++ b/cmd/trace.c
@@ -46,9 +46,9 @@ static int create_func_list(int argc, char * const argv[])
 	used = min(avail, (size_t)needed);
 	printf("Function trace dumped to %08lx, size %#zx\n",
 	       (ulong)map_to_sysmem(buff + buff_ptr), used);
-	setenv_hex("profbase", map_to_sysmem(buff));
-	setenv_hex("profsize", buff_size);
-	setenv_hex("profoffset", buff_ptr + used);
+	env_set_hex("profbase", map_to_sysmem(buff));
+	env_set_hex("profsize", buff_size);
+	env_set_hex("profoffset", buff_ptr + used);
 
 	return 0;
 }
@@ -71,9 +71,9 @@ static int create_call_list(int argc, char * const argv[])
 	printf("Call list dumped to %08lx, size %#zx\n",
 	       (ulong)map_to_sysmem(buff + buff_ptr), used);
 
-	setenv_hex("profbase", map_to_sysmem(buff));
-	setenv_hex("profsize", buff_size);
-	setenv_hex("profoffset", buff_ptr + used);
+	env_set_hex("profbase", map_to_sysmem(buff));
+	env_set_hex("profsize", buff_size);
+	env_set_hex("profoffset", buff_ptr + used);
 
 	return 0;
 }
diff --git a/cmd/unzip.c b/cmd/unzip.c
index a8bcb1f529..94f883f92a 100644
--- a/cmd/unzip.c
+++ b/cmd/unzip.c
@@ -29,7 +29,7 @@ static int do_unzip(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		return 1;
 
 	printf("Uncompressed size: %ld = 0x%lX\n", src_len, src_len);
-	setenv_hex("filesize", src_len);
+	env_set_hex("filesize", src_len);
 
 	return 0;
 }
diff --git a/cmd/ximg.c b/cmd/ximg.c
index d033c15b62..50dc00e4f8 100644
--- a/cmd/ximg.c
+++ b/cmd/ximg.c
@@ -251,8 +251,8 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 
 	flush_cache(dest, len);
 
-	setenv_hex("fileaddr", data);
-	setenv_hex("filesize", len);
+	env_set_hex("fileaddr", data);
+	env_set_hex("filesize", len);
 
 	return 0;
 }
diff --git a/cmd/zfs.c b/cmd/zfs.c
index 3ed9912d19..08b0062c10 100644
--- a/cmd/zfs.c
+++ b/cmd/zfs.c
@@ -115,7 +115,7 @@ static int do_zfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
 	load_addr = addr;
 
 	printf("%llu bytes read\n", zfile.size);
-	setenv_hex("filesize", zfile.size);
+	env_set_hex("filesize", zfile.size);
 
 	return 0;
 }
diff --git a/cmd/zip.c b/cmd/zip.c
index 7fcd9d5bf8..dac7527721 100644
--- a/cmd/zip.c
+++ b/cmd/zip.c
@@ -30,7 +30,7 @@ static int do_zip(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		return 1;
 
 	printf("Compressed size: %ld = 0x%lX\n", dst_len, dst_len);
-	setenv_hex("filesize", dst_len);
+	env_set_hex("filesize", dst_len);
 
 	return 0;
 }
diff --git a/common/autoboot.c b/common/autoboot.c
index c52bad84a4..41f18208c3 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -278,12 +278,12 @@ static void process_fdt_options(const void *blob)
 	/* Add an env variable to point to a kernel payload, if available */
 	addr = fdtdec_get_config_int(gd->fdt_blob, "kernel-offset", 0);
 	if (addr)
-		setenv_addr("kernaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
+		env_set_addr("kernaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
 
 	/* Add an env variable to point to a root disk, if available */
 	addr = fdtdec_get_config_int(gd->fdt_blob, "rootdisk-offset", 0);
 	if (addr)
-		setenv_addr("rootaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
+		env_set_addr("rootaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
 #endif /* CONFIG_OF_CONTROL && CONFIG_SYS_TEXT_BASE */
 }
 
@@ -300,7 +300,7 @@ const char *bootdelay_process(void)
 	bootcount = bootcount_load();
 	bootcount++;
 	bootcount_store(bootcount);
-	setenv_ulong("bootcount", bootcount);
+	env_set_ulong("bootcount", bootcount);
 	bootlimit = getenv_ulong("bootlimit", 10, 0);
 #endif /* CONFIG_BOOTCOUNT_LIMIT */
 
diff --git a/common/board_r.c b/common/board_r.c
index ecca1edb04..3b7bc6bbd0 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -486,7 +486,7 @@ static int initr_env(void)
 	else
 		set_default_env(NULL);
 #ifdef CONFIG_OF_CONTROL
-	setenv_addr("fdtcontroladdr", gd->fdt_blob);
+	env_set_addr("fdtcontroladdr", gd->fdt_blob);
 #endif
 
 	/* Initialize from environment */
@@ -658,7 +658,7 @@ int initr_mem(void)
 	pram += (LOGBUFF_LEN + LOGBUFF_OVERHEAD) / 1024;
 # endif
 	sprintf(memsz, "%ldk", (long int) ((gd->ram_size / 1024) - pram));
-	setenv("mem", memsz);
+	env_set("mem", memsz);
 
 	return 0;
 }
diff --git a/common/bootm.c b/common/bootm.c
index b2c09126ce..e34617a145 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -569,7 +569,7 @@ static void fixup_silent_linux(void)
 		env_val = CONSOLE_ARG;
 	}
 
-	setenv("bootargs", env_val);
+	env_set("bootargs", env_val);
 	debug("after silent fix-up: %s\n", env_val);
 	free(buf);
 }
@@ -645,8 +645,8 @@ int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
 		ret = boot_ramdisk_high(&images->lmb, images->rd_start,
 			rd_len, &images->initrd_start, &images->initrd_end);
 		if (!ret) {
-			setenv_hex("initrd_start", images->initrd_start);
-			setenv_hex("initrd_end", images->initrd_end);
+			env_set_hex("initrd_start", images->initrd_start);
+			env_set_hex("initrd_end", images->initrd_end);
 		}
 	}
 #endif
diff --git a/common/bootm_os.c b/common/bootm_os.c
index d9e6e937f7..86a37cb925 100644
--- a/common/bootm_os.c
+++ b/common/bootm_os.c
@@ -23,7 +23,7 @@ static int do_bootm_standalone(int flag, int argc, char * const argv[],
 	/* Don't start if "autostart" is set to "no" */
 	s = getenv("autostart");
 	if ((s != NULL) && !strcmp(s, "no")) {
-		setenv_hex("filesize", images->os.image_len);
+		env_set_hex("filesize", images->os.image_len);
 		return 0;
 	}
 	appl = (int (*)(int, char * const []))images->ep;
diff --git a/common/cli_hush.c b/common/cli_hush.c
index 00861e2d9e..280289639c 100644
--- a/common/cli_hush.c
+++ b/common/cli_hush.c
@@ -2265,7 +2265,7 @@ void unset_local_var(const char *name)
 			} else {
 #ifndef __U_BOOT__
 				if(cur->flg_export)
-					unsetenv(cur->name);
+					unenv_set(cur->name);
 #endif
 				free(cur->name);
 				free(cur->value);
diff --git a/common/console.c b/common/console.c
index c6156f33bb..2f3fa28f74 100644
--- a/common/console.c
+++ b/common/console.c
@@ -817,7 +817,7 @@ done:
 #ifdef CONFIG_SYS_CONSOLE_ENV_OVERWRITE
 	/* set the environment variables (will overwrite previous env settings) */
 	for (i = 0; i < 3; i++) {
-		setenv(stdio_names[i], stdio_devices[i]->name);
+		env_set(stdio_names[i], stdio_devices[i]->name);
 	}
 #endif /* CONFIG_SYS_CONSOLE_ENV_OVERWRITE */
 
@@ -896,7 +896,7 @@ int console_init_r(void)
 
 	/* Setting environment variables */
 	for (i = 0; i < 3; i++) {
-		setenv(stdio_names[i], stdio_devices[i]->name);
+		env_set(stdio_names[i], stdio_devices[i]->name);
 	}
 
 	gd->flags |= GD_FLG_DEVINIT;	/* device initialization completed */
diff --git a/common/hash.c b/common/hash.c
index 771d8fa87f..fda636d34a 100644
--- a/common/hash.c
+++ b/common/hash.c
@@ -302,7 +302,7 @@ static void store_result(struct hash_algo *algo, const uint8_t *sum,
 			str_ptr += 2;
 		}
 		*str_ptr = '\0';
-		setenv(dest, str_output);
+		env_set(dest, str_output);
 	} else {
 		ulong addr;
 		void *buf;
diff --git a/common/hwconfig.c b/common/hwconfig.c
index 4ae042ee33..85aaabbb85 100644
--- a/common/hwconfig.c
+++ b/common/hwconfig.c
@@ -243,7 +243,7 @@ int main()
 	const char *ret;
 	size_t len;
 
-	setenv("hwconfig", "key1:subkey1=value1,subkey2=value2;key2:value3;;;;"
+	env_set("hwconfig", "key1:subkey1=value1,subkey2=value2;key2:value3;;;;"
 			   "key3;:,:=;key4", 1);
 
 	ret = hwconfig_arg("key1", &len);
@@ -274,7 +274,7 @@ int main()
 	assert(hwconfig_arg("key4", &len) == NULL);
 	assert(hwconfig_arg("bogus", &len) == NULL);
 
-	unsetenv("hwconfig");
+	unenv_set("hwconfig");
 
 	assert(hwconfig(NULL) == 0);
 	assert(hwconfig("") == 0);
diff --git a/common/image-android.c b/common/image-android.c
index c668407817..018c7594fe 100644
--- a/common/image-android.c
+++ b/common/image-android.c
@@ -90,7 +90,7 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify,
 	if (*hdr->cmdline)
 		strcat(newbootargs, hdr->cmdline);
 
-	setenv("bootargs", newbootargs);
+	env_set("bootargs", newbootargs);
 
 	if (os_data) {
 		*os_data = (ulong)hdr;
diff --git a/common/main.c b/common/main.c
index 2116a9e0a2..07fc31b716 100644
--- a/common/main.c
+++ b/common/main.c
@@ -48,7 +48,7 @@ void main_loop(void)
 	bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, "main_loop");
 
 #ifdef CONFIG_VERSION_VARIABLE
-	setenv("ver", version_string);  /* set version variable */
+	env_set("ver", version_string);  /* set version variable */
 #endif /* CONFIG_VERSION_VARIABLE */
 
 	cli_init();
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 4de81392b0..60a73311d9 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -249,7 +249,7 @@ config SPL_ENV_SUPPORT
 	  configuration. But some boards use this to support 'Falcon' boot
 	  on EXT2 and FAT, where SPL boots directly into Linux without
 	  starting U-Boot first. Enabling this option will make getenv()
-	  and setenv() available in SPL.
+	  and env_set() available in SPL.
 
 config SPL_SAVEENV
 	bool "Support save environment"
diff --git a/common/spl/spl_dfu.c b/common/spl/spl_dfu.c
index e8d0ba18e6..f5ec0fb396 100644
--- a/common/spl/spl_dfu.c
+++ b/common/spl/spl_dfu.c
@@ -46,7 +46,7 @@ int spl_dfu_cmd(int usbctrl, char *dfu_alt_info, char *interface, char *devstr)
 		return -EINVAL;
 	}
 
-	ret = setenv("dfu_alt_info", str_env);
+	ret = env_set("dfu_alt_info", str_env);
 	if (ret) {
 		error("unable to set env variable \"dfu_alt_info\"!\n");
 		return -EINVAL;
diff --git a/common/spl/spl_net.c b/common/spl/spl_net.c
index 85fe508b17..88831097fa 100644
--- a/common/spl/spl_net.c
+++ b/common/spl/spl_net.c
@@ -33,14 +33,14 @@ static int spl_net_load_image(struct spl_image_info *spl_image,
 
 	env_init();
 	env_relocate();
-	setenv("autoload", "yes");
+	env_set("autoload", "yes");
 	rv = eth_initialize();
 	if (rv == 0) {
 		printf("No Ethernet devices found\n");
 		return -ENODEV;
 	}
 	if (bootdev->boot_device_name)
-		setenv("ethact", bootdev->boot_device_name);
+		env_set("ethact", bootdev->boot_device_name);
 	rv = net_loop(BOOTP);
 	if (rv < 0) {
 		printf("Problem booting with BOOTP\n");
diff --git a/common/update.c b/common/update.c
index 0767fcbcb5..061a5541b1 100644
--- a/common/update.c
+++ b/common/update.c
@@ -67,7 +67,7 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
 	tftp_timeout_count_max = cnt_max;
 
 	/* we don't want to retry the connection if errors occur */
-	setenv("netretry", "no");
+	env_set("netretry", "no");
 
 	/* download the update file */
 	load_addr = addr;
@@ -83,7 +83,7 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
 	tftp_timeout_ms = saved_timeout_msecs;
 	tftp_timeout_count_max = saved_timeout_count;
 
-	setenv("netretry", saved_netretry);
+	env_set("netretry", saved_netretry);
 	if (saved_netretry != NULL)
 		free(saved_netretry);
 
diff --git a/doc/README.enetaddr b/doc/README.enetaddr
index 50e4899787..241d528ff7 100644
--- a/doc/README.enetaddr
+++ b/doc/README.enetaddr
@@ -98,12 +98,12 @@ if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
 }
 /* enetaddr is now set to the value stored in the ethaddr env var */
 
-	* int eth_setenv_enetaddr(char *name, const uchar *enetaddr);
+	* int eth_env_set_enetaddr(char *name, const uchar *enetaddr);
 
 Store the MAC address into the named environment variable.  The return value is
-the same as the setenv() function.
+the same as the env_set() function.
 uchar enetaddr[6] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 };
-eth_setenv_enetaddr("ethaddr", enetaddr);
+eth_env_set_enetaddr("ethaddr", enetaddr);
 /* the "ethaddr" env var should now be set to "00:11:22:33:44:55" */
 
 	* the %pM format modifier
diff --git a/drivers/bootcount/bootcount_env.c b/drivers/bootcount/bootcount_env.c
index 7f22dd0748..ec5f942676 100644
--- a/drivers/bootcount/bootcount_env.c
+++ b/drivers/bootcount/bootcount_env.c
@@ -13,7 +13,7 @@ void bootcount_store(ulong a)
 	int upgrade_available = getenv_ulong("upgrade_available", 10, 0);
 
 	if (upgrade_available) {
-		setenv_ulong("bootcount", a);
+		env_set_ulong("bootcount", a);
 		env_save();
 	}
 }
diff --git a/drivers/mtd/dataflash.c b/drivers/mtd/dataflash.c
index 2d2c318adf..b20a2e0a8e 100644
--- a/drivers/mtd/dataflash.c
+++ b/drivers/mtd/dataflash.c
@@ -169,8 +169,9 @@ void AT91F_DataflashSetEnv (void)
 			/* Set the environment according to the label...*/
 			if((env & FLAG_SETENV) == FLAG_SETENV) {
 				start = dataflash_info[i].Device.area_list[j].start;
-				sprintf((char*) s,"%lX",start);
-				setenv((char*) area_list[part].label,(char*) s);
+				sprintf((char *)s, "%lX", start);
+				env_set((char *)area_list[part].label,
+					(char *)s);
 			}
 			part++;
 		}
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 40be52070e..424c347e0e 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -1097,7 +1097,7 @@ static int fec_probe(bd_t *bd, int dev_id, uint32_t base_addr,
 		else
 			strcpy(mac, "ethaddr");
 		if (!getenv(mac))
-			eth_setenv_enetaddr(mac, ethaddr);
+			eth_env_set_enetaddr(mac, ethaddr);
 	}
 	return ret;
 err4:
diff --git a/drivers/net/fm/fm.c b/drivers/net/fm/fm.c
index 9fe34ad4a9..451dfded77 100644
--- a/drivers/net/fm/fm.c
+++ b/drivers/net/fm/fm.c
@@ -418,7 +418,7 @@ int fm_init_common(int index, struct ccsr_fman *reg)
 	rc = fman_upload_firmware(index, &reg->fm_imem, addr);
 	if (rc)
 		return rc;
-	setenv_addr("fman_ucode", addr);
+	env_set_addr("fman_ucode", addr);
 
 	fm_init_muram(index, &reg->muram);
 	fm_init_qmi(&reg->fm_qmi_common);
diff --git a/drivers/net/lan91c96.c b/drivers/net/lan91c96.c
index 3526876d14..255c7010cc 100644
--- a/drivers/net/lan91c96.c
+++ b/drivers/net/lan91c96.c
@@ -710,7 +710,7 @@ static int smc_get_ethaddr(bd_t *bd, struct eth_device *dev)
 			printf("\n*** ERROR: ethaddr is NOT set !!\n");
 			return -1;
 		}
-		eth_setenv_enetaddr("ethaddr", v_mac);
+		eth_env_set_enetaddr("ethaddr", v_mac);
 	}
 
 	smc_set_mac_addr(v_mac); /* use old function to update smc default */
diff --git a/drivers/net/ne2000_base.c b/drivers/net/ne2000_base.c
index 377d87f04b..f6e5eafba5 100644
--- a/drivers/net/ne2000_base.c
+++ b/drivers/net/ne2000_base.c
@@ -723,7 +723,7 @@ static int ne2k_setup_driver(struct eth_device *dev)
 		 * returns -1 due to eth_getenv_enetaddr_by_index() failing,
 		 * and this causes "Warning: failed to set MAC address", and
 		 * cmd_bdinfo has no ethaddr value which it can show: */
-		eth_setenv_enetaddr("ethaddr", dev->enetaddr);
+		eth_env_set_enetaddr("ethaddr", dev->enetaddr);
 	}
 	return 0;
 }
diff --git a/drivers/net/sandbox-raw.c b/drivers/net/sandbox-raw.c
index f5fa0e8533..590ae0c0fc 100644
--- a/drivers/net/sandbox-raw.c
+++ b/drivers/net/sandbox-raw.c
@@ -33,8 +33,8 @@ static int sb_eth_raw_start(struct udevice *dev)
 
 	if (strcmp(interface, "lo") == 0) {
 		priv->local = 1;
-		setenv("ipaddr", "127.0.0.1");
-		setenv("serverip", "127.0.0.1");
+		env_set("ipaddr", "127.0.0.1");
+		env_set("serverip", "127.0.0.1");
 	}
 	return sandbox_eth_raw_os_start(interface, pdata->enetaddr, priv);
 }
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 7ec7ecc295..f47628b2de 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -682,7 +682,7 @@ int scsi_scan(bool verbose)
 
 	printf("Found %d device(s).\n", scsi_max_devs);
 #ifndef CONFIG_SPL_BUILD
-	setenv_ulong("scsidevs", scsi_max_devs);
+	env_set_ulong("scsidevs", scsi_max_devs);
 #endif
 	return 0;
 }
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 4137d76c42..d0105372cf 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -2685,7 +2685,7 @@ static int usb_eth_probe(struct udevice *dev)
 	l_priv = priv;
 
 	get_ether_addr(CONFIG_USBNET_DEVADDR, pdata->enetaddr);
-	eth_setenv_enetaddr("usbnet_devaddr", pdata->enetaddr);
+	eth_env_set_enetaddr("usbnet_devaddr", pdata->enetaddr);
 
 	return 0;
 }
diff --git a/fs/fs.c b/fs/fs.c
index 595ff1fe69..055dffdafd 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -348,7 +348,7 @@ int do_size(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
 	if (fs_size(argv[3], &size) < 0)
 		return CMD_RET_FAILURE;
 
-	setenv_hex("filesize", size);
+	env_set_hex("filesize", size);
 
 	return 0;
 }
@@ -417,8 +417,8 @@ int do_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
 	}
 	puts("\n");
 
-	setenv_hex("fileaddr", addr);
-	setenv_hex("filesize", len_read);
+	env_set_hex("fileaddr", addr);
+	env_set_hex("filesize", len_read);
 
 	return 0;
 }
@@ -509,7 +509,7 @@ int do_fs_uuid(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
 		return CMD_RET_FAILURE;
 
 	if (argc == 4)
-		setenv(argv[3], uuid);
+		env_set(argv[3], uuid);
 	else
 		printf("%s\n", uuid);
 
@@ -529,7 +529,7 @@ int do_fs_type(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	info = fs_get_info(fs_type);
 
 	if (argc == 4)
-		setenv(argv[3], info->name);
+		env_set(argv[3], info->name);
 	else
 		printf("%s\n", info->name);
 
diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c
index db29489eca..8f1c9d167d 100644
--- a/fs/ubifs/ubifs.c
+++ b/fs/ubifs/ubifs.c
@@ -941,7 +941,7 @@ int ubifs_load(char *filename, u32 addr, u32 size)
 
 	err = ubifs_read(filename, (void *)(uintptr_t)addr, 0, size, &actread);
 	if (err == 0) {
-		setenv_hex("filesize", actread);
+		env_set_hex("filesize", actread);
 		printf("Done\n");
 	}
 
diff --git a/include/_exports.h b/include/_exports.h
index 6ff4364e44..9deed77378 100644
--- a/include/_exports.h
+++ b/include/_exports.h
@@ -32,7 +32,7 @@
 	EXPORT_FUNC(do_reset, int, do_reset, cmd_tbl_t *,
 		    int , int , char * const [])
 	EXPORT_FUNC(getenv, char  *, getenv, const char*)
-	EXPORT_FUNC(setenv, int, setenv, const char *, const char *)
+	EXPORT_FUNC(env_set, int, env_set, const char *, const char *)
 	EXPORT_FUNC(simple_strtoul, unsigned long, simple_strtoul,
 		    const char *, char **, unsigned int)
 	EXPORT_FUNC(strict_strtoul, int, strict_strtoul,
diff --git a/include/common.h b/include/common.h
index f0fc02cd3b..57f53f54ed 100644
--- a/include/common.h
+++ b/include/common.h
@@ -335,19 +335,46 @@ ulong getenv_hex(const char *varname, ulong default_val);
  * Return -1 if variable does not exist (default to true)
  */
 int getenv_yesno(const char *var);
-int	setenv	     (const char *, const char *);
-int setenv_ulong(const char *varname, ulong value);
-int setenv_hex(const char *varname, ulong value);
+
+/**
+ * env_set() - set an environment variable
+ *
+ * This sets or deletes the value of an environment variable. For setting the
+ * value the variable is created if it does not already exist.
+ *
+ * @varname: Variable to adjust
+ * @value: Value to set for the variable, or NULL or "" to delete the variable
+ * @return 0 if OK, 1 on error
+ */
+int env_set(const char *varname, const char *value);
+
+/**
+ * env_set_ulong() - set an environment variable to an integer
+ *
+ * @varname: Variable to adjust
+ * @value: Value to set for the variable (will be converted to a string)
+ * @return 0 if OK, 1 on error
+ */
+int env_set_ulong(const char *varname, ulong value);
+
+/**
+ * env_set_hex() - set an environment variable to a hex value
+ *
+ * @varname: Variable to adjust
+ * @value: Value to set for the variable (will be converted to a hex string)
+ * @return 0 if OK, 1 on error
+ */
+int env_set_hex(const char *varname, ulong value);
 /**
- * setenv_addr - Set an environment variable to an address in hex
+ * env_set_addr - Set an environment variable to an address in hex
  *
  * @varname:	Environment variable to set
  * @addr:	Value to set it to
  * @return 0 if ok, 1 on error
  */
-static inline int setenv_addr(const char *varname, const void *addr)
+static inline int env_set_addr(const char *varname, const void *addr)
 {
-	return setenv_hex(varname, (ulong)addr);
+	return env_set_hex(varname, (ulong)addr);
 }
 
 #ifdef CONFIG_AUTO_COMPLETE
diff --git a/include/configs/tam3517-common.h b/include/configs/tam3517-common.h
index a9991fc6b8..c1d07d2919 100644
--- a/include/configs/tam3517-common.h
+++ b/include/configs/tam3517-common.h
@@ -341,7 +341,7 @@ do {								\
 		else						\
 			strcpy(ethname, "ethaddr");		\
 		printf("Setting %s from EEPROM with %s\n", ethname, buf);\
-		setenv(ethname, buf);				\
+		env_set(ethname, buf);				\
 	}							\
 } while (0)
 
diff --git a/include/exports.h b/include/exports.h
index 1d81bc4b28..6522d78fac 100644
--- a/include/exports.h
+++ b/include/exports.h
@@ -28,7 +28,7 @@ int vprintf(const char *, va_list);
 unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base);
 int strict_strtoul(const char *cp, unsigned int base, unsigned long *res);
 char *getenv (const char *name);
-int setenv (const char *varname, const char *varvalue);
+int env_set(const char *varname, const char *value);
 long simple_strtol(const char *cp, char **endp, unsigned int base);
 int strcmp(const char *cs, const char *ct);
 unsigned long ustrtoul(const char *cp, char **endp, unsigned int base);
diff --git a/include/fsl_validate.h b/include/fsl_validate.h
index 452c6df83f..b0971651eb 100644
--- a/include/fsl_validate.h
+++ b/include/fsl_validate.h
@@ -273,7 +273,7 @@ int fsl_secboot_blob_decap(cmd_tbl_t *cmdtp, int flag, int argc,
 	char * const argv[]);
 
 int fsl_check_boot_mode_secure(void);
-int fsl_setenv_chain_of_trust(void);
+int fsl_env_set_chain_of_trust(void);
 
 /*
  * This function is used to validate the main U-boot binary from
diff --git a/include/net.h b/include/net.h
index 2eaa88224c..65ab7b2c79 100644
--- a/include/net.h
+++ b/include/net.h
@@ -240,10 +240,10 @@ void eth_set_current(void);		/* set nterface to ethcur var */
 int eth_get_dev_index(void);		/* get the device index */
 void eth_parse_enetaddr(const char *addr, uchar *enetaddr);
 int eth_getenv_enetaddr(const char *name, uchar *enetaddr);
-int eth_setenv_enetaddr(const char *name, const uchar *enetaddr);
+int eth_env_set_enetaddr(const char *name, const uchar *enetaddr);
 
 /**
- * eth_setenv_enetaddr_by_index() - set the MAC address environment variable
+ * eth_env_set_enetaddr_by_index() - set the MAC address environment variable
  *
  * This sets up an environment variable with the given MAC address (@enetaddr).
  * The environment variable to be set is defined by <@base_name><@index>addr.
@@ -255,7 +255,7 @@ int eth_setenv_enetaddr(const char *name, const uchar *enetaddr);
  * @enetaddr:   Pointer to MAC address to put into the variable
  * @return 0 if OK, other value on error
  */
-int eth_setenv_enetaddr_by_index(const char *base_name, int index,
+int eth_env_set_enetaddr_by_index(const char *base_name, int index,
 				 uchar *enetaddr);
 
 
diff --git a/include/search.h b/include/search.h
index 402dfd84fb..df5d61c2eb 100644
--- a/include/search.h
+++ b/include/search.h
@@ -118,7 +118,7 @@ extern int hwalk_r(struct hsearch_data *__htab, int (*callback)(ENTRY *));
 #define H_MATCH_SUBSTR	(1 << 7) /* search for substring matches	     */
 #define H_MATCH_REGEX	(1 << 8) /* search for regular expression matches    */
 #define H_MATCH_METHOD	(H_MATCH_IDENT | H_MATCH_SUBSTR | H_MATCH_REGEX)
-#define H_PROGRAMMATIC	(1 << 9) /* indicate that an import is from setenv() */
+#define H_PROGRAMMATIC	(1 << 9) /* indicate that an import is from env_set() */
 #define H_ORIGIN_FLAGS	(H_INTERACTIVE | H_PROGRAMMATIC)
 
 #endif /* _SEARCH_H_ */
diff --git a/lib/uuid.c b/lib/uuid.c
index c8584edcb8..1536c027da 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -291,7 +291,7 @@ int do_uuid(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	if (argc == 1)
 		printf("%s\n", uuid);
 	else
-		setenv(argv[1], uuid);
+		env_set(argv[1], uuid);
 
 	return CMD_RET_SUCCESS;
 }
diff --git a/net/arp.c b/net/arp.c
index f3ceff9ed8..4c79e09ccb 100644
--- a/net/arp.c
+++ b/net/arp.c
@@ -194,7 +194,7 @@ void arp_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 		if (net_server_ip.s_addr == net_arp_wait_packet_ip.s_addr) {
 			char buf[20];
 			sprintf(buf, "%pM", &arp->ar_sha);
-			setenv("serveraddr", buf);
+			env_set("serveraddr", buf);
 		}
 #endif
 
diff --git a/net/bootp.c b/net/bootp.c
index be8f710e0c..579515687b 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -170,7 +170,7 @@ static void store_net_params(struct bootp_hdr *bp)
 	 * not contain a new value
 	 */
 	if (*net_boot_file_name)
-		setenv("bootfile", net_boot_file_name);
+		env_set("bootfile", net_boot_file_name);
 #endif
 	net_copy_ip(&net_ip, &bp->bp_yiaddr);
 }
diff --git a/net/dns.c b/net/dns.c
index 7017bac75a..eee8a02f7c 100644
--- a/net/dns.c
+++ b/net/dns.c
@@ -184,7 +184,7 @@ static void dns_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 			ip_to_string(ip_addr, ip_str);
 			printf("%s\n", ip_str);
 			if (net_dns_env_var)
-				setenv(net_dns_env_var, ip_str);
+				env_set(net_dns_env_var, ip_str);
 		} else {
 			puts("server responded with invalid IP number\n");
 		}
diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index b659961a5d..d356576210 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -510,7 +510,7 @@ static int eth_post_probe(struct udevice *dev)
 		/* Override the ROM MAC address */
 		memcpy(pdata->enetaddr, env_enetaddr, ARP_HLEN);
 	} else if (is_valid_ethaddr(pdata->enetaddr)) {
-		eth_setenv_enetaddr_by_index("eth", dev->seq, pdata->enetaddr);
+		eth_env_set_enetaddr_by_index("eth", dev->seq, pdata->enetaddr);
 		printf("\nWarning: %s using MAC address from ROM\n",
 		       dev->name);
 	} else if (is_zero_ethaddr(pdata->enetaddr) ||
diff --git a/net/eth_common.c b/net/eth_common.c
index 58fa295771..7b36532ee1 100644
--- a/net/eth_common.c
+++ b/net/eth_common.c
@@ -30,7 +30,7 @@ int eth_getenv_enetaddr(const char *name, uchar *enetaddr)
 	return is_valid_ethaddr(enetaddr);
 }
 
-int eth_setenv_enetaddr(const char *name, const uchar *enetaddr)
+int eth_env_set_enetaddr(const char *name, const uchar *enetaddr)
 {
 	char buf[ARP_HLEN_ASCII + 1];
 
@@ -39,7 +39,7 @@ int eth_setenv_enetaddr(const char *name, const uchar *enetaddr)
 
 	sprintf(buf, "%pM", enetaddr);
 
-	return setenv(name, buf);
+	return env_set(name, buf);
 }
 
 int eth_getenv_enetaddr_by_index(const char *base_name, int index,
@@ -50,12 +50,12 @@ int eth_getenv_enetaddr_by_index(const char *base_name, int index,
 	return eth_getenv_enetaddr(enetvar, enetaddr);
 }
 
-int eth_setenv_enetaddr_by_index(const char *base_name, int index,
+int eth_env_set_enetaddr_by_index(const char *base_name, int index,
 				 uchar *enetaddr)
 {
 	char enetvar[32];
 	sprintf(enetvar, index ? "%s%daddr" : "%saddr", base_name, index);
-	return eth_setenv_enetaddr(enetvar, enetaddr);
+	return eth_env_set_enetaddr(enetvar, enetaddr);
 }
 
 void eth_common_init(void)
@@ -97,14 +97,14 @@ void eth_current_changed(void)
 	/* update current ethernet name */
 	if (eth_get_dev()) {
 		if (act == NULL || strcmp(act, eth_get_name()) != 0)
-			setenv("ethact", eth_get_name());
+			env_set("ethact", eth_get_name());
 	}
 	/*
 	 * remove the variable completely if there is no active
 	 * interface
 	 */
 	else if (act != NULL)
-		setenv("ethact", NULL);
+		env_set("ethact", NULL);
 }
 
 void eth_try_another(int first_restart)
diff --git a/net/eth_internal.h b/net/eth_internal.h
index a14b20844f..4b0e716b73 100644
--- a/net/eth_internal.h
+++ b/net/eth_internal.h
@@ -13,7 +13,7 @@
 void eth_common_init(void);
 
 /**
- * eth_setenv_enetaddr_by_index() - set the MAC address environment variable
+ * eth_env_set_enetaddr_by_index() - set the MAC address environment variable
  *
  * This sets up an environment variable with the given MAC address (@enetaddr).
  * The environment variable to be set is defined by <@base_name><@index>addr.
@@ -25,7 +25,7 @@ void eth_common_init(void);
  * @enetaddr:	Pointer to MAC address to put into the variable
  * @return 0 if OK, other value on error
  */
-int eth_setenv_enetaddr_by_index(const char *base_name, int index,
+int eth_env_set_enetaddr_by_index(const char *base_name, int index,
 				 uchar *enetaddr);
 
 int eth_mac_skip(int index);
diff --git a/net/eth_legacy.c b/net/eth_legacy.c
index e4bd0f4c1a..2608302648 100644
--- a/net/eth_legacy.c
+++ b/net/eth_legacy.c
@@ -152,8 +152,8 @@ int eth_write_hwaddr(struct eth_device *dev, const char *base_name,
 
 		memcpy(dev->enetaddr, env_enetaddr, ARP_HLEN);
 	} else if (is_valid_ethaddr(dev->enetaddr)) {
-		eth_setenv_enetaddr_by_index(base_name, eth_number,
-					     dev->enetaddr);
+		eth_env_set_enetaddr_by_index(base_name, eth_number,
+					      dev->enetaddr);
 	} else if (is_zero_ethaddr(dev->enetaddr)) {
 #ifdef CONFIG_NET_RANDOM_ETHADDR
 		net_random_ethaddr(dev->enetaddr);
diff --git a/net/net.c b/net/net.c
index 6e678770fa..2fed28092d 100644
--- a/net/net.c
+++ b/net/net.c
@@ -616,8 +616,8 @@ restart:
 			if (net_boot_file_size > 0) {
 				printf("Bytes transferred = %d (%x hex)\n",
 				       net_boot_file_size, net_boot_file_size);
-				setenv_hex("filesize", net_boot_file_size);
-				setenv_hex("fileaddr", load_addr);
+				env_set_hex("filesize", net_boot_file_size);
+				env_set_hex("fileaddr", load_addr);
 			}
 			if (protocol != NETCONS)
 				eth_halt();
diff --git a/test/dm/eth.c b/test/dm/eth.c
index 564ad36916..f824d704c6 100644
--- a/test/dm/eth.c
+++ b/test/dm/eth.c
@@ -26,15 +26,15 @@ static int dm_test_eth(struct unit_test_state *uts)
 {
 	net_ping_ip = string_to_ip("1.1.2.2");
 
-	setenv("ethact", "eth at 10002000");
+	env_set("ethact", "eth at 10002000");
 	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10002000", getenv("ethact"));
 
-	setenv("ethact", "eth at 10003000");
+	env_set("ethact", "eth at 10003000");
 	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10003000", getenv("ethact"));
 
-	setenv("ethact", "eth at 10004000");
+	env_set("ethact", "eth at 10004000");
 	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10004000", getenv("ethact"));
 
@@ -45,20 +45,20 @@ DM_TEST(dm_test_eth, DM_TESTF_SCAN_FDT);
 static int dm_test_eth_alias(struct unit_test_state *uts)
 {
 	net_ping_ip = string_to_ip("1.1.2.2");
-	setenv("ethact", "eth0");
+	env_set("ethact", "eth0");
 	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10002000", getenv("ethact"));
 
-	setenv("ethact", "eth1");
+	env_set("ethact", "eth1");
 	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10004000", getenv("ethact"));
 
 	/* Expected to fail since eth2 is not defined in the device tree */
-	setenv("ethact", "eth2");
+	env_set("ethact", "eth2");
 	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10002000", getenv("ethact"));
 
-	setenv("ethact", "eth5");
+	env_set("ethact", "eth5");
 	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10003000", getenv("ethact"));
 
@@ -71,14 +71,14 @@ static int dm_test_eth_prime(struct unit_test_state *uts)
 	net_ping_ip = string_to_ip("1.1.2.2");
 
 	/* Expected to be "eth at 10003000" because of ethprime variable */
-	setenv("ethact", NULL);
-	setenv("ethprime", "eth5");
+	env_set("ethact", NULL);
+	env_set("ethprime", "eth5");
 	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10003000", getenv("ethact"));
 
 	/* Expected to be "eth at 10002000" because it is first */
-	setenv("ethact", NULL);
-	setenv("ethprime", NULL);
+	env_set("ethact", NULL);
+	env_set("ethprime", NULL);
 	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10002000", getenv("ethact"));
 
@@ -121,26 +121,26 @@ static int dm_test_eth_act(struct unit_test_state *uts)
 		/* Invalidate MAC address */
 		strcpy(ethaddr[i], getenv(addrname[i]));
 		/* Must disable access protection for ethaddr before clearing */
-		setenv(".flags", addrname[i]);
-		setenv(addrname[i], NULL);
+		env_set(".flags", addrname[i]);
+		env_set(addrname[i], NULL);
 	}
 
 	/* Set ethact to "eth at 10002000" */
-	setenv("ethact", ethname[0]);
+	env_set("ethact", ethname[0]);
 
 	/* Segment fault might happen if something is wrong */
 	ut_asserteq(-ENODEV, net_loop(PING));
 
 	for (i = 0; i < DM_TEST_ETH_NUM; i++) {
 		/* Restore the env */
-		setenv(".flags", addrname[i]);
-		setenv(addrname[i], ethaddr[i]);
+		env_set(".flags", addrname[i]);
+		env_set(addrname[i], ethaddr[i]);
 
 		/* Probe the device again */
 		ut_assertok(device_probe(dev[i]));
 	}
-	setenv(".flags", NULL);
-	setenv("ethact", NULL);
+	env_set(".flags", NULL);
+	env_set("ethact", NULL);
 
 	return 0;
 }
@@ -150,13 +150,13 @@ DM_TEST(dm_test_eth_act, DM_TESTF_SCAN_FDT);
 static int _dm_test_eth_rotate1(struct unit_test_state *uts)
 {
 	/* Make sure that the default is to rotate to the next interface */
-	setenv("ethact", "eth at 10004000");
+	env_set("ethact", "eth at 10004000");
 	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10002000", getenv("ethact"));
 
 	/* If ethrotate is no, then we should fail on a bad MAC */
-	setenv("ethact", "eth at 10004000");
-	setenv("ethrotate", "no");
+	env_set("ethact", "eth at 10004000");
+	env_set("ethrotate", "no");
 	ut_asserteq(-EINVAL, net_loop(PING));
 	ut_asserteq_str("eth at 10004000", getenv("ethact"));
 
@@ -166,12 +166,12 @@ static int _dm_test_eth_rotate1(struct unit_test_state *uts)
 static int _dm_test_eth_rotate2(struct unit_test_state *uts)
 {
 	/* Make sure we can skip invalid devices */
-	setenv("ethact", "eth at 10004000");
+	env_set("ethact", "eth at 10004000");
 	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10004000", getenv("ethact"));
 
 	/* Make sure we can handle device name which is not eth# */
-	setenv("ethact", "sbe5");
+	env_set("ethact", "sbe5");
 	ut_assertok(net_loop(PING));
 	ut_asserteq_str("sbe5", getenv("ethact"));
 
@@ -189,29 +189,29 @@ static int dm_test_eth_rotate(struct unit_test_state *uts)
 	/* Invalidate eth1's MAC address */
 	strcpy(ethaddr, getenv("eth1addr"));
 	/* Must disable access protection for eth1addr before clearing */
-	setenv(".flags", "eth1addr");
-	setenv("eth1addr", NULL);
+	env_set(".flags", "eth1addr");
+	env_set("eth1addr", NULL);
 
 	retval = _dm_test_eth_rotate1(uts);
 
 	/* Restore the env */
-	setenv("eth1addr", ethaddr);
-	setenv("ethrotate", NULL);
+	env_set("eth1addr", ethaddr);
+	env_set("ethrotate", NULL);
 
 	if (!retval) {
 		/* Invalidate eth0's MAC address */
 		strcpy(ethaddr, getenv("ethaddr"));
 		/* Must disable access protection for ethaddr before clearing */
-		setenv(".flags", "ethaddr");
-		setenv("ethaddr", NULL);
+		env_set(".flags", "ethaddr");
+		env_set("ethaddr", NULL);
 
 		retval = _dm_test_eth_rotate2(uts);
 
 		/* Restore the env */
-		setenv("ethaddr", ethaddr);
+		env_set("ethaddr", ethaddr);
 	}
 	/* Restore the env */
-	setenv(".flags", NULL);
+	env_set(".flags", NULL);
 
 	return retval;
 }
@@ -225,8 +225,8 @@ static int _dm_test_net_retry(struct unit_test_state *uts)
 	 * the active device should be eth0
 	 */
 	sandbox_eth_disable_response(1, true);
-	setenv("ethact", "eth at 10004000");
-	setenv("netretry", "yes");
+	env_set("ethact", "eth at 10004000");
+	env_set("netretry", "yes");
 	sandbox_eth_skip_timeout();
 	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10002000", getenv("ethact"));
@@ -235,8 +235,8 @@ static int _dm_test_net_retry(struct unit_test_state *uts)
 	 * eth1 is disabled and netretry is no, so the ping should fail and the
 	 * active device should be eth1
 	 */
-	setenv("ethact", "eth at 10004000");
-	setenv("netretry", "no");
+	env_set("ethact", "eth at 10004000");
+	env_set("netretry", "no");
 	sandbox_eth_skip_timeout();
 	ut_asserteq(-ETIMEDOUT, net_loop(PING));
 	ut_asserteq_str("eth at 10004000", getenv("ethact"));
@@ -253,7 +253,7 @@ static int dm_test_net_retry(struct unit_test_state *uts)
 	retval = _dm_test_net_retry(uts);
 
 	/* Restore the env */
-	setenv("netretry", NULL);
+	env_set("netretry", NULL);
 	sandbox_eth_disable_response(1, false);
 
 	return retval;
diff --git a/tools/env/fw_env_main.c b/tools/env/fw_env_main.c
index b8bff264eb..748deadd09 100644
--- a/tools/env/fw_env_main.c
+++ b/tools/env/fw_env_main.c
@@ -183,7 +183,7 @@ int parse_printenv_args(int argc, char *argv[])
 	return 0;
 }
 
-int parse_setenv_args(int argc, char *argv[])
+int parse_env_set_args(int argc, char *argv[])
 {
 	int c;
 
@@ -236,7 +236,7 @@ int main(int argc, char *argv[])
 		if (parse_printenv_args(argc, argv))
 			exit(EXIT_FAILURE);
 	} else {
-		if (parse_setenv_args(argc, argv))
+		if (parse_env_set_args(argc, argv))
 			exit(EXIT_FAILURE);
 	}
 
-- 
2.14.0.rc0.400.g1c36432dff-goog



More information about the U-Boot mailing list