[U-Boot] [PATCH v5 09/19] board: converted with new env interfaces

AKASHI Takahiro takahiro.akashi at linaro.org
Thu Sep 5 08:21:23 UTC 2019


env_xxx(...) -> env_xxx(ctx_uboot, ...)

Signed-off-by: AKASHI Takahiro <takahiro.akashi at linaro.org>
---
 board/Arcturus/ucp1020/cmd_arc.c              | 40 ++++++------
 board/Arcturus/ucp1020/ucp1020.c              | 16 ++---
 board/BuR/brppt1/board.c                      |  4 +-
 board/BuR/brxre1/board.c                      |  9 +--
 board/BuR/common/br_resetc.c                  |  2 +-
 board/BuR/common/common.c                     | 47 +++++++-------
 board/BuS/eb_cpu5282/eb_cpu5282.c             |  8 +--
 board/CZ.NIC/turris_mox/turris_mox.c          |  4 +-
 board/CZ.NIC/turris_omnia/turris_omnia.c      |  6 +-
 board/CarMediaLab/flea3/flea3.c               |  2 +-
 board/LaCie/net2big_v2/net2big_v2.c           |  2 +-
 board/LaCie/netspace_v2/netspace_v2.c         |  2 +-
 board/Synology/ds414/cmd_syno.c               |  6 +-
 board/alliedtelesis/x530/x530.c               |  2 +-
 board/amazon/kc1/kc1.c                        |  4 +-
 board/amlogic/p200/p200.c                     |  4 +-
 board/amlogic/p201/p201.c                     |  4 +-
 board/amlogic/p212/p212.c                     |  4 +-
 board/amlogic/q200/q200.c                     |  4 +-
 board/aristainetos/aristainetos-v2.c          |  8 +--
 board/armltd/integrator/integrator.c          |  2 +-
 board/atmel/common/board.c                    |  4 +-
 board/atmel/common/mac_eeprom.c               |  2 +-
 board/atmel/sama5d3xek/sama5d3xek.c           |  2 +-
 board/bachmann/ot1200/ot1200.c                |  4 +-
 board/birdland/bav335x/board.c                |  8 +--
 board/bluegiga/apx4devkit/apx4devkit.c        |  5 +-
 board/bluewater/gurnard/gurnard.c             |  6 +-
 board/bosch/shc/board.c                       |  2 +-
 board/boundary/nitrogen6x/nitrogen6x.c        | 14 ++---
 board/broadcom/bcm23550_w1d/bcm23550_w1d.c    |  2 +-
 board/broadcom/bcm28155_ap/bcm28155_ap.c      |  2 +-
 board/broadcom/bcmstb/bcmstb.c                |  2 +-
 board/buffalo/lsxl/lsxl.c                     |  2 +-
 board/cadence/xtfpga/xtfpga.c                 |  4 +-
 board/ccv/xpress/xpress.c                     |  2 +-
 board/compulab/cl-som-imx7/cl-som-imx7.c      |  2 +-
 board/compulab/cm_fx6/cm_fx6.c                | 10 +--
 board/compulab/common/omap3_display.c         |  4 +-
 board/congatec/cgtqmx6eval/cgtqmx6eval.c      |  8 +--
 board/cssi/MCR3000/MCR3000.c                  |  2 +-
 board/davinci/da8xxevm/da850evm.c             |  2 +-
 board/davinci/da8xxevm/omapl138_lcdk.c        |  6 +-
 board/dhelectronics/dh_imx6/dh_imx6.c         |  2 +-
 board/eets/pdu001/board.c                     |  8 +--
 board/el/el6x/el6x.c                          |  2 +-
 board/emulation/qemu-riscv/qemu-riscv.c       |  2 +-
 board/engicam/common/board.c                  | 32 +++++-----
 board/esd/meesc/meesc.c                       |  6 +-
 board/freescale/b4860qds/b4860qds.c           |  5 +-
 board/freescale/common/cmd_esbc_validate.c    |  2 +-
 board/freescale/common/fsl_chain_of_trust.c   |  6 +-
 board/freescale/common/sys_eeprom.c           |  4 +-
 board/freescale/common/vid.c                  |  4 +-
 board/freescale/imx8mq_evk/imx8mq_evk.c       |  4 +-
 board/freescale/imx8qm_mek/imx8qm_mek.c       |  4 +-
 board/freescale/imx8qxp_mek/imx8qxp_mek.c     |  4 +-
 board/freescale/ls1088a/eth_ls1088aqds.c      |  4 +-
 board/freescale/ls1088a/ls1088a.c             |  2 +-
 board/freescale/ls2080aqds/eth.c              |  6 +-
 board/freescale/ls2080aqds/ls2080aqds.c       |  2 +-
 board/freescale/ls2080ardb/ls2080ardb.c       |  6 +-
 board/freescale/lx2160a/eth_lx2160aqds.c      |  2 +-
 board/freescale/mpc8323erdb/mpc8323erdb.c     |  3 +-
 board/freescale/mpc837xemds/pci.c             |  2 +-
 board/freescale/mpc837xerdb/mpc837xerdb.c     |  2 +-
 board/freescale/mx51evk/mx51evk_video.c       |  2 +-
 board/freescale/mx53loco/mx53loco.c           |  4 +-
 board/freescale/mx53loco/mx53loco_video.c     |  2 +-
 board/freescale/mx6sabreauto/mx6sabreauto.c   |  8 +--
 board/freescale/mx6sabresd/mx6sabresd.c       |  8 +--
 board/freescale/mx6sxsabresd/mx6sxsabresd.c   |  2 +-
 .../mx6ul_14x14_evk/mx6ul_14x14_evk.c         |  6 +-
 board/freescale/mx6ullevk/mx6ullevk.c         |  4 +-
 board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c   |  2 +-
 board/freescale/qemu-ppce500/qemu-ppce500.c   |  4 +-
 board/freescale/t4qds/t4240qds.c              |  2 +-
 board/gardena/smart-gateway-at91sam/board.c   |  2 +-
 board/gardena/smart-gateway-mt7688/board.c    | 16 ++---
 board/gateworks/gw_ventana/common.c           |  2 +-
 board/gateworks/gw_ventana/gw_ventana.c       | 61 ++++++++++---------
 board/gateworks/gw_ventana/gw_ventana_spl.c   |  4 +-
 board/gdsys/a38x/keyprogram.c                 |  4 +-
 board/gdsys/mpc8308/gazerbeam.c               |  4 +-
 board/gdsys/mpc8308/hrcon.c                   |  2 +-
 board/gdsys/mpc8308/strider.c                 |  2 +-
 board/gdsys/p1022/controlcenterd-id.c         | 10 +--
 board/gdsys/p1022/controlcenterd.c            |  2 +-
 board/ge/bx50v3/bx50v3.c                      | 13 ++--
 board/ge/common/ge_common.c                   |  4 +-
 board/ge/mx53ppd/mx53ppd.c                    |  2 +-
 board/grinn/chiliboard/board.c                |  4 +-
 board/grinn/liteboard/board.c                 |  6 +-
 board/highbank/highbank.c                     |  9 +--
 board/hisilicon/poplar/poplar.c               |  2 +-
 board/imgtec/ci20/ci20.c                      |  6 +-
 board/intel/edison/edison.c                   | 14 ++---
 board/isee/igep003x/board.c                   |  6 +-
 board/isee/igep00x0/igep00x0.c                |  4 +-
 board/k+p/kp_imx53/kp_id_rev.c                | 20 +++---
 board/k+p/kp_imx53/kp_imx53.c                 |  4 +-
 board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c         |  4 +-
 board/keymile/common/common.c                 | 26 ++++----
 board/keymile/common/ivm.c                    |  8 +--
 board/keymile/km83xx/km83xx.c                 |  2 +-
 board/keymile/km_arm/km_arm.c                 |  6 +-
 board/keymile/kmp204x/kmp204x.c               |  4 +-
 board/kosagi/novena/novena.c                  |  2 +-
 board/laird/wb50n/wb50n.c                     |  2 +-
 board/lg/sniper/sniper.c                      |  4 +-
 board/liebherr/display5/spl.c                 |  4 +-
 board/liebherr/mccmon6/mccmon6.c              |  6 +-
 board/logicpd/imx6/imx6logic.c                |  8 +--
 board/menlo/m53menlo/m53menlo.c               |  2 +-
 board/micronas/vct/vct.c                      |  2 +-
 board/nokia/rx51/rx51.c                       | 10 +--
 board/overo/overo.c                           | 45 +++++++-------
 board/phytec/pcm052/pcm052.c                  |  4 +-
 board/phytec/pfla02/pfla02.c                  |  2 +-
 .../dragonboard410c/dragonboard410c.c         |  6 +-
 .../dragonboard820c/dragonboard820c.c         |  2 +-
 board/raspberrypi/rpi/rpi.c                   | 26 ++++----
 board/renesas/alt/alt.c                       |  3 +-
 board/renesas/gose/gose.c                     |  3 +-
 board/renesas/koelsch/koelsch.c               |  3 +-
 board/renesas/lager/lager.c                   |  3 +-
 board/renesas/porter/porter.c                 |  3 +-
 board/renesas/sh7752evb/sh7752evb.c           |  4 +-
 board/renesas/sh7753evb/sh7753evb.c           |  4 +-
 board/renesas/sh7757lcr/sh7757lcr.c           |  6 +-
 board/renesas/silk/silk.c                     |  3 +-
 board/renesas/stout/stout.c                   |  3 +-
 board/rockchip/kylin_rk3036/kylin_rk3036.c    |  2 +-
 board/samsung/common/exynos5-dt.c             |  2 +-
 board/samsung/common/misc.c                   | 14 ++---
 board/samsung/odroid/odroid.c                 |  2 +-
 board/samsung/trats/trats.c                   |  2 +-
 board/samsung/universal_c210/universal.c      |  2 +-
 board/samtec/vining_fpga/socfpga.c            | 16 ++---
 board/siemens/common/board.c                  |  4 +-
 board/siemens/draco/board.c                   |  6 +-
 board/siemens/pxm2/board.c                    |  4 +-
 board/siemens/rut/board.c                     |  2 +-
 board/siemens/taurus/taurus.c                 | 50 +++++++--------
 board/socrates/socrates.c                     |  4 +-
 board/softing/vining_2000/vining_2000.c       |  8 +--
 board/solidrun/mx6cuboxi/mx6cuboxi.c          | 16 ++---
 .../stm32f429-discovery/stm32f429-discovery.c |  4 +-
 .../stm32f429-evaluation.c                    |  4 +-
 .../stm32f469-discovery/stm32f469-discovery.c |  4 +-
 board/st/stm32mp1/stm32mp1.c                  | 11 ++--
 board/sunxi/board.c                           | 25 ++++----
 board/synopsys/hsdk/env-lib.c                 | 11 ++--
 board/synopsys/hsdk/hsdk.c                    |  6 +-
 board/syteco/zmx25/zmx25.c                    |  8 ++-
 board/tcl/sl50/board.c                        |  6 +-
 .../puma_rk3399/puma-rk3399.c                 |  8 +--
 board/ti/am335x/board.c                       | 18 +++---
 board/ti/am43xx/board.c                       |  6 +-
 board/ti/am57xx/board.c                       | 14 ++---
 board/ti/beagle/beagle.c                      | 43 ++++++-------
 board/ti/common/board_detect.c                | 14 ++---
 board/ti/dra7xx/evm.c                         | 12 ++--
 board/ti/evm/evm.c                            |  2 +-
 board/ti/ks2_evm/board.c                      | 10 +--
 board/ti/ks2_evm/board_k2g.c                  |  8 +--
 board/ti/panda/panda.c                        |  4 +-
 board/toradex/apalis-imx8/apalis-imx8.c       |  4 +-
 board/toradex/apalis_imx6/apalis_imx6.c       | 12 ++--
 .../toradex/colibri-imx6ull/colibri-imx6ull.c |  6 +-
 board/toradex/colibri-imx8x/colibri-imx8x.c   |  4 +-
 board/toradex/colibri_imx6/colibri_imx6.c     |  8 +--
 board/toradex/colibri_vf/colibri_vf.c         |  2 +-
 board/toradex/common/tdx-cfg-block.c          |  2 +-
 board/toradex/common/tdx-common.c             |  2 +-
 board/tqc/tqma6/tqma6.c                       |  2 +-
 board/udoo/neo/neo.c                          |  2 +-
 board/udoo/udoo.c                             |  4 +-
 board/varisys/common/sys_eeprom.c             |  6 +-
 board/vscom/baltos/board.c                    |  6 +-
 board/wandboard/wandboard.c                   | 12 ++--
 board/warp7/warp7.c                           |  6 +-
 .../work_92105/work_92105_display.c           |  2 +-
 board/xes/common/board.c                      |  6 +-
 board/xilinx/zynq/board.c                     | 16 ++---
 board/xilinx/zynqmp/cmds.c                    |  2 +-
 board/xilinx/zynqmp/zynqmp.c                  | 24 ++++----
 187 files changed, 677 insertions(+), 649 deletions(-)

diff --git a/board/Arcturus/ucp1020/cmd_arc.c b/board/Arcturus/ucp1020/cmd_arc.c
index 2e8477ed3b7a..fbe1f2dba123 100644
--- a/board/Arcturus/ucp1020/cmd_arc.c
+++ b/board/Arcturus/ucp1020/cmd_arc.c
@@ -252,8 +252,8 @@ static int read_arc_info(void)
 static int do_get_arc_info(void)
 {
 	int l = read_arc_info();
-	char *oldserial = env_get("SERIAL");
-	char *oldversion = env_get("VERSION");
+	char *oldserial = env_get(ctx_uboot, "SERIAL");
+	char *oldversion = env_get(ctx_uboot, "VERSION");
 
 	if (oldversion != NULL)
 		if (strcmp(oldversion, U_BOOT_VERSION) != 0)
@@ -269,13 +269,13 @@ static int do_get_arc_info(void)
 		printf("<not found>\n");
 	} else {
 		printf("%s\n", smac[0]);
-		env_set("SERIAL", smac[0]);
+		env_set(ctx_uboot, "SERIAL", smac[0]);
 	}
 
 	if (strcmp(smac[1], "00:00:00:00:00:00") == 0) {
-		env_set("ethaddr", NULL);
-		env_set("eth1addr", NULL);
-		env_set("eth2addr", NULL);
+		env_set(ctx_uboot, "ethaddr", NULL);
+		env_set(ctx_uboot, "eth1addr", NULL);
+		env_set(ctx_uboot, "eth2addr", NULL);
 		goto done;
 	}
 
@@ -283,13 +283,13 @@ static int do_get_arc_info(void)
 	if (smac[1][0] == EMPY_CHAR) {
 		printf("<not found>\n");
 	} else {
-		char *ret = env_get("ethaddr");
+		char *ret = env_get(ctx_uboot, "ethaddr");
 
 		if (ret == NULL) {
-			env_set("ethaddr", smac[1]);
+			env_set(ctx_uboot, "ethaddr", smac[1]);
 			printf("%s\n", smac[1]);
 		} else if (strcmp(ret, __stringify(CONFIG_ETHADDR)) == 0) {
-			env_set("ethaddr", smac[1]);
+			env_set(ctx_uboot, "ethaddr", smac[1]);
 			printf("%s (factory)\n", smac[1]);
 		} else {
 			printf("%s\n", ret);
@@ -297,8 +297,8 @@ static int do_get_arc_info(void)
 	}
 
 	if (strcmp(smac[2], "00:00:00:00:00:00") == 0) {
-		env_set("eth1addr", NULL);
-		env_set("eth2addr", NULL);
+		env_set(ctx_uboot, "eth1addr", NULL);
+		env_set(ctx_uboot, "eth2addr", NULL);
 		goto done;
 	}
 
@@ -306,13 +306,13 @@ static int do_get_arc_info(void)
 	if (smac[2][0] == EMPY_CHAR) {
 		printf("<not found>\n");
 	} else {
-		char *ret = env_get("eth1addr");
+		char *ret = env_get(ctx_uboot, "eth1addr");
 
 		if (ret == NULL) {
-			env_set("ethaddr", smac[2]);
+			env_set(ctx_uboot, "ethaddr", smac[2]);
 			printf("%s\n", smac[2]);
 		} else if (strcmp(ret, __stringify(CONFIG_ETH1ADDR)) == 0) {
-			env_set("eth1addr", smac[2]);
+			env_set(ctx_uboot, "eth1addr", smac[2]);
 			printf("%s (factory)\n", smac[2]);
 		} else {
 			printf("%s\n", ret);
@@ -320,7 +320,7 @@ static int do_get_arc_info(void)
 	}
 
 	if (strcmp(smac[3], "00:00:00:00:00:00") == 0) {
-		env_set("eth2addr", NULL);
+		env_set(ctx_uboot, "eth2addr", NULL);
 		goto done;
 	}
 
@@ -328,13 +328,13 @@ static int do_get_arc_info(void)
 	if (smac[3][0] == EMPY_CHAR) {
 		printf("<not found>\n");
 	} else {
-		char *ret = env_get("eth2addr");
+		char *ret = env_get(ctx_uboot, "eth2addr");
 
 		if (ret == NULL) {
-			env_set("ethaddr", smac[3]);
+			env_set(ctx_uboot, "ethaddr", smac[3]);
 			printf("%s\n", smac[3]);
 		} else if (strcmp(ret, __stringify(CONFIG_ETH2ADDR)) == 0) {
-			env_set("eth2addr", smac[3]);
+			env_set(ctx_uboot, "eth2addr", smac[3]);
 			printf("%s (factory)\n", smac[3]);
 		} else {
 			printf("%s\n", ret);
@@ -343,8 +343,8 @@ static int do_get_arc_info(void)
 done:
 	if (oldserial == NULL || oldversion == NULL) {
 		if (oldversion == NULL)
-			env_set("VERSION", U_BOOT_VERSION);
-		env_save();
+			env_set(ctx_uboot, "VERSION", U_BOOT_VERSION);
+		env_save(ctx_uboot);
 	}
 
 	return 0;
diff --git a/board/Arcturus/ucp1020/ucp1020.c b/board/Arcturus/ucp1020/ucp1020.c
index 6a880c97bcb7..1aa7f96b5e1c 100644
--- a/board/Arcturus/ucp1020/ucp1020.c
+++ b/board/Arcturus/ucp1020/ucp1020.c
@@ -64,7 +64,7 @@ void board_gpio_init(void)
 
 	for (i = 0; i < GPIO_MAX_NUM; i++) {
 		sprintf(envname, "GPIO%d", i);
-		val = env_get(envname);
+		val = env_get(ctx_uboot, envname);
 		if (val) {
 			char direction = toupper(val[0]);
 			char level = toupper(val[1]);
@@ -82,7 +82,7 @@ void board_gpio_init(void)
 		}
 	}
 
-	val = env_get("PCIE_OFF");
+	val = env_get(ctx_uboot, "PCIE_OFF");
 	if (val) {
 		gpio_direction_input(GPIO_PCIE1_EN);
 		gpio_direction_input(GPIO_PCIE2_EN);
@@ -91,7 +91,7 @@ void board_gpio_init(void)
 		gpio_direction_output(GPIO_PCIE2_EN, 1);
 	}
 
-	val = env_get("SDHC_CDWP_OFF");
+	val = env_get(ctx_uboot, "SDHC_CDWP_OFF");
 	if (!val) {
 		ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
 
@@ -218,7 +218,7 @@ int last_stage_init(void)
 	else
 		printf("NCT72(0x%x): ready\n", id2);
 
-	kval = env_get("kernelargs");
+	kval = env_get(ctx_uboot, "kernelargs");
 
 #ifdef CONFIG_MMC
 	mmc = find_mmc_device(0);
@@ -235,22 +235,22 @@ int last_stage_init(void)
 				strcat(newkernelargs, mmckargs);
 				strcat(newkernelargs, " ");
 				strcat(newkernelargs, &tmp[n]);
-				env_set("kernelargs", newkernelargs);
+				env_set(ctx_uboot, "kernelargs", newkernelargs);
 			} else {
-				env_set("kernelargs", mmckargs);
+				env_set(ctx_uboot, "kernelargs", mmckargs);
 			}
 		}
 #endif
 	get_arc_info();
 
 	if (kval) {
-		sval = env_get("SERIAL");
+		sval = env_get(ctx_uboot, "SERIAL");
 		if (sval) {
 			strcpy(newkernelargs, "SN=");
 			strcat(newkernelargs, sval);
 			strcat(newkernelargs, " ");
 			strcat(newkernelargs, kval);
-			env_set("kernelargs", newkernelargs);
+			env_set(ctx_uboot, "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 ef4f5c950140..4278dda5988f 100644
--- a/board/BuR/brppt1/board.c
+++ b/board/BuR/brppt1/board.c
@@ -180,10 +180,10 @@ int board_late_init(void)
 		bmode = 4;
 
 	printf("Mode:  %s\n", bootmodeascii[bmode & 0x0F]);
-	env_set_ulong("b_mode", bmode);
+	env_set_ulong(ctx_uboot, "b_mode", bmode);
 
 	/* get sure that bootcmd isn't affected by any bootcount value */
-	env_set_ulong("bootlimit", 0);
+	env_set_ulong(ctx_uboot, "bootlimit", 0);
 
 	return 0;
 }
diff --git a/board/BuR/brxre1/board.c b/board/BuR/brxre1/board.c
index 873208c668d7..69bcccbc5a0d 100644
--- a/board/BuR/brxre1/board.c
+++ b/board/BuR/brxre1/board.c
@@ -165,10 +165,11 @@ int board_late_init(void)
 	snprintf(othbootargs, sizeof(othbootargs),
 		 "u=vxWorksFTP pw=vxWorks o=0x%08x;0x%08x;0x%08x;0x%08x",
 		 (u32)gd->fb_base - 0x20,
-		 (u32)env_get_ulong("vx_memtop", 16, gd->fb_base - 0x20),
-		 (u32)env_get_ulong("vx_romfsbase", 16, 0),
-		 (u32)env_get_ulong("vx_romfssize", 16, 0));
-	env_set("othbootargs", othbootargs);
+		 (u32)env_get_ulong(ctx_uboot, "vx_memtop", 16,
+				    gd->fb_base - 0x20),
+		 (u32)env_get_ulong(ctx_uboot, "vx_romfsbase", 16, 0),
+		 (u32)env_get_ulong(ctx_uboot, "vx_romfssize", 16, 0));
+	env_set(ctx_uboot, "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/br_resetc.c b/board/BuR/common/br_resetc.c
index c0e7fb65b298..36d49967dd82 100644
--- a/board/BuR/common/br_resetc.c
+++ b/board/BuR/common/br_resetc.c
@@ -230,7 +230,7 @@ int br_resetc_bmode(void)
 		printf("Reset: STM32 controller\n");
 
 	printf("Mode:  %s\n", bootmodeascii[regw & 0x0F]);
-	env_set_ulong("b_mode", regw & 0x0F);
+	env_set_ulong(ctx_uboot, "b_mode", regw & 0x0F);
 
 	return rc;
 }
diff --git a/board/BuR/common/common.c b/board/BuR/common/common.c
index 148fc9075e4f..f3bc87daf19f 100644
--- a/board/BuR/common/common.c
+++ b/board/BuR/common/common.c
@@ -29,9 +29,12 @@ DECLARE_GLOBAL_DATA_PTR;
 
 void lcdbacklight(int on)
 {
-	unsigned int driver = env_get_ulong("ds1_bright_drv", 16, 0UL);
-	unsigned int bright = env_get_ulong("ds1_bright_def", 10, 50);
-	unsigned int pwmfrq = env_get_ulong("ds1_pwmfreq", 10, ~0UL);
+	unsigned int driver = env_get_ulong(ctx_uboot, "ds1_bright_drv", 16,
+					    0UL);
+	unsigned int bright = env_get_ulong(ctx_uboot, "ds1_bright_def", 10,
+					    50);
+	unsigned int pwmfrq = env_get_ulong(ctx_uboot, "ds1_pwmfreq", 10,
+					    ~0UL);
 	unsigned int tmp;
 	struct gptimer *timerhw;
 
@@ -87,20 +90,20 @@ int load_lcdtiming(struct am335x_lcdpanel *panel)
 {
 	struct am335x_lcdpanel pnltmp;
 
-	pnltmp.hactive = env_get_ulong("ds1_hactive", 10, ~0UL);
-	pnltmp.vactive = env_get_ulong("ds1_vactive", 10, ~0UL);
-	pnltmp.bpp = env_get_ulong("ds1_bpp", 10, ~0UL);
-	pnltmp.hfp = env_get_ulong("ds1_hfp", 10, ~0UL);
-	pnltmp.hbp = env_get_ulong("ds1_hbp", 10, ~0UL);
-	pnltmp.hsw = env_get_ulong("ds1_hsw", 10, ~0UL);
-	pnltmp.vfp = env_get_ulong("ds1_vfp", 10, ~0UL);
-	pnltmp.vbp = env_get_ulong("ds1_vbp", 10, ~0UL);
-	pnltmp.vsw = env_get_ulong("ds1_vsw", 10, ~0UL);
-	pnltmp.pxl_clk = env_get_ulong("ds1_pxlclk", 10, ~0UL);
-	pnltmp.pol = env_get_ulong("ds1_pol", 16, ~0UL);
-	pnltmp.pup_delay = env_get_ulong("ds1_pupdelay", 10, ~0UL);
-	pnltmp.pon_delay = env_get_ulong("ds1_tondelay", 10, ~0UL);
-	panel_info.vl_rot = env_get_ulong("ds1_rotation", 10, 0);
+	pnltmp.hactive = env_get_ulong(ctx_uboot, "ds1_hactive", 10, ~0UL);
+	pnltmp.vactive = env_get_ulong(ctx_uboot, "ds1_vactive", 10, ~0UL);
+	pnltmp.bpp = env_get_ulong(ctx_uboot, "ds1_bpp", 10, ~0UL);
+	pnltmp.hfp = env_get_ulong(ctx_uboot, "ds1_hfp", 10, ~0UL);
+	pnltmp.hbp = env_get_ulong(ctx_uboot, "ds1_hbp", 10, ~0UL);
+	pnltmp.hsw = env_get_ulong(ctx_uboot, "ds1_hsw", 10, ~0UL);
+	pnltmp.vfp = env_get_ulong(ctx_uboot, "ds1_vfp", 10, ~0UL);
+	pnltmp.vbp = env_get_ulong(ctx_uboot, "ds1_vbp", 10, ~0UL);
+	pnltmp.vsw = env_get_ulong(ctx_uboot, "ds1_vsw", 10, ~0UL);
+	pnltmp.pxl_clk = env_get_ulong(ctx_uboot, "ds1_pxlclk", 10, ~0UL);
+	pnltmp.pol = env_get_ulong(ctx_uboot, "ds1_pol", 16, ~0UL);
+	pnltmp.pup_delay = env_get_ulong(ctx_uboot, "ds1_pupdelay", 10, ~0UL);
+	pnltmp.pon_delay = env_get_ulong(ctx_uboot, "ds1_tondelay", 10, ~0UL);
+	panel_info.vl_rot = env_get_ulong(ctx_uboot, "ds1_rotation", 10, 0);
 
 	if (
 	   ~0UL == (pnltmp.hactive) ||
@@ -151,11 +154,11 @@ static void br_summaryscreen_printenv(char *prefix,
 				       char *name, char *altname,
 				       char *suffix)
 {
-	char *envval = env_get(name);
+	char *envval = env_get(ctx_uboot, name);
 	if (0 != envval) {
 		lcd_printf("%s %s %s", prefix, envval, suffix);
 	} else if (0 != altname) {
-		envval = env_get(altname);
+		envval = env_get(ctx_uboot, altname);
 		if (0 != envval)
 			lcd_printf("%s %s %s", prefix, envval, suffix);
 	} else {
@@ -178,7 +181,7 @@ void lcdpower(int on)
 	u32 pin, swval, i;
 	char buf[16] = { 0 };
 
-	pin = env_get_ulong("ds1_pwr", 16, ~0UL);
+	pin = env_get_ulong(ctx_uboot, "ds1_pwr", 16, ~0UL);
 
 	if (pin == ~0UL) {
 		puts("no pwrpin in dtb/env, cannot powerup display!\n");
@@ -295,8 +298,8 @@ int brdefaultip_setup(int bus, int chip)
 			"if test -r ${ipaddr}; then; else setenv ipaddr 192.168.60.1; setenv serverip 192.168.60.254; setenv gatewayip 192.168.60.254; setenv netmask 255.255.255.0; fi;",
 			sizeof(defip));
 
-	env_set("brdefaultip", defip);
-	env_set_hex("board_id", u8buf);
+	env_set(ctx_uboot, "brdefaultip", defip);
+	env_set_hex(ctx_uboot, "board_id", u8buf);
 
 	return 0;
 }
diff --git a/board/BuS/eb_cpu5282/eb_cpu5282.c b/board/BuS/eb_cpu5282/eb_cpu5282.c
index 0b916d2482c5..03d2b276a132 100644
--- a/board/BuS/eb_cpu5282/eb_cpu5282.c
+++ b/board/BuS/eb_cpu5282/eb_cpu5282.c
@@ -139,7 +139,7 @@ void hw_watchdog_init(void)
 	int enable;
 
 	enable = 1;
-	s = env_get("watchdog");
+	s = env_get(ctx_uboot, "watchdog");
 	if (s != NULL)
 		if ((strncmp(s, "off", 3) == 0) || (strncmp(s, "0", 1) == 0))
 			enable = 0;
@@ -191,13 +191,13 @@ int drv_video_init(void)
 	unsigned long splash;
 #endif
 	printf("Init Video as ");
-	s = env_get("displaywidth");
+	s = env_get(ctx_uboot, "displaywidth");
 	if (s != NULL)
 		display_width = simple_strtoul(s, NULL, 10);
 	else
 		display_width = 256;
 
-	s = env_get("displayheight");
+	s = env_get(ctx_uboot, "displayheight");
 	if (s != NULL)
 		display_height = simple_strtoul(s, NULL, 10);
 	else
@@ -211,7 +211,7 @@ int drv_video_init(void)
 	vcxk_init(display_width, display_height);
 
 #ifdef CONFIG_SPLASH_SCREEN
-	s = env_get("splashimage");
+	s = env_get(ctx_uboot, "splashimage");
 	if (s != NULL) {
 		splash = simple_strtoul(s, NULL, 16);
 		vcxk_acknowledge_wait();
diff --git a/board/CZ.NIC/turris_mox/turris_mox.c b/board/CZ.NIC/turris_mox/turris_mox.c
index 946e20ab492f..b23ecb3fefaa 100644
--- a/board/CZ.NIC/turris_mox/turris_mox.c
+++ b/board/CZ.NIC/turris_mox/turris_mox.c
@@ -362,10 +362,10 @@ int misc_init_r(void)
 		return 0;
 	}
 
-	if (is_valid_ethaddr(mac1) && !env_get("ethaddr"))
+	if (is_valid_ethaddr(mac1) && !env_get(ctx_uboot, "ethaddr"))
 		eth_env_set_enetaddr("ethaddr", mac1);
 
-	if (is_valid_ethaddr(mac2) && !env_get("eth1addr"))
+	if (is_valid_ethaddr(mac2) && !env_get(ctx_uboot, "eth1addr"))
 		eth_env_set_enetaddr("eth1addr", mac2);
 
 	return 0;
diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c
index 1d8d08a847d9..bbbeaf75fc97 100644
--- a/board/CZ.NIC/turris_omnia/turris_omnia.c
+++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
@@ -326,7 +326,7 @@ static int set_regdomain(void)
 		puts("EEPROM regdomain read failed.\n");
 
 	printf("Regdomain set to %s\n", rd);
-	return env_set("regdomain", rd);
+	return env_set(ctx_uboot, "regdomain", rd);
 }
 
 /*
@@ -359,11 +359,11 @@ static void handle_reset_button(void)
 		return;
 	}
 
-	env_set_ulong("omnia_reset", reset_status);
+	env_set_ulong(ctx_uboot, "omnia_reset", reset_status);
 
 	if (reset_status) {
 		printf("RESET button was pressed, overwriting bootcmd!\n");
-		env_set("bootcmd", OMNIA_FACTORY_RESET_BOOTCMD);
+		env_set(ctx_uboot, "bootcmd", OMNIA_FACTORY_RESET_BOOTCMD);
 	}
 }
 #endif
diff --git a/board/CarMediaLab/flea3/flea3.c b/board/CarMediaLab/flea3/flea3.c
index be0bc228ec71..9a5fe1e2252d 100644
--- a/board/CarMediaLab/flea3/flea3.c
+++ b/board/CarMediaLab/flea3/flea3.c
@@ -211,7 +211,7 @@ int ft_board_setup(void *blob, bd_t *bd)
 		{ "mxc_nand", MTD_DEV_TYPE_NAND, }, /* NAND flash */
 	};
 
-	if (env_get("fdt_noauto")) {
+	if (env_get(ctx_uboot, "fdt_noauto")) {
 		puts("   Skiping ft_board_setup (fdt_noauto defined)\n");
 		return 0;
 	}
diff --git a/board/LaCie/net2big_v2/net2big_v2.c b/board/LaCie/net2big_v2/net2big_v2.c
index 686608d25a5a..659a351deaea 100644
--- a/board/LaCie/net2big_v2/net2big_v2.c
+++ b/board/LaCie/net2big_v2/net2big_v2.c
@@ -221,7 +221,7 @@ int misc_init_r(void)
 {
 	init_fan();
 #if defined(CONFIG_CMD_I2C) && defined(CONFIG_SYS_I2C_EEPROM_ADDR)
-	if (!env_get("ethaddr")) {
+	if (!env_get(ctx_uboot, "ethaddr")) {
 		uchar mac[6];
 		if (lacie_read_mac_address(mac) == 0)
 			eth_env_set_enetaddr("ethaddr", mac);
diff --git a/board/LaCie/netspace_v2/netspace_v2.c b/board/LaCie/netspace_v2/netspace_v2.c
index bd7ab22948b2..83b07300354e 100644
--- a/board/LaCie/netspace_v2/netspace_v2.c
+++ b/board/LaCie/netspace_v2/netspace_v2.c
@@ -83,7 +83,7 @@ int board_init(void)
 int misc_init_r(void)
 {
 #if defined(CONFIG_CMD_I2C) && defined(CONFIG_SYS_I2C_EEPROM_ADDR)
-	if (!env_get("ethaddr")) {
+	if (!env_get(ctx_uboot, "ethaddr")) {
 		uchar mac[6];
 		if (lacie_read_mac_address(mac) == 0)
 			eth_env_set_enetaddr("ethaddr", mac);
diff --git a/board/Synology/ds414/cmd_syno.c b/board/Synology/ds414/cmd_syno.c
index 777948f90f58..abd38b24fff0 100644
--- a/board/Synology/ds414/cmd_syno.c
+++ b/board/Synology/ds414/cmd_syno.c
@@ -80,7 +80,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);
-		env_set(var, val);
+		env_set(ctx_uboot, var, val);
 	}
 	if (!strncmp(buf + 32, SYNO_SN_TAG, strlen(SYNO_SN_TAG))) {
 		char *snp, *csump;
@@ -110,7 +110,7 @@ static int do_syno_populate(int argc, char * const argv[])
 			goto out_unmap;
 		}
 		printf("parsed SN = %s\n", snp);
-		env_set("SN", snp);
+		env_set(ctx_uboot, "SN", snp);
 	} else {	/* old style format */
 		unsigned char csum = 0;
 
@@ -124,7 +124,7 @@ static int do_syno_populate(int argc, char * const argv[])
 		}
 		bufp[n] = '\0';
 		printf("parsed SN = %s\n", buf + 32);
-		env_set("SN", buf + 32);
+		env_set(ctx_uboot, "SN", buf + 32);
 	}
 out_unmap:
 	unmap_physmem(buf, len);
diff --git a/board/alliedtelesis/x530/x530.c b/board/alliedtelesis/x530/x530.c
index e0fa8067c1c5..53bc9dd286e2 100644
--- a/board/alliedtelesis/x530/x530.c
+++ b/board/alliedtelesis/x530/x530.c
@@ -157,7 +157,7 @@ int misc_init_r(void)
 	gpio_hog(&led_en, "atl,led-enable", "enable-gpio", 1);
 
 #ifdef MTDPARTS_MTDOOPS
-	env_set("mtdoops", MTDPARTS_MTDOOPS);
+	env_set(ctx_uboot, "mtdoops", MTDPARTS_MTDOOPS);
 #endif
 
 	led_7seg_init(0xff);
diff --git a/board/amazon/kc1/kc1.c b/board/amazon/kc1/kc1.c
index 9034c4fbfff0..9f183da00a9e 100644
--- a/board/amazon/kc1/kc1.c
+++ b/board/amazon/kc1/kc1.c
@@ -118,8 +118,8 @@ int misc_init_r(void)
 	}
 
 	if (reboot_mode[0] > 0 && isascii(reboot_mode[0])) {
-		if (!env_get("reboot-mode"))
-			env_set("reboot-mode", (char *)reboot_mode);
+		if (!env_get(ctx_uboot, "reboot-mode"))
+			env_set(ctx_uboot, "reboot-mode", (char *)reboot_mode);
 	}
 
 	omap_reboot_mode_clear();
diff --git a/board/amlogic/p200/p200.c b/board/amlogic/p200/p200.c
index 41d331dda2d4..4b1a158f1750 100644
--- a/board/amlogic/p200/p200.c
+++ b/board/amlogic/p200/p200.c
@@ -32,11 +32,11 @@ int misc_init_r(void)
 			eth_env_set_enetaddr("ethaddr", mac_addr);
 	}
 
-	if (!env_get("serial#")) {
+	if (!env_get(ctx_uboot, "serial#")) {
 		len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial,
 			EFUSE_SN_SIZE);
 		if (len == EFUSE_SN_SIZE)
-			env_set("serial#", serial);
+			env_set(ctx_uboot, "serial#", serial);
 	}
 
 	return 0;
diff --git a/board/amlogic/p201/p201.c b/board/amlogic/p201/p201.c
index e46fcaea6dcd..ba2a5387a120 100644
--- a/board/amlogic/p201/p201.c
+++ b/board/amlogic/p201/p201.c
@@ -32,11 +32,11 @@ int misc_init_r(void)
 			eth_env_set_enetaddr("ethaddr", mac_addr);
 	}
 
-	if (!env_get("serial#")) {
+	if (!env_get(ctx_uboot, "serial#")) {
 		len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial,
 			EFUSE_SN_SIZE);
 		if (len == EFUSE_SN_SIZE)
-			env_set("serial#", serial);
+			env_set(ctx_uboot, "serial#", serial);
 	}
 
 	return 0;
diff --git a/board/amlogic/p212/p212.c b/board/amlogic/p212/p212.c
index 094ab5478d00..3fabf79a4b41 100644
--- a/board/amlogic/p212/p212.c
+++ b/board/amlogic/p212/p212.c
@@ -36,11 +36,11 @@ int misc_init_r(void)
 			meson_generate_serial_ethaddr();
 	}
 
-	if (!env_get("serial#")) {
+	if (!env_get(ctx_uboot, "serial#")) {
 		len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial,
 			EFUSE_SN_SIZE);
 		if (len == EFUSE_SN_SIZE)
-			env_set("serial#", serial);
+			env_set(ctx_uboot, "serial#", serial);
 	}
 
 	return 0;
diff --git a/board/amlogic/q200/q200.c b/board/amlogic/q200/q200.c
index f1faa7418e07..2cf2af3e1899 100644
--- a/board/amlogic/q200/q200.c
+++ b/board/amlogic/q200/q200.c
@@ -35,11 +35,11 @@ int misc_init_r(void)
 			meson_generate_serial_ethaddr();
 	}
 
-	if (!env_get("serial#")) {
+	if (!env_get(ctx_uboot, "serial#")) {
 		len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial,
 					  EFUSE_SN_SIZE);
 		if (len == EFUSE_SN_SIZE)
-			env_set("serial#", serial);
+			env_set(ctx_uboot, "serial#", serial);
 	}
 
 	return 0;
diff --git a/board/aristainetos/aristainetos-v2.c b/board/aristainetos/aristainetos-v2.c
index c0a2e41f02e8..061baf0255db 100644
--- a/board/aristainetos/aristainetos-v2.c
+++ b/board/aristainetos/aristainetos-v2.c
@@ -651,7 +651,7 @@ int board_late_init(void)
 {
 	char *my_bootdelay;
 	char bootmode = 0;
-	char const *panel = env_get("panel");
+	char const *panel = env_get(ctx_uboot, "panel");
 
 	/*
 	 * Check the boot-source. If booting from NOR Flash,
@@ -668,11 +668,11 @@ int board_late_init(void)
 	bootmode |= (gpio_get_value(IMX_GPIO_NR(7, 1)) ? 1 : 0) << 2;
 
 	if (bootmode == 7) {
-		my_bootdelay = env_get("nor_bootdelay");
+		my_bootdelay = env_get(ctx_uboot, "nor_bootdelay");
 		if (my_bootdelay != NULL)
-			env_set("bootdelay", my_bootdelay);
+			env_set(ctx_uboot, "bootdelay", my_bootdelay);
 		else
-			env_set("bootdelay", "-2");
+			env_set(ctx_uboot, "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 0a2baa72976c..72c9678218ae 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)
 {
-	env_set("verify", "n");
+	env_set(ctx_uboot, "verify", "n");
 	return (0);
 }
 
diff --git a/board/atmel/common/board.c b/board/atmel/common/board.c
index c41706c4005c..aef6babfd37a 100644
--- a/board/atmel/common/board.c
+++ b/board/atmel/common/board.c
@@ -64,7 +64,7 @@ void at91_pda_detect(void)
 	}
 
 pda_detect_err:
-	env_set("pda", (const char *)buf);
+	env_set(ctx_uboot, "pda", (const char *)buf);
 }
 #else
 void at91_pda_detect(void)
@@ -74,5 +74,5 @@ void at91_pda_detect(void)
 
 void at91_prepare_cpu_var(void)
 {
-	env_set("cpu", get_cpu_name());
+	env_set(ctx_uboot, "cpu", get_cpu_name());
 }
diff --git a/board/atmel/common/mac_eeprom.c b/board/atmel/common/mac_eeprom.c
index 83a7778e9954..4c9a5c0b0d0e 100644
--- a/board/atmel/common/mac_eeprom.c
+++ b/board/atmel/common/mac_eeprom.c
@@ -18,7 +18,7 @@ int at91_set_ethaddr(int offset)
 	struct udevice *dev;
 	int ret;
 
-	if (env_get(ETHADDR_NAME))
+	if (env_get(ctx_uboot, ETHADDR_NAME))
 		return 0;
 
 	ret = uclass_first_device_err(UCLASS_I2C_EEPROM, &dev);
diff --git a/board/atmel/sama5d3xek/sama5d3xek.c b/board/atmel/sama5d3xek/sama5d3xek.c
index acf61486d20b..6c27c3dbe148 100644
--- a/board/atmel/sama5d3xek/sama5d3xek.c
+++ b/board/atmel/sama5d3xek/sama5d3xek.c
@@ -187,7 +187,7 @@ int board_late_init(void)
 		*p = tolower(*p);
 
 	strcat(name, "ek.dtb");
-	env_set("dtb_name", name);
+	env_set(ctx_uboot, "dtb_name", name);
 #endif
 #ifdef CONFIG_DM_VIDEO
 	at91_video_show_board_info();
diff --git a/board/bachmann/ot1200/ot1200.c b/board/bachmann/ot1200/ot1200.c
index 36f37084b36c..baf7b7cdf7f3 100644
--- a/board/bachmann/ot1200/ot1200.c
+++ b/board/bachmann/ot1200/ot1200.c
@@ -301,9 +301,9 @@ int board_eth_init(bd_t *bis)
 
 	/* depending on the phy address we can detect our board version */
 	if (phydev->addr == 0)
-		env_set("boardver", "");
+		env_set(ctx_uboot, "boardver", "");
 	else
-		env_set("boardver", "mr");
+		env_set(ctx_uboot, "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 8811583ac628..9a8b69df3891 100644
--- a/board/birdland/bav335x/board.c
+++ b/board/birdland/bav335x/board.c
@@ -161,7 +161,7 @@ int spl_start_uboot(void)
 
 #ifdef CONFIG_SPL_ENV_SUPPORT
 	env_init();
-	env_load();
+	env_load(ctx_uboot);
 	if (env_get_yesno("boot_os") != 1)
 		return 1;
 #endif
@@ -300,8 +300,8 @@ int board_init(void)
 int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-	env_set("board_name", "BAV335xB");
-	env_set("board_rev", "B"); /* Fix me, but why bother.. */
+	env_set(ctx_uboot, "board_name", "BAV335xB");
+	env_set(ctx_uboot, "board_rev", "B"); /* Fix me, but why bother.. */
 #endif
 	return 0;
 }
@@ -391,7 +391,7 @@ int board_eth_init(bd_t *bis)
 #if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \
 	(defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))
 
-	if (!env_get("ethaddr")) {
+	if (!env_get(ctx_uboot, "ethaddr")) {
 		printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
 		if (is_valid_ethaddr(mac_addr))
diff --git a/board/bluegiga/apx4devkit/apx4devkit.c b/board/bluegiga/apx4devkit/apx4devkit.c
index 9268aa0daafc..a7116e8c0c06 100644
--- a/board/bluegiga/apx4devkit/apx4devkit.c
+++ b/board/bluegiga/apx4devkit/apx4devkit.c
@@ -133,8 +133,9 @@ void get_board_serial(struct tag_serialnr *serialnr)
 #ifdef CONFIG_REVISION_TAG
 u32 get_board_rev(void)
 {
-	if (env_get("revision#") != NULL)
-		return simple_strtoul(env_get("revision#"), NULL, 10);
+	if (env_get(ctx_uboot, "revision#"))
+		return simple_strtoul(env_get(ctx_uboot, "revision#"), NULL,
+				      10);
 	return 0;
 }
 #endif
diff --git a/board/bluewater/gurnard/gurnard.c b/board/bluewater/gurnard/gurnard.c
index 48e31d9065a2..560db5fee639 100644
--- a/board/bluewater/gurnard/gurnard.c
+++ b/board/bluewater/gurnard/gurnard.c
@@ -340,7 +340,7 @@ int board_init(void)
 	at91_set_A_periph(AT91_PIN_PE6, 1);	/* power up */
 
 	/* Select the second timing index for board rev 2 */
-	rev_str = env_get("board_rev");
+	rev_str = env_get(ctx_uboot, "board_rev");
 	if (rev_str && !strncmp(rev_str, "2", 1)) {
 		struct udevice *dev;
 
@@ -367,7 +367,7 @@ int board_late_init(void)
 	 * Set MAC address so we do not need to init Ethernet before Linux
 	 * boot
 	 */
-	env_str = env_get("ethaddr");
+	env_str = env_get(ctx_uboot, "ethaddr");
 	if (env_str) {
 		struct at91_emac *emac = (struct at91_emac *)ATMEL_BASE_EMAC;
 		/* Parse MAC address */
@@ -384,7 +384,7 @@ int board_late_init(void)
 		       &emac->sa2l);
 		writel((env_enetaddr[4] | env_enetaddr[5] << 8), &emac->sa2h);
 
-		printf("MAC:   %s\n", env_get("ethaddr"));
+		printf("MAC:   %s\n", env_get(ctx_uboot, "ethaddr"));
 	} else {
 		/* Not set in environment */
 		printf("MAC:   not set\n");
diff --git a/board/bosch/shc/board.c b/board/bosch/shc/board.c
index a96fdef992d2..6afbdb9737ac 100644
--- a/board/bosch/shc/board.c
+++ b/board/bosch/shc/board.c
@@ -246,7 +246,7 @@ static void check_button_status(void)
 
 	if (value == 0) {
 		printf("front button activated !\n");
-		env_set("harakiri", "1");
+		env_set(ctx_uboot, "harakiri", "1");
 	}
 }
 
diff --git a/board/boundary/nitrogen6x/nitrogen6x.c b/board/boundary/nitrogen6x/nitrogen6x.c
index 26af3f710250..e9a1cde72390 100644
--- a/board/boundary/nitrogen6x/nitrogen6x.c
+++ b/board/boundary/nitrogen6x/nitrogen6x.c
@@ -749,7 +749,7 @@ size_t display_count = ARRAY_SIZE(displays);
 
 int board_cfb_skip(void)
 {
-	return NULL != env_get("novideo");
+	return env_get(ctx_uboot, "novideo") != NULL;
 }
 
 static void setup_display(void)
@@ -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);
-	env_set("keybd", envvalue);
+	env_set(ctx_uboot, "keybd", envvalue);
 	return numpressed == 0;
 }
 
@@ -974,7 +974,7 @@ static void preboot_keys(void)
 	char keypress[ARRAY_SIZE(buttons)+1];
 	numpressed = read_keys(keypress);
 	if (numpressed) {
-		char *kbd_magic_keys = env_get("magic_keys");
+		char *kbd_magic_keys = env_get(ctx_uboot, "magic_keys");
 		char *suffix;
 		/*
 		 * loop over all magic keys
@@ -983,7 +983,7 @@ static void preboot_keys(void)
 			char *keys;
 			char magic[sizeof(kbd_magic_prefix) + 1];
 			sprintf(magic, "%s%c", kbd_magic_prefix, *suffix);
-			keys = env_get(magic);
+			keys = env_get(ctx_uboot, magic);
 			if (keys) {
 				if (!strcmp(keys, keypress))
 					break;
@@ -993,9 +993,9 @@ static void preboot_keys(void)
 			char cmd_name[sizeof(kbd_command_prefix) + 1];
 			char *cmd;
 			sprintf(cmd_name, "%s%c", kbd_command_prefix, *suffix);
-			cmd = env_get(cmd_name);
+			cmd = env_get(ctx_uboot, cmd_name);
 			if (cmd) {
-				env_set("preboot", cmd);
+				env_set(ctx_uboot, "preboot", cmd);
 				return;
 			}
 		}
@@ -1021,6 +1021,6 @@ int misc_init_r(void)
 #ifdef CONFIG_CMD_BMODE
 	add_board_boot_modes(board_boot_modes);
 #endif
-	env_set_hex("reset_cause", get_imx_reset_cause());
+	env_set_hex(ctx_uboot, "reset_cause", get_imx_reset_cause(void));
 	return 0;
 }
diff --git a/board/broadcom/bcm23550_w1d/bcm23550_w1d.c b/board/broadcom/bcm23550_w1d/bcm23550_w1d.c
index ce9f0494ee59..51e7f2c0c847 100644
--- a/board/broadcom/bcm23550_w1d/bcm23550_w1d.c
+++ b/board/broadcom/bcm23550_w1d/bcm23550_w1d.c
@@ -103,7 +103,7 @@ int board_usb_init(int index, enum usb_init_type init)
 int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
 {
 	debug("%s\n", __func__);
-	if (!env_get("serial#"))
+	if (!env_get(ctx_uboot, "serial#"))
 		g_dnl_set_serialnumber(CONFIG_USB_SERIALNO);
 	return 0;
 }
diff --git a/board/broadcom/bcm28155_ap/bcm28155_ap.c b/board/broadcom/bcm28155_ap/bcm28155_ap.c
index 87616386cb84..d9240cf35c8c 100644
--- a/board/broadcom/bcm28155_ap/bcm28155_ap.c
+++ b/board/broadcom/bcm28155_ap/bcm28155_ap.c
@@ -110,7 +110,7 @@ int board_usb_init(int index, enum usb_init_type init)
 int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
 {
 	debug("%s\n", __func__);
-	if (!env_get("serial#"))
+	if (!env_get(ctx_uboot, "serial#"))
 		g_dnl_set_serialnumber(CONFIG_USB_SERIALNO);
 	return 0;
 }
diff --git a/board/broadcom/bcmstb/bcmstb.c b/board/broadcom/bcmstb/bcmstb.c
index 5fc2c0591b84..494c03d3eb79 100644
--- a/board/broadcom/bcmstb/bcmstb.c
+++ b/board/broadcom/bcmstb/bcmstb.c
@@ -120,7 +120,7 @@ int board_late_init(void)
 	 * Set fdtcontroladdr in the environment so that scripts can
 	 * refer to it, for example, to reuse it for fdtaddr.
 	 */
-	env_set_hex("fdtcontroladdr", prior_stage_fdt_address);
+	env_set_hex(ctx_uboot, "fdtcontroladdr", prior_stage_fdt_address);
 
 	/*
 	 * Do not set machid to the machine identifier value provided
diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c
index 95d3a5e1f579..f1baed84e268 100644
--- a/board/buffalo/lsxl/lsxl.c
+++ b/board/buffalo/lsxl/lsxl.c
@@ -229,7 +229,7 @@ static void erase_environment(void)
 static void rescue_mode(void)
 {
 	printf("Entering rescue mode..\n");
-	env_set("bootsource", "rescue");
+	env_set(ctx_uboot, "bootsource", "rescue");
 }
 
 static void check_push_button(void)
diff --git a/board/cadence/xtfpga/xtfpga.c b/board/cadence/xtfpga/xtfpga.c
index 256611638a55..1aee9c6f95a0 100644
--- a/board/cadence/xtfpga/xtfpga.c
+++ b/board/cadence/xtfpga/xtfpga.c
@@ -86,14 +86,14 @@ int misc_init_r(void)
 	 * Default MAC address comes from CONFIG_ETHADDR + DIP switches 1-6.
 	 */
 
-	char *s = env_get("ethaddr");
+	char *s = env_get(ctx_uboot, "ethaddr");
 	if (s == 0) {
 		unsigned int x;
 		char s[] = __stringify(CONFIG_ETHBASE);
 		x = (*(volatile u32 *)CONFIG_SYS_FPGAREG_DIPSW)
 			& FPGAREG_MAC_MASK;
 		sprintf(&s[15], "%02x", x);
-		env_set("ethaddr", s);
+		env_set(ctx_uboot, "ethaddr", s);
 	}
 #endif /* CONFIG_CMD_NET */
 
diff --git a/board/ccv/xpress/xpress.c b/board/ccv/xpress/xpress.c
index 05286e643c0e..9518307f7a76 100644
--- a/board/ccv/xpress/xpress.c
+++ b/board/ccv/xpress/xpress.c
@@ -324,7 +324,7 @@ static const struct boot_mode board_boot_modes[] = {
 int board_late_init(void)
 {
 	add_board_boot_modes(board_boot_modes);
-	env_set("board_name", "xpress");
+	env_set(ctx_uboot, "board_name", "xpress");
 
 	return 0;
 }
diff --git a/board/compulab/cl-som-imx7/cl-som-imx7.c b/board/compulab/cl-som-imx7/cl-som-imx7.c
index 395d5dce1785..d05a0dcf32f5 100644
--- a/board/compulab/cl-som-imx7/cl-som-imx7.c
+++ b/board/compulab/cl-som-imx7/cl-som-imx7.c
@@ -311,7 +311,7 @@ void cl_som_imx7_setup_wdog(void)
 
 int board_late_init(void)
 {
-	env_set("board_name", "CL-SOM-iMX7");
+	env_set(ctx_uboot, "board_name", "CL-SOM-iMX7");
 	cl_som_imx7_setup_wdog();
 	return 0;
 }
diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c
index feb7a71f007d..50564fde2ba6 100644
--- a/board/compulab/cm_fx6/cm_fx6.c
+++ b/board/compulab/cm_fx6/cm_fx6.c
@@ -117,10 +117,10 @@ int board_video_skip(void)
 {
 	int ret;
 	struct display_info_t *preset;
-	char const *panel = env_get("displaytype");
+	char const *panel = env_get(ctx_uboot, "displaytype");
 
 	if (!panel) /* Also accept panel for backward compatibility */
-		panel = env_get("panel");
+		panel = env_get(ctx_uboot, "panel");
 
 	if (!panel)
 		return -ENOENT;
@@ -628,16 +628,16 @@ int board_late_init(void)
 	int err;
 
 	if (is_mx6dq())
-		env_set("board_rev", "MX6Q");
+		env_set(ctx_uboot, "board_rev", "MX6Q");
 	else if (is_mx6dl())
-		env_set("board_rev", "MX6DL");
+		env_set(ctx_uboot, "board_rev", "MX6DL");
 
 	err = cl_eeprom_get_product_name((uchar *)baseboard_name, 0);
 	if (err)
 		return 0;
 
 	if (!strncmp("SB-FX6m", baseboard_name, 7))
-		env_set("board_name", "Utilite");
+		env_set(ctx_uboot, "board_name", "Utilite");
 #endif
 	return 0;
 }
diff --git a/board/compulab/common/omap3_display.c b/board/compulab/common/omap3_display.c
index cb9ebae7f964..9215a37d982a 100644
--- a/board/compulab/common/omap3_display.c
+++ b/board/compulab/common/omap3_display.c
@@ -398,7 +398,7 @@ void lcd_ctrl_init(void *lcdbase)
 {
 	struct prcm *prcm = (struct prcm *)PRCM_BASE;
 	char *custom_lcd;
-	char *displaytype = env_get("displaytype");
+	char *displaytype = env_get(ctx_uboot, "displaytype");
 
 	if (displaytype == NULL)
 		return;
@@ -406,7 +406,7 @@ void lcd_ctrl_init(void *lcdbase)
 	lcd_def = env_parse_displaytype(displaytype);
 	/* If we did not recognize the preset, check if it's an env variable */
 	if (lcd_def == NONE) {
-		custom_lcd = env_get(displaytype);
+		custom_lcd = env_get(ctx_uboot, displaytype);
 		if (custom_lcd == NULL || parse_customlcd(custom_lcd) < 0)
 			return;
 	}
diff --git a/board/congatec/cgtqmx6eval/cgtqmx6eval.c b/board/congatec/cgtqmx6eval/cgtqmx6eval.c
index 6b3d5b833f44..8143f7680e7b 100644
--- a/board/congatec/cgtqmx6eval/cgtqmx6eval.c
+++ b/board/congatec/cgtqmx6eval/cgtqmx6eval.c
@@ -236,7 +236,7 @@ int power_init_board(void)
 		return 0;
 
 	/* set level of MIPI if specified */
-	lv_mipi = env_get("lv_mipi");
+	lv_mipi = env_get(ctx_uboot, "lv_mipi");
 	if (lv_mipi)
 		return 0;
 
@@ -584,7 +584,7 @@ int board_video_skip(void)
 {
 	int i;
 	int ret;
-	char const *panel = env_get("panel");
+	char const *panel = env_get(ctx_uboot, "panel");
 	if (!panel) {
 		for (i = 0; i < ARRAY_SIZE(displays); i++) {
 			struct display_info_t const *dev = displays + i;
@@ -756,9 +756,9 @@ int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 	if (is_mx6dq())
-		env_set("board_rev", "MX6Q");
+		env_set(ctx_uboot, "board_rev", "MX6Q");
 	else
-		env_set("board_rev", "MX6DL");
+		env_set(ctx_uboot, "board_rev", "MX6DL");
 #endif
 
 	return 0;
diff --git a/board/cssi/MCR3000/MCR3000.c b/board/cssi/MCR3000/MCR3000.c
index 445b84c180fe..0f7ba71bb647 100644
--- a/board/cssi/MCR3000/MCR3000.c
+++ b/board/cssi/MCR3000/MCR3000.c
@@ -127,7 +127,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)
-		env_set("bootdelay", "60");
+		env_set(ctx_uboot, "bootdelay", "60");
 
 	return 0;
 }
diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index d9019de6e006..31a380275553 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -280,7 +280,7 @@ u32 get_board_rev(void)
 	u32 maxcpuclk = CONFIG_DA850_EVM_MAX_CPU_CLK;
 	u32 rev = 0;
 
-	s = env_get("maxcpuclk");
+	s = env_get(ctx_uboot, "maxcpuclk");
 	if (s)
 		maxcpuclk = simple_strtoul(s, NULL, 10);
 
diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c b/board/davinci/da8xxevm/omapl138_lcdk.c
index 27a51d6a7802..0856b25c16e4 100644
--- a/board/davinci/da8xxevm/omapl138_lcdk.c
+++ b/board/davinci/da8xxevm/omapl138_lcdk.c
@@ -275,7 +275,7 @@ static void dspwake(void)
 	if ((REG(CHIP_REV_ID_REG) & 0x3f) == 0x10)
 		return;
 
-	if (!strcmp(env_get("dspwake"), "no"))
+	if (!strcmp(env_get(ctx_uboot, "dspwake"), "no"))
 		return;
 
 	*resetvect++ = 0x1E000; /* DSP Idle */
@@ -305,7 +305,7 @@ int misc_init_r(void)
 	uint8_t tmp[20], addr[10];
 
 
-	if (env_get("ethaddr") == NULL) {
+	if (!env_get(ctx_uboot, "ethaddr")) {
 		/* Read Ethernet MAC address from EEPROM */
 		if (dvevm_read_mac_address(addr)) {
 			/* Set Ethernet MAC address from EEPROM */
@@ -319,7 +319,7 @@ int misc_init_r(void)
 				addr[0], addr[1], addr[2], addr[3], addr[4],
 				addr[5]);
 
-			env_set("ethaddr", (char *)tmp);
+			env_set(ctx_uboot, "ethaddr", (char *)tmp);
 		} else {
 			printf("Invalid MAC address read.\n");
 		}
diff --git a/board/dhelectronics/dh_imx6/dh_imx6.c b/board/dhelectronics/dh_imx6/dh_imx6.c
index 2d0f78da118f..d904ab4170d3 100644
--- a/board/dhelectronics/dh_imx6/dh_imx6.c
+++ b/board/dhelectronics/dh_imx6/dh_imx6.c
@@ -251,7 +251,7 @@ int board_late_init(void)
 		break;
 	}
 
-	env_set("dhcom", buf);
+	env_set(ctx_uboot, "dhcom", buf);
 
 #ifdef CONFIG_CMD_BMODE
 	add_board_boot_modes(board_boot_modes);
diff --git a/board/eets/pdu001/board.c b/board/eets/pdu001/board.c
index 8a3d0ada270e..104dc1d3c6f7 100644
--- a/board/eets/pdu001/board.c
+++ b/board/eets/pdu001/board.c
@@ -79,15 +79,15 @@ static void env_set_boot_device(void)
 {
 	switch (boot_device()) {
 		case BOOT_DEVICE_MMC1: {
-			env_set("boot_device", "emmc");
+			env_set(ctx_uboot, "boot_device", "emmc");
 			break;
 		}
 		case BOOT_DEVICE_MMC2: {
-			env_set("boot_device", "sdcard");
+			env_set(ctx_uboot, "boot_device", "sdcard");
 			break;
 		}
 		default: {
-			env_set("boot_device", "unknown");
+			env_set(ctx_uboot, "boot_device", "unknown");
 			break;
 		}
 	}
@@ -117,7 +117,7 @@ static void env_set_serial(struct udevice *dev)
 		sprintf(serial + n, "%02X", val);
 	}
 	serial[2 * NODE_ID_BYTE_COUNT] = '\0';
-	env_set("serial#", serial);
+	env_set(ctx_uboot, "serial#", serial);
 }
 
 static void set_mpu_and_core_voltage(void)
diff --git a/board/el/el6x/el6x.c b/board/el/el6x/el6x.c
index 18d69a7da388..606fe1530728 100644
--- a/board/el/el6x/el6x.c
+++ b/board/el/el6x/el6x.c
@@ -467,7 +467,7 @@ int board_late_init(void)
 	add_board_boot_modes(board_boot_modes);
 #endif
 
-	env_set("board_name", BOARD_NAME);
+	env_set(ctx_uboot, "board_name", BOARD_NAME);
 	return 0;
 }
 
diff --git a/board/emulation/qemu-riscv/qemu-riscv.c b/board/emulation/qemu-riscv/qemu-riscv.c
index 37d48d04f2d0..6cb571ba036c 100644
--- a/board/emulation/qemu-riscv/qemu-riscv.c
+++ b/board/emulation/qemu-riscv/qemu-riscv.c
@@ -46,7 +46,7 @@ int board_late_init(void)
 		return 0;
 	}
 
-	env_set_hex("kernel_start", kernel_start);
+	env_set_hex(ctx_uboot, "kernel_start", kernel_start);
 
 	return 0;
 }
diff --git a/board/engicam/common/board.c b/board/engicam/common/board.c
index 0c47afe5b566..b338c364efd0 100644
--- a/board/engicam/common/board.c
+++ b/board/engicam/common/board.c
@@ -22,11 +22,11 @@ static void mmc_late_init(void)
 	char mmcblk[32];
 	u32 dev_no = mmc_get_env_dev();
 
-	env_set_ulong("mmcdev", dev_no);
+	env_set_ulong(ctx_uboot, "mmcdev", dev_no);
 
 	/* Set mmcblk env */
 	sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw", dev_no);
-	env_set("mmcroot", mmcblk);
+	env_set(ctx_uboot, "mmcroot", mmcblk);
 
 	sprintf(cmd, "mmc dev %d", dev_no);
 	run_command(cmd, 0);
@@ -39,25 +39,25 @@ static void setenv_fdt_file(void)
 
 	if (!strcmp(cmp_dtb, "imx6q-icore")) {
 		if (is_mx6dq())
-			env_set("fdt_file", "imx6q-icore.dtb");
+			env_set(ctx_uboot, "fdt_file", "imx6q-icore.dtb");
 		else if (is_mx6dl() || is_mx6solo())
-			env_set("fdt_file", "imx6dl-icore.dtb");
+			env_set(ctx_uboot, "fdt_file", "imx6dl-icore.dtb");
 	} else if (!strcmp(cmp_dtb, "imx6q-icore-mipi")) {
 		if (is_mx6dq())
-			env_set("fdt_file", "imx6q-icore-mipi.dtb");
+			env_set(ctx_uboot, "fdt_file", "imx6q-icore-mipi.dtb");
 		else if (is_mx6dl() || is_mx6solo())
-			env_set("fdt_file", "imx6dl-icore-mipi.dtb");
+			env_set(ctx_uboot, "fdt_file", "imx6dl-icore-mipi.dtb");
 	} else if (!strcmp(cmp_dtb, "imx6q-icore-rqs")) {
 		if (is_mx6dq())
-			env_set("fdt_file", "imx6q-icore-rqs.dtb");
+			env_set(ctx_uboot, "fdt_file", "imx6q-icore-rqs.dtb");
 		else if (is_mx6dl() || is_mx6solo())
-			env_set("fdt_file", "imx6dl-icore-rqs.dtb");
+			env_set(ctx_uboot, "fdt_file", "imx6dl-icore-rqs.dtb");
 	} else if (!strcmp(cmp_dtb, "imx6ul-geam"))
-		env_set("fdt_file", "imx6ul-geam.dtb");
+		env_set(ctx_uboot, "fdt_file", "imx6ul-geam.dtb");
 	else if (!strcmp(cmp_dtb, "imx6ul-isiot-emmc"))
-		env_set("fdt_file", "imx6ul-isiot-emmc.dtb");
+		env_set(ctx_uboot, "fdt_file", "imx6ul-isiot-emmc.dtb");
 	else if (!strcmp(cmp_dtb, "imx6ul-isiot-nand"))
-		env_set("fdt_file", "imx6ul-isiot-nand.dtb");
+		env_set(ctx_uboot, "fdt_file", "imx6ul-isiot-nand.dtb");
 }
 
 int board_late_init(void)
@@ -71,20 +71,20 @@ int board_late_init(void)
 #ifdef CONFIG_ENV_IS_IN_MMC
 		mmc_late_init();
 #endif
-		env_set("modeboot", "mmcboot");
+		env_set(ctx_uboot, "modeboot", "mmcboot");
 		break;
 	case IMX6_BMODE_NAND_MIN ... IMX6_BMODE_NAND_MAX:
-		env_set("modeboot", "nandboot");
+		env_set(ctx_uboot, "modeboot", "nandboot");
 		break;
 	default:
-		env_set("modeboot", "");
+		env_set(ctx_uboot, "modeboot", "");
 		break;
 	}
 
 	if (is_mx6ul())
-		env_set("console", "ttymxc0");
+		env_set(ctx_uboot, "console", "ttymxc0");
 	else
-		env_set("console", "ttymxc3");
+		env_set(ctx_uboot, "console", "ttymxc3");
 
 	setenv_fdt_file();
 
diff --git a/board/esd/meesc/meesc.c b/board/esd/meesc/meesc.c
index b0d2f7b6f87b..c9c1d77410cc 100644
--- a/board/esd/meesc/meesc.c
+++ b/board/esd/meesc/meesc.c
@@ -181,7 +181,7 @@ int checkboard(void)
 		puts("Board: EtherCAN/2 Gateway");
 		break;
 	}
-	if (env_get_f("serial#", str, sizeof(str)) > 0) {
+	if (env_get_f("serial#", str, sizeof(ctx_uboot, str)) > 0) {
 		puts(", serial# ");
 		puts(str);
 	}
@@ -198,7 +198,7 @@ void get_board_serial(struct tag_serialnr *serialnr)
 {
 	char *str;
 
-	char *serial = env_get("serial#");
+	char *serial = env_get(ctx_uboot, "serial#");
 	if (serial) {
 		str = strchr(serial, '_');
 		if (str && (strlen(str) >= 4)) {
@@ -231,7 +231,7 @@ int misc_init_r(void)
 	 * In some cases this this needs to be set to 4.
 	 * Check the user has set environment mdiv to 4 to change the divisor.
 	 */
-	str = env_get("mdiv");
+	str = env_get(ctx_uboot, "mdiv");
 	if (str && (strcmp(str, "4") == 0)) {
 		writel((readl(&pmc->mckr) & ~AT91_PMC_MDIV) |
 			AT91SAM9_PMC_MDIV_4, &pmc->mckr);
diff --git a/board/freescale/b4860qds/b4860qds.c b/board/freescale/b4860qds/b4860qds.c
index 33cd4b496489..a8168e60a58a 100644
--- a/board/freescale/b4860qds/b4860qds.c
+++ b/board/freescale/b4860qds/b4860qds.c
@@ -195,7 +195,7 @@ static int adjust_vdd(ulong vdd_override)
 	      vid, vdd_target/10);
 
 	/* check override variable for overriding VDD */
-	vdd_string = env_get("b4qds_vdd_mv");
+	vdd_string = env_get(ctx_uboot, "b4qds_vdd_mv");
 	if (vdd_override == 0 && vdd_string &&
 	    !strict_strtoul(vdd_string, 10, &vdd_string_override))
 		vdd_override = vdd_string_override;
@@ -542,7 +542,8 @@ int configure_vsc3316_3308(void)
 			 * Extract hwconfig from environment since environment
 			 * is not setup properly yet
 			 */
-			env_get_f("hwconfig", buffer, sizeof(buffer));
+			env_get_f(ctx_uboot, "hwconfig", buffer,
+				  sizeof(buffer));
 			buf = buffer;
 
 			if (hwconfig_subarg_cmp_f("fsl_b4860_serdes2",
diff --git a/board/freescale/common/cmd_esbc_validate.c b/board/freescale/common/cmd_esbc_validate.c
index 36b620ca23a0..14ce924b8684 100644
--- a/board/freescale/common/cmd_esbc_validate.c
+++ b/board/freescale/common/cmd_esbc_validate.c
@@ -53,7 +53,7 @@ static int do_esbc_validate(cmd_tbl_t *cmdtp, int flag, int argc,
 	 * to continue U-Boot
 	 */
 	sprintf(buf, "%lx", img_addr);
-	env_set("img_addr", buf);
+	env_set(ctx_uboot, "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 a024e7239e6e..9e216c3f51d7 100644
--- a/board/freescale/common/fsl_chain_of_trust.c
+++ b/board/freescale/common/fsl_chain_of_trust.c
@@ -80,12 +80,12 @@ int fsl_setenv_chain_of_trust(void)
 	 * bootdelay = 0 (To disable Boot Prompt)
 	 * bootcmd = CONFIG_CHAIN_BOOT_CMD (Validate and execute Boot script)
 	 */
-	env_set("bootdelay", "-2");
+	env_set(ctx_uboot, "bootdelay", "-2");
 
 #ifdef CONFIG_ARM
-	env_set("secureboot", "y");
+	env_set(ctx_uboot, "secureboot", "y");
 #else
-	env_set("bootcmd", CONFIG_CHAIN_BOOT_CMD);
+	env_set(ctx_uboot, "bootcmd", CONFIG_CHAIN_BOOT_CMD);
 #endif
 
 	return 0;
diff --git a/board/freescale/common/sys_eeprom.c b/board/freescale/common/sys_eeprom.c
index bb655ca7447c..88640958c79d 100644
--- a/board/freescale/common/sys_eeprom.c
+++ b/board/freescale/common/sys_eeprom.c
@@ -538,8 +538,8 @@ int mac_read_from_eeprom(void)
 			/* Only initialize environment variables that are blank
 			 * (i.e. have not yet been set)
 			 */
-			if (!env_get(enetvar))
-				env_set(enetvar, ethaddr);
+			if (!env_get(ctx_uboot, enetvar))
+				env_set(ctx_uboot, enetvar, ethaddr);
 		}
 	}
 
diff --git a/board/freescale/common/vid.c b/board/freescale/common/vid.c
index b37f3bf4f8fe..db23c8387e5c 100644
--- a/board/freescale/common/vid.c
+++ b/board/freescale/common/vid.c
@@ -617,7 +617,7 @@ int adjust_vdd(ulong vdd_override)
 	vdd_target = vdd[vid];
 
 	/* check override variable for overriding VDD */
-	vdd_string = env_get(CONFIG_VID_FLS_ENV);
+	vdd_string = env_get(ctx_uboot, CONFIG_VID_FLS_ENV);
 	if (vdd_override == 0 && vdd_string &&
 	    !strict_strtoul(vdd_string, 10, &vdd_string_override))
 		vdd_override = vdd_string_override;
@@ -824,7 +824,7 @@ int adjust_vdd(ulong vdd_override)
 	vdd_target = vdd[vid];
 
 	/* check override variable for overriding VDD */
-	vdd_string = env_get(CONFIG_VID_FLS_ENV);
+	vdd_string = env_get(ctx_uboot, CONFIG_VID_FLS_ENV);
 	if (vdd_override == 0 && vdd_string &&
 	    !strict_strtoul(vdd_string, 10, &vdd_string_override))
 		vdd_override = vdd_string_override;
diff --git a/board/freescale/imx8mq_evk/imx8mq_evk.c b/board/freescale/imx8mq_evk/imx8mq_evk.c
index 1463e6e6963b..1822df9f32e8 100644
--- a/board/freescale/imx8mq_evk/imx8mq_evk.c
+++ b/board/freescale/imx8mq_evk/imx8mq_evk.c
@@ -123,8 +123,8 @@ int board_mmc_get_env_dev(int devno)
 int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-	env_set("board_name", "EVK");
-	env_set("board_rev", "iMX8MQ");
+	env_set(ctx_uboot, "board_name", "EVK");
+	env_set(ctx_uboot, "board_rev", "iMX8MQ");
 #endif
 
 	return 0;
diff --git a/board/freescale/imx8qm_mek/imx8qm_mek.c b/board/freescale/imx8qm_mek/imx8qm_mek.c
index 76634a3a28ad..34ed03c3dec1 100644
--- a/board/freescale/imx8qm_mek/imx8qm_mek.c
+++ b/board/freescale/imx8qm_mek/imx8qm_mek.c
@@ -126,8 +126,8 @@ int board_mmc_get_env_dev(int devno)
 int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-	env_set("board_name", "MEK");
-	env_set("board_rev", "iMX8QM");
+	env_set(ctx_uboot, "board_name", "MEK");
+	env_set(ctx_uboot, "board_rev", "iMX8QM");
 #endif
 
 	return 0;
diff --git a/board/freescale/imx8qxp_mek/imx8qxp_mek.c b/board/freescale/imx8qxp_mek/imx8qxp_mek.c
index 4ba83142841a..0d6152ac9551 100644
--- a/board/freescale/imx8qxp_mek/imx8qxp_mek.c
+++ b/board/freescale/imx8qxp_mek/imx8qxp_mek.c
@@ -139,8 +139,8 @@ int board_mmc_get_env_dev(int devno)
 int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-	env_set("board_name", "MEK");
-	env_set("board_rev", "iMX8QXP");
+	env_set(ctx_uboot, "board_name", "MEK");
+	env_set(ctx_uboot, "board_rev", "iMX8QXP");
 #endif
 
 	return 0;
diff --git a/board/freescale/ls1088a/eth_ls1088aqds.c b/board/freescale/ls1088a/eth_ls1088aqds.c
index 237088a53710..f618db490f00 100644
--- a/board/freescale/ls1088a/eth_ls1088aqds.c
+++ b/board/freescale/ls1088a/eth_ls1088aqds.c
@@ -529,7 +529,7 @@ void ls1088a_handle_phy_interface_sgmii(int dpmac_id)
 	serdes1_prtcl = serdes_get_number(FSL_SRDS_1, cfg);
 
 	int *riser_phy_addr;
-	char *env_hwconfig = env_get("hwconfig");
+	char *env_hwconfig = env_get(ctx_uboot, "hwconfig");
 
 	if (hwconfig_f("xqsgmii", env_hwconfig))
 		riser_phy_addr = &xqsgii_riser_phy_addr[0];
@@ -670,7 +670,7 @@ int board_eth_init(bd_t *bis)
 	int error = 0, i;
 #ifdef CONFIG_FSL_MC_ENET
 	struct memac_mdio_info *memac_mdio0_info;
-	char *env_hwconfig = env_get("hwconfig");
+	char *env_hwconfig = env_get(ctx_uboot, "hwconfig");
 
 	initialize_dpmac_to_slot();
 
diff --git a/board/freescale/ls1088a/ls1088a.c b/board/freescale/ls1088a/ls1088a.c
index f1592982a348..cdbfd90c19fa 100644
--- a/board/freescale/ls1088a/ls1088a.c
+++ b/board/freescale/ls1088a/ls1088a.c
@@ -984,7 +984,7 @@ int ft_board_setup(void *blob, bd_t *bd)
 #ifdef CONFIG_MTD_NOR_FLASH
 int is_flash_available(void)
 {
-	char *env_hwconfig = env_get("hwconfig");
+	char *env_hwconfig = env_get(ctx_uboot, "hwconfig");
 	enum boot_src src = get_boot_src();
 	int is_nor_flash_available = 1;
 
diff --git a/board/freescale/ls2080aqds/eth.c b/board/freescale/ls2080aqds/eth.c
index 6a8788c31254..1103ca1d430c 100644
--- a/board/freescale/ls2080aqds/eth.c
+++ b/board/freescale/ls2080aqds/eth.c
@@ -506,7 +506,7 @@ static void initialize_dpmac_to_slot(void)
 		>> FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_SHIFT;
 
 	char *env_hwconfig;
-	env_hwconfig = env_get("hwconfig");
+	env_hwconfig = env_get(ctx_uboot, "hwconfig");
 
 	switch (serdes1_prtcl) {
 	case 0x07:
@@ -660,7 +660,7 @@ void ls2080a_handle_phy_interface_sgmii(int dpmac_id)
 		>> FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_SHIFT;
 
 	int *riser_phy_addr;
-	char *env_hwconfig = env_get("hwconfig");
+	char *env_hwconfig = env_get(ctx_uboot, "hwconfig");
 
 	if (hwconfig_f("xqsgmii", env_hwconfig))
 		riser_phy_addr = &xqsgii_riser_phy_addr[0];
@@ -906,7 +906,7 @@ int board_eth_init(bd_t *bis)
 	unsigned int i;
 	char *env_hwconfig;
 
-	env_hwconfig = env_get("hwconfig");
+	env_hwconfig = env_get(ctx_uboot, "hwconfig");
 
 	initialize_dpmac_to_slot();
 
diff --git a/board/freescale/ls2080aqds/ls2080aqds.c b/board/freescale/ls2080aqds/ls2080aqds.c
index 91c80353edd6..6eef0536d162 100644
--- a/board/freescale/ls2080aqds/ls2080aqds.c
+++ b/board/freescale/ls2080aqds/ls2080aqds.c
@@ -212,7 +212,7 @@ int board_init(void)
 
 	val = in_le32(dcfg_ccsr + DCFG_RCWSR13 / 4);
 
-	env_hwconfig = env_get("hwconfig");
+	env_hwconfig = env_get(ctx_uboot, "hwconfig");
 
 	if (hwconfig_f("dspi", env_hwconfig) &&
 	    DCFG_RCWSR13_DSPI == (val & (u32)(0xf << 8)))
diff --git a/board/freescale/ls2080ardb/ls2080ardb.c b/board/freescale/ls2080ardb/ls2080ardb.c
index e20267f27ce0..d7ea56a6613a 100644
--- a/board/freescale/ls2080ardb/ls2080ardb.c
+++ b/board/freescale/ls2080ardb/ls2080ardb.c
@@ -265,7 +265,7 @@ int misc_init_r(void)
 
 	val = in_le32(dcfg_ccsr + DCFG_RCWSR13 / 4);
 
-	env_hwconfig = env_get("hwconfig");
+	env_hwconfig = env_get(ctx_uboot, "hwconfig");
 
 	if (hwconfig_f("dspi", env_hwconfig) &&
 	    DCFG_RCWSR13_DSPI == (val & (u32)(0xf << 8)))
@@ -295,10 +295,10 @@ int misc_init_r(void)
 	 */
 	if ((SVR_SOC_VER(svr) == SVR_LS2088A) ||
 	    (SVR_SOC_VER(svr) == SVR_LS2048A))
-		env_set("board", "ls2088ardb");
+		env_set(ctx_uboot, "board", "ls2088ardb");
 	else if ((SVR_SOC_VER(svr) == SVR_LS2081A) ||
 	    (SVR_SOC_VER(svr) == SVR_LS2041A))
-		env_set("board", "ls2081ardb");
+		env_set(ctx_uboot, "board", "ls2081ardb");
 
 	return 0;
 }
diff --git a/board/freescale/lx2160a/eth_lx2160aqds.c b/board/freescale/lx2160a/eth_lx2160aqds.c
index 92c06e5060f1..40fb5092c337 100644
--- a/board/freescale/lx2160a/eth_lx2160aqds.c
+++ b/board/freescale/lx2160a/eth_lx2160aqds.c
@@ -484,7 +484,7 @@ int board_eth_init(bd_t *bis)
 	 * defining "dpmac_override" in hwconfig environment variable.
 	 */
 	if (hwconfig("dpmac_override")) {
-		env_dpmac = env_get("dpmac");
+		env_dpmac = env_get(ctx_uboot, "dpmac");
 		if (env_dpmac) {
 			ret = hwconfig_arg_f("srds", &len, env_dpmac);
 			if (ret) {
diff --git a/board/freescale/mpc8323erdb/mpc8323erdb.c b/board/freescale/mpc8323erdb/mpc8323erdb.c
index e5aecc4e1f28..aa19a1b8534d 100644
--- a/board/freescale/mpc8323erdb/mpc8323erdb.c
+++ b/board/freescale/mpc8323erdb/mpc8323erdb.c
@@ -217,7 +217,8 @@ int mac_read_from_eeprom(void)
 						buf[i * 6 + 4], buf[i * 6 + 5]);
 					sprintf((char *)enetvar,
 						i ? "eth%daddr" : "ethaddr", i);
-					env_set((char *)enetvar, str);
+					env_set(ctx_uboot, (char *)enetvar,
+						str);
 				}
 			}
 		}
diff --git a/board/freescale/mpc837xemds/pci.c b/board/freescale/mpc837xemds/pci.c
index 41b78cf5e4de..c6f734ef2625 100644
--- a/board/freescale/mpc837xemds/pci.c
+++ b/board/freescale/mpc837xemds/pci.c
@@ -67,7 +67,7 @@ static struct pci_region pcie_regions_1[] = {
 
 static int is_pex_x2(void)
 {
-	const char *pex_x2 = env_get("pex_x2");
+	const char *pex_x2 = env_get(ctx_uboot, "pex_x2");
 
 	if (pex_x2 && !strcmp(pex_x2, "yes"))
 		return 1;
diff --git a/board/freescale/mpc837xerdb/mpc837xerdb.c b/board/freescale/mpc837xerdb/mpc837xerdb.c
index 4ad62bcf1d6b..71939b240dae 100644
--- a/board/freescale/mpc837xerdb/mpc837xerdb.c
+++ b/board/freescale/mpc837xerdb/mpc837xerdb.c
@@ -173,7 +173,7 @@ int board_mmc_init(bd_t *bd)
 	char buffer[HWCONFIG_BUFFER_SIZE] = {0};
 	int esdhc_hwconfig_enabled = 0;
 
-	if (env_get_f("hwconfig", buffer, sizeof(buffer)) > 0)
+	if (env_get_f("hwconfig", buffer, sizeof(ctx_uboot, buffer)) > 0)
 		esdhc_hwconfig_enabled = hwconfig_f("esdhc", buffer);
 
 	if (esdhc_hwconfig_enabled == 0)
diff --git a/board/freescale/mx51evk/mx51evk_video.c b/board/freescale/mx51evk/mx51evk_video.c
index 3715c5d738f9..ed2a58ea4a9a 100644
--- a/board/freescale/mx51evk/mx51evk_video.c
+++ b/board/freescale/mx51evk/mx51evk_video.c
@@ -76,7 +76,7 @@ void setup_iomux_lcd(void)
 int board_video_skip(void)
 {
 	int ret;
-	char const *e = env_get("panel");
+	char const *e = env_get(ctx_uboot, "panel");
 
 	if (e) {
 		if (strcmp(e, "claa") == 0) {
diff --git a/board/freescale/mx53loco/mx53loco.c b/board/freescale/mx53loco/mx53loco.c
index a177815bb8aa..a3328a134fb8 100644
--- a/board/freescale/mx53loco/mx53loco.c
+++ b/board/freescale/mx53loco/mx53loco.c
@@ -208,7 +208,7 @@ static int power_init(void)
 		if (!p)
 			return -ENODEV;
 
-		env_set("fdt_file", "imx53-qsb.dtb");
+		env_set(ctx_uboot, "fdt_file", "imx53-qsb.dtb");
 
 		/* Set VDDA to 1.25V */
 		val = DA9052_BUCKCORE_BCOREEN | DA_BUCKCORE_VBCORE_1_250V;
@@ -251,7 +251,7 @@ static int power_init(void)
 		if (!p)
 			return -ENODEV;
 
-		env_set("fdt_file", "imx53-qsrb.dtb");
+		env_set(ctx_uboot, "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/mx53loco/mx53loco_video.c b/board/freescale/mx53loco/mx53loco_video.c
index ff3fc8ce3e6f..061c990bcfb5 100644
--- a/board/freescale/mx53loco/mx53loco_video.c
+++ b/board/freescale/mx53loco/mx53loco_video.c
@@ -92,7 +92,7 @@ void setup_iomux_lcd(void)
 int board_video_skip(void)
 {
 	int ret;
-	char const *e = env_get("panel");
+	char const *e = env_get(ctx_uboot, "panel");
 
 	if (e) {
 		if (strcmp(e, "seiko") == 0) {
diff --git a/board/freescale/mx6sabreauto/mx6sabreauto.c b/board/freescale/mx6sabreauto/mx6sabreauto.c
index dc156efbbcbc..a1cd8f4bc52e 100644
--- a/board/freescale/mx6sabreauto/mx6sabreauto.c
+++ b/board/freescale/mx6sabreauto/mx6sabreauto.c
@@ -623,14 +623,14 @@ int board_late_init(void)
 #endif
 
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-	env_set("board_name", "SABREAUTO");
+	env_set(ctx_uboot, "board_name", "SABREAUTO");
 
 	if (is_mx6dqp())
-		env_set("board_rev", "MX6QP");
+		env_set(ctx_uboot, "board_rev", "MX6QP");
 	else if (is_mx6dq())
-		env_set("board_rev", "MX6Q");
+		env_set(ctx_uboot, "board_rev", "MX6Q");
 	else if (is_mx6sdl())
-		env_set("board_rev", "MX6DL");
+		env_set(ctx_uboot, "board_rev", "MX6DL");
 #endif
 
 	return 0;
diff --git a/board/freescale/mx6sabresd/mx6sabresd.c b/board/freescale/mx6sabresd/mx6sabresd.c
index b0c0117968bf..fb4c03a428c8 100644
--- a/board/freescale/mx6sabresd/mx6sabresd.c
+++ b/board/freescale/mx6sabresd/mx6sabresd.c
@@ -606,14 +606,14 @@ int board_late_init(void)
 #endif
 
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-	env_set("board_name", "SABRESD");
+	env_set(ctx_uboot, "board_name", "SABRESD");
 
 	if (is_mx6dqp())
-		env_set("board_rev", "MX6QP");
+		env_set(ctx_uboot, "board_rev", "MX6QP");
 	else if (is_mx6dq())
-		env_set("board_rev", "MX6Q");
+		env_set(ctx_uboot, "board_rev", "MX6Q");
 	else if (is_mx6sdl())
-		env_set("board_rev", "MX6DL");
+		env_set(ctx_uboot, "board_rev", "MX6DL");
 #endif
 
 	return 0;
diff --git a/board/freescale/mx6sxsabresd/mx6sxsabresd.c b/board/freescale/mx6sxsabresd/mx6sxsabresd.c
index 1c10958879b1..b4bc682a5160 100644
--- a/board/freescale/mx6sxsabresd/mx6sxsabresd.c
+++ b/board/freescale/mx6sxsabresd/mx6sxsabresd.c
@@ -309,7 +309,7 @@ int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 	if (is_reva())
-		env_set("board_rev", "REVA");
+		env_set(ctx_uboot, "board_rev", "REVA");
 #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 ccbe4044786c..913b2c6c57b8 100644
--- a/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
+++ b/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
@@ -545,12 +545,12 @@ int board_late_init(void)
 #endif
 
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-	env_set("board_name", "EVK");
+	env_set(ctx_uboot, "board_name", "EVK");
 
 	if (is_mx6ul_9x9_evk())
-		env_set("board_rev", "9X9");
+		env_set(ctx_uboot, "board_rev", "9X9");
 	else
-		env_set("board_rev", "14X14");
+		env_set(ctx_uboot, "board_rev", "14X14");
 #endif
 
 	return 0;
diff --git a/board/freescale/mx6ullevk/mx6ullevk.c b/board/freescale/mx6ullevk/mx6ullevk.c
index e11934780262..8dc5511e245f 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
-	env_set("board_name", "EVK");
-	env_set("board_rev", "14X14");
+	env_set(ctx_uboot, "board_name", "EVK");
+	env_set(ctx_uboot, "board_rev", "14X14");
 #endif
 
 	return 0;
diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
index a04a73528f8d..4a21c148b696 100644
--- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
+++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
@@ -350,7 +350,7 @@ int board_eth_init(bd_t *bis)
 
 #ifdef CONFIG_VSC7385_ENET
 	/* If a VSC7385 microcode image is present, then upload it. */
-	tmp = env_get("vscfw_addr");
+	tmp = env_get(ctx_uboot, "vscfw_addr");
 	if (tmp) {
 		vscfw_addr = simple_strtoul(tmp, NULL, 16);
 		printf("uploading VSC7385 microcode from %x\n", vscfw_addr);
diff --git a/board/freescale/qemu-ppce500/qemu-ppce500.c b/board/freescale/qemu-ppce500/qemu-ppce500.c
index fb36d8366c98..38608234b7d5 100644
--- a/board/freescale/qemu-ppce500/qemu-ppce500.c
+++ b/board/freescale/qemu-ppce500/qemu-ppce500.c
@@ -211,10 +211,10 @@ int last_stage_init(void)
 	/* -kernel boot */
 	prop = fdt_getprop(fdt, chosen, "qemu,boot-kernel", &len);
 	if (prop && (len >= 8))
-		env_set_hex("qemu_kernel_addr", *prop);
+		env_set_hex(ctx_uboot, "qemu_kernel_addr", *prop);
 
 	/* Give the user a variable for the host fdt */
-	env_set_hex("fdt_addr_r", (ulong)fdt);
+	env_set_hex("fdt_addr_r", (ctx_uboot, ulong)fdt);
 
 	return 0;
 }
diff --git a/board/freescale/t4qds/t4240qds.c b/board/freescale/t4qds/t4240qds.c
index bb18b97e6a2e..d4e92d6c8d51 100644
--- a/board/freescale/t4qds/t4240qds.c
+++ b/board/freescale/t4qds/t4240qds.c
@@ -265,7 +265,7 @@ static int adjust_vdd(ulong vdd_override)
 	vdd_target = vdd[vid];
 
 	/* check override variable for overriding VDD */
-	vdd_string = env_get("t4240qds_vdd_mv");
+	vdd_string = env_get(ctx_uboot, "t4240qds_vdd_mv");
 	if (vdd_override == 0 && vdd_string &&
 	    !strict_strtoul(vdd_string, 10, &vdd_string_override))
 		vdd_override = vdd_string_override;
diff --git a/board/gardena/smart-gateway-at91sam/board.c b/board/gardena/smart-gateway-at91sam/board.c
index 3e2da0d6f8e0..499605d5b6a1 100644
--- a/board/gardena/smart-gateway-at91sam/board.c
+++ b/board/gardena/smart-gateway-at91sam/board.c
@@ -15,7 +15,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static void at91_prepare_cpu_var(void)
 {
-	env_set("cpu", get_cpu_name());
+	env_set(ctx_uboot, "cpu", get_cpu_name());
 }
 
 int board_late_init(void)
diff --git a/board/gardena/smart-gateway-mt7688/board.c b/board/gardena/smart-gateway-mt7688/board.c
index bd494c84fc80..fe39187d0738 100644
--- a/board/gardena/smart-gateway-mt7688/board.c
+++ b/board/gardena/smart-gateway-mt7688/board.c
@@ -70,9 +70,9 @@ static bool prepare_uuid_var(const char *fd_ptr, const char *env_var_name,
 			str[i] = errorchar;
 	}
 
-	env = env_get(env_var_name);
+	env = env_get(ctx_uboot, env_var_name);
 	if (strcmp(env, str)) {
-		env_set(env_var_name, str);
+		env_set(ctx_uboot, env_var_name, str);
 		env_updated = true;
 	}
 
@@ -134,9 +134,9 @@ static void factory_data_env_config(void)
 	if (!is_valid_ethaddr(ptr))
 		printf("F-Data:Invalid MAC addr: wifi_mac %s\n", str);
 
-	env = env_get("wifiaddr");
+	env = env_get(ctx_uboot, "wifiaddr");
 	if (strcmp(env, str)) {
-		env_set("wifiaddr", str);
+		env_set(ctx_uboot, "wifiaddr", str);
 		env_updated = 1;
 	}
 
@@ -146,9 +146,9 @@ static void factory_data_env_config(void)
 	if (!is_valid_ethaddr(ptr))
 		printf("F-Data:Invalid MAC addr: eth_mac %s\n", str);
 
-	env = env_get("ethaddr");
+	env = env_get(ctx_uboot, "ethaddr");
 	if (strcmp(env, str)) {
-		env_set("ethaddr", str);
+		env_set(ctx_uboot, "ethaddr", str);
 		env_updated = 1;
 	}
 
@@ -161,7 +161,7 @@ static void factory_data_env_config(void)
 	/* Check if the environment was updated and needs to get stored */
 	if (env_updated != 0) {
 		printf("F-Data:Values don't match env values -> saving\n");
-		env_save();
+		env_save(ctx_uboot);
 	} else {
 		debug("F-Data:Values match current env values\n");
 	}
@@ -189,7 +189,7 @@ static void copy_or_generate_uuid(char *fd_ptr, const char *env_var_name)
 	char *env;
 
 	/* Don't use the UUID dest place, as the \0 char won't fit */
-	env = env_get(env_var_name);
+	env = env_get(ctx_uboot, env_var_name);
 	if (env)
 		strncpy(str, env, UUID_STR_LEN);
 	else
diff --git a/board/gateworks/gw_ventana/common.c b/board/gateworks/gw_ventana/common.c
index 1240a9da174f..0be40c2336ad 100644
--- a/board/gateworks/gw_ventana/common.c
+++ b/board/gateworks/gw_ventana/common.c
@@ -1477,7 +1477,7 @@ void setup_board_gpio(int board, struct ventana_board_info *info)
 	char arg[10];
 	size_t len;
 	int i;
-	int quiet = simple_strtol(env_get("quiet"), NULL, 10);
+	int quiet = simple_strtol(env_get(ctx_uboot, "quiet"), NULL, 10);
 
 	if (board >= GW_UNKNOWN)
 		return;
diff --git a/board/gateworks/gw_ventana/gw_ventana.c b/board/gateworks/gw_ventana/gw_ventana.c
index 8a694a71c90b..6782e6327978 100644
--- a/board/gateworks/gw_ventana/gw_ventana.c
+++ b/board/gateworks/gw_ventana/gw_ventana.c
@@ -299,11 +299,12 @@ int board_eth_init(bd_t *bis)
 #endif
 
 	/* default to the first detected enet dev */
-	if (!env_get("ethprime")) {
+	if (!env_get(ctx_uboot, "ethprime")) {
 		struct eth_device *dev = eth_get_dev_by_index(0);
 		if (dev) {
-			env_set("ethprime", dev->name);
-			printf("set ethprime to %s\n", env_get("ethprime"));
+			env_set(ctx_uboot, "ethprime", dev->name);
+			printf("set ethprime to %s\n",
+			       env_get(ctx_uboot, "ethprime"));
 		}
 	}
 
@@ -602,7 +603,7 @@ void board_pci_fixup_dev(struct pci_controller *hose, pci_dev_t dev,
  */
 void get_board_serial(struct tag_serialnr *serialnr)
 {
-	char *serial = env_get("serial#");
+	char *serial = env_get(ctx_uboot, "serial#");
 
 	if (serial) {
 		serialnr->high = 0;
@@ -685,11 +686,11 @@ int checkboard(void)
 	int quiet; /* Quiet or minimal output mode */
 
 	quiet = 0;
-	p = env_get("quiet");
+	p = env_get(ctx_uboot, "quiet");
 	if (p)
 		quiet = simple_strtol(p, NULL, 10);
 	else
-		env_set("quiet", "0");
+		env_set(ctx_uboot, "quiet", "0");
 
 	puts("\nGateworks Corporation Copyright 2014\n");
 	if (info->model[0]) {
@@ -764,26 +765,26 @@ int misc_init_r(void)
 		else if (is_cpu_type(MXC_CPU_MX6DL) ||
 			 is_cpu_type(MXC_CPU_MX6SOLO))
 			cputype = "imx6dl";
-		env_set("soctype", cputype);
+		env_set(ctx_uboot, "soctype", cputype);
 		if (8 << (ventana_info.nand_flash_size-1) >= 2048)
-			env_set("flash_layout", "large");
+			env_set(ctx_uboot, "flash_layout", "large");
 		else
-			env_set("flash_layout", "normal");
+			env_set(ctx_uboot, "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]);
-		env_set("model", str);
-		if (!env_get("fdt_file")) {
+		env_set(ctx_uboot, "model", str);
+		if (!env_get(ctx_uboot, "fdt_file")) {
 			sprintf(fdt, "%s-%s.dtb", cputype, str);
-			env_set("fdt_file", fdt);
+			env_set(ctx_uboot, "fdt_file", fdt);
 		}
 		p = strchr(str, '-');
 		if (p) {
 			*p++ = 0;
 
-			env_set("model_base", str);
+			env_set(ctx_uboot, "model_base", str);
 			sprintf(fdt, "%s-%s.dtb", cputype, str);
-			env_set("fdt_file1", fdt);
+			env_set(ctx_uboot, "fdt_file1", fdt);
 			if (board_type != GW551x &&
 			    board_type != GW552x &&
 			    board_type != GW553x &&
@@ -792,30 +793,30 @@ int misc_init_r(void)
 			str[5] = 'x';
 			str[6] = 0;
 			sprintf(fdt, "%s-%s.dtb", cputype, str);
-			env_set("fdt_file2", fdt);
+			env_set(ctx_uboot, "fdt_file2", fdt);
 		}
 
 		/* initialize env from EEPROM */
 		if (test_bit(EECONFIG_ETH0, info->config) &&
-		    !env_get("ethaddr")) {
+		    !env_get(ctx_uboot, "ethaddr")) {
 			eth_env_set_enetaddr("ethaddr", info->mac0);
 		}
 		if (test_bit(EECONFIG_ETH1, info->config) &&
-		    !env_get("eth1addr")) {
+		    !env_get(ctx_uboot, "eth1addr")) {
 			eth_env_set_enetaddr("eth1addr", info->mac1);
 		}
 
 		/* board serial-number */
 		sprintf(str, "%6d", info->serial);
-		env_set("serial#", str);
+		env_set(ctx_uboot, "serial#", str);
 
 		/* memory MB */
 		sprintf(str, "%d", (int) (gd->ram_size >> 20));
-		env_set("mem_mb", str);
+		env_set(ctx_uboot, "mem_mb", str);
 	}
 
 	/* Set a non-initialized hwconfig based on board configuration */
-	if (!strcmp(env_get("hwconfig"), "_UNKNOWN_")) {
+	if (!strcmp(env_get(ctx_uboot, "hwconfig"), "_UNKNOWN_")) {
 		buf[0] = 0;
 		if (gpio_cfg[board_type].rs232_en)
 			strcat(buf, "rs232;");
@@ -825,7 +826,7 @@ int misc_init_r(void)
 			if (strlen(buf) + strlen(buf1) < sizeof(buf))
 				strcat(buf, buf1);
 		}
-		env_set("hwconfig", buf);
+		env_set(ctx_uboot, "hwconfig", buf);
 	}
 
 	/* setup baseboard specific GPIO based on board and env */
@@ -1040,7 +1041,7 @@ int fdt_fixup_sky2(void *blob, int np, struct pci_dev *dev)
 	int j;
 
 	sprintf(mac, "eth1addr");
-	tmp = env_get(mac);
+	tmp = env_get(ctx_uboot, mac);
 	if (tmp) {
 		for (j = 0; j < 6; j++) {
 			mac_addr[j] = tmp ?
@@ -1128,8 +1129,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 		{ "sst,w25q256",          MTD_DEV_TYPE_NOR, },  /* SPI flash */
 		{ "fsl,imx6q-gpmi-nand",  MTD_DEV_TYPE_NAND, }, /* NAND flash */
 	};
-	const char *model = env_get("model");
-	const char *display = env_get("display");
+	const char *model = env_get(ctx_uboot, "model");
+	const char *display = env_get(ctx_uboot, "display");
 	int i;
 	char rev = 0;
 
@@ -1141,7 +1142,7 @@ int ft_board_setup(void *blob, bd_t *bd)
 		}
 	}
 
-	if (env_get("fdt_noauto")) {
+	if (env_get(ctx_uboot, "fdt_noauto")) {
 		puts("   Skiping ft_board_setup (fdt_noauto defined)\n");
 		return 0;
 	}
@@ -1162,15 +1163,15 @@ int ft_board_setup(void *blob, bd_t *bd)
 	printf("   Adjusting FDT per EEPROM for %s...\n", model);
 
 	/* board serial number */
-	fdt_setprop(blob, 0, "system-serial", env_get("serial#"),
-		    strlen(env_get("serial#")) + 1);
+	fdt_setprop(blob, 0, "system-serial", env_get(ctx_uboot, "serial#"),
+		    strlen(env_get(ctx_uboot, "serial#")) + 1);
 
 	/* board (model contains model from device-tree) */
 	fdt_setprop(blob, 0, "board", info->model,
 		    strlen((const char *)info->model) + 1);
 
 	/* set desired digital video capture format */
-	ft_sethdmiinfmt(blob, env_get("hdmiinfmt"));
+	ft_sethdmiinfmt(blob, env_get(ctx_uboot, "hdmiinfmt"));
 
 	/*
 	 * Board model specific fixups
@@ -1340,7 +1341,7 @@ int ft_board_setup(void *blob, bd_t *bd)
 	}
 
 #if defined(CONFIG_CMD_PCI)
-	if (!env_get("nopcifixup"))
+	if (!env_get(ctx_uboot, "nopcifixup"))
 		ft_board_pci_fixup(blob, bd);
 #endif
 
@@ -1349,7 +1350,7 @@ int ft_board_setup(void *blob, bd_t *bd)
 	 *  remove nodes by alias path if EEPROM config tells us the
 	 *  peripheral is not loaded on the board.
 	 */
-	if (env_get("fdt_noconfig")) {
+	if (env_get(ctx_uboot, "fdt_noconfig")) {
 		puts("   Skiping periperhal config (fdt_noconfig defined)\n");
 		return 0;
 	}
diff --git a/board/gateworks/gw_ventana/gw_ventana_spl.c b/board/gateworks/gw_ventana/gw_ventana_spl.c
index b0891379a170..a689ec16d98c 100644
--- a/board/gateworks/gw_ventana/gw_ventana_spl.c
+++ b/board/gateworks/gw_ventana/gw_ventana_spl.c
@@ -758,8 +758,8 @@ int spl_start_uboot(void)
 	debug("%s\n", __func__);
 #ifdef CONFIG_SPL_ENV_SUPPORT
 	env_init();
-	env_load();
-	debug("boot_os=%s\n", env_get("boot_os"));
+	env_load(ctx_uboot);
+	debug("boot_os=%s\n", env_get(ctx_uboot, "boot_os"));
 	if (env_get_yesno("boot_os") == 1)
 		ret = 0;
 #else
diff --git a/board/gdsys/a38x/keyprogram.c b/board/gdsys/a38x/keyprogram.c
index 000897984a6e..f65190d814c2 100644
--- a/board/gdsys/a38x/keyprogram.c
+++ b/board/gdsys/a38x/keyprogram.c
@@ -131,12 +131,12 @@ int load_and_run_keyprog(struct udevice *tpm)
 	char *hexprog;
 	struct key_program *prog;
 
-	cmd = env_get("loadkeyprogram");
+	cmd = env_get(ctx_uboot, "loadkeyprogram");
 
 	if (!cmd || run_command(cmd, 0))
 		return 1;
 
-	hexprog = env_get("keyprogram");
+	hexprog = env_get(ctx_uboot, "keyprogram");
 
 	if (decode_hexstr(hexprog, &binprog))
 		return 1;
diff --git a/board/gdsys/mpc8308/gazerbeam.c b/board/gdsys/mpc8308/gazerbeam.c
index ddd6ee895384..4929296364b3 100644
--- a/board/gdsys/mpc8308/gazerbeam.c
+++ b/board/gdsys/mpc8308/gazerbeam.c
@@ -85,7 +85,7 @@ int board_early_init_r(void)
 int checkboard(void)
 {
 	struct udevice *board;
-	char *s = env_get("serial#");
+	char *s = env_get(ctx_uboot, "serial#");
 	int mc = 0;
 	int con = 0;
 
@@ -137,7 +137,7 @@ int last_stage_init(void)
 			printf("Could not determind FPGA HW revision (res = %d)\n", res);
 	}
 
-	env_set_ulong("fpga_hw_rev", fpga_hw_rev);
+	env_set_ulong(ctx_uboot, "fpga_hw_rev", fpga_hw_rev);
 
 	ret = get_tpm(&tpm);
 	if (ret || tpm_init(tpm) || tpm_startup(tpm, TPM_ST_CLEAR) ||
diff --git a/board/gdsys/mpc8308/hrcon.c b/board/gdsys/mpc8308/hrcon.c
index 60faa4688cf8..666eb25c809c 100644
--- a/board/gdsys/mpc8308/hrcon.c
+++ b/board/gdsys/mpc8308/hrcon.c
@@ -101,7 +101,7 @@ int fpga_get_reg(u32 fpga, u16 *reg, off_t regoff, u16 *data)
 
 int checkboard(void)
 {
-	char *s = env_get("serial#");
+	char *s = env_get(ctx_uboot, "serial#");
 	bool hw_type_cat = pca9698_get_value(0x20, 20);
 
 	puts("Board: ");
diff --git a/board/gdsys/mpc8308/strider.c b/board/gdsys/mpc8308/strider.c
index 886bc2b035de..cc3fcd7de172 100644
--- a/board/gdsys/mpc8308/strider.c
+++ b/board/gdsys/mpc8308/strider.c
@@ -104,7 +104,7 @@ int fpga_get_reg(u32 fpga, u16 *reg, off_t regoff, u16 *data)
 
 int checkboard(void)
 {
-	char *s = env_get("serial#");
+	char *s = env_get(ctx_uboot, "serial#");
 	bool hw_type_cat = pca9698_get_value(0x20, 18);
 
 	puts("Board: ");
diff --git a/board/gdsys/p1022/controlcenterd-id.c b/board/gdsys/p1022/controlcenterd-id.c
index 43f5404231f0..db7c92446e75 100644
--- a/board/gdsys/p1022/controlcenterd-id.c
+++ b/board/gdsys/p1022/controlcenterd-id.c
@@ -231,7 +231,7 @@ static u8 *get_2nd_stage_bl_location(ulong target_addr)
 {
 	ulong addr;
 #ifdef CCDM_SECOND_STAGE
-	addr = env_get_ulong("loadaddr", 16, CONFIG_LOADADDR);
+	addr = env_get_ulong(ctx_uboot, "loadaddr", 16, CONFIG_LOADADDR);
 #else
 	addr = target_addr;
 #endif
@@ -249,7 +249,7 @@ static u8 *get_image_location(void)
 {
 	ulong addr;
 	/* TODO use other area? */
-	addr = env_get_ulong("loadaddr", 16, CONFIG_LOADADDR);
+	addr = env_get_ulong(ctx_uboot, "loadaddr", 16, CONFIG_LOADADDR);
 	return (u8 *)(addr);
 }
 #endif
@@ -1072,13 +1072,13 @@ static int second_stage_init(void)
 		goto failure;
 
 	/* run "prepboot" from env to get "mmcdev" set */
-	cptr = env_get("prepboot");
+	cptr = env_get(ctx_uboot, "prepboot");
 	if (cptr && !run_command(cptr, 0))
-		mmcdev = env_get("mmcdev");
+		mmcdev = env_get(ctx_uboot, "mmcdev");
 	if (!mmcdev)
 		goto failure;
 
-	cptr = env_get("ramdiskimage");
+	cptr = env_get(ctx_uboot, "ramdiskimage");
 	if (cptr)
 		image_path = cptr;
 
diff --git a/board/gdsys/p1022/controlcenterd.c b/board/gdsys/p1022/controlcenterd.c
index 6eb3d6c5d06e..ec349d61ee33 100644
--- a/board/gdsys/p1022/controlcenterd.c
+++ b/board/gdsys/p1022/controlcenterd.c
@@ -222,7 +222,7 @@ void hw_watchdog_reset(void)
 #ifdef CONFIG_TRAILBLAZER
 int do_bootd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-	return run_command(env_get("bootcmd"), flag);
+	return run_command(env_get(ctx_uboot, "bootcmd"), flag);
 }
 
 int board_early_init_r(void)
diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c
index 917ecc4c1816..3262a73d0b80 100644
--- a/board/ge/bx50v3/bx50v3.c
+++ b/board/ge/bx50v3/bx50v3.c
@@ -470,17 +470,17 @@ static void process_vpd(struct vpd_cache *vpd)
 
 	switch (vpd->product_id) {
 	case VPD_PRODUCT_B450:
-		env_set("confidx", "1");
+		env_set(ctx_uboot, "confidx", "1");
 		i210_index = 0;
 		fec_index = 1;
 		break;
 	case VPD_PRODUCT_B650:
-		env_set("confidx", "2");
+		env_set(ctx_uboot, "confidx", "2");
 		i210_index = 0;
 		fec_index = 1;
 		break;
 	case VPD_PRODUCT_B850:
-		env_set("confidx", "3");
+		env_set(ctx_uboot, "confidx", "3");
 		i210_index = 1;
 		fec_index = 2;
 		break;
@@ -647,9 +647,10 @@ int board_late_init(void)
 #endif
 
 	if (is_b850v3())
-		env_set("videoargs", "video=DP-1:1024x768 at 60 video=HDMI-A-1:1024x768 at 60");
+		env_set(ctx_uboot, "videoargs",
+			"video=DP-1:1024x768 at 60 video=HDMI-A-1:1024x768 at 60");
 	else
-		env_set("videoargs", "video=LVDS-1:1024x768 at 65");
+		env_set(ctx_uboot, "videoargs", "video=LVDS-1:1024x768 at 65");
 
 	/* board specific pmic init */
 	pmic_init();
@@ -669,7 +670,7 @@ static void remove_ethaddr_env_var(int index)
 	char env_var_name[9];
 
 	sprintf(env_var_name, index == 0 ? "ethaddr" : "eth%daddr", index);
-	env_set(env_var_name, NULL);
+	env_set(ctx_uboot, env_var_name, NULL);
 }
 
 int last_stage_init(void)
diff --git a/board/ge/common/ge_common.c b/board/ge/common/ge_common.c
index 501c8b2daf2a..1d5f7ac39350 100644
--- a/board/ge/common/ge_common.c
+++ b/board/ge/common/ge_common.c
@@ -29,7 +29,7 @@ void check_time(void)
 	}
 
 	if (ret < 0)
-		env_set("rtc_status", "RTC_ERROR");
+		env_set(ctx_uboot, "rtc_status", "RTC_ERROR");
 
 	if (tm.tm_year > 2037) {
 		tm.tm_sec  = 0;
@@ -47,7 +47,7 @@ void check_time(void)
 		}
 
 		if (ret < 0)
-			env_set("rtc_status", "RTC_ERROR");
+			env_set(ctx_uboot, "rtc_status", "RTC_ERROR");
 	}
 
 	i2c_set_bus_num(current_i2c_bus);
diff --git a/board/ge/mx53ppd/mx53ppd.c b/board/ge/mx53ppd/mx53ppd.c
index 544856729821..f2a76dc1ded8 100644
--- a/board/ge/mx53ppd/mx53ppd.c
+++ b/board/ge/mx53ppd/mx53ppd.c
@@ -274,7 +274,7 @@ int misc_init_r(void)
 	else
 		cause = "POR";
 
-	env_set("bootcause", cause);
+	env_set(ctx_uboot, "bootcause", cause);
 
 	return 0;
 }
diff --git a/board/grinn/chiliboard/board.c b/board/grinn/chiliboard/board.c
index c6d53600fa1c..933bdc779601 100644
--- a/board/grinn/chiliboard/board.c
+++ b/board/grinn/chiliboard/board.c
@@ -117,7 +117,7 @@ int board_late_init(void)
 	mac_addr[4] = mac_lo & 0xFF;
 	mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
-	if (!env_get("ethaddr")) {
+	if (!env_get(ctx_uboot, "ethaddr")) {
 		printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
 		if (is_valid_ethaddr(mac_addr))
@@ -133,7 +133,7 @@ int board_late_init(void)
 	mac_addr[4] = mac_lo & 0xFF;
 	mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
-	if (!env_get("eth1addr")) {
+	if (!env_get(ctx_uboot, "eth1addr")) {
 		if (is_valid_ethaddr(mac_addr))
 			eth_env_set_enetaddr("eth1addr", mac_addr);
 	}
diff --git a/board/grinn/liteboard/board.c b/board/grinn/liteboard/board.c
index 1558ea4b84f5..53eabe2e4b3b 100644
--- a/board/grinn/liteboard/board.c
+++ b/board/grinn/liteboard/board.c
@@ -127,7 +127,7 @@ int board_mmc_init(bd_t *bis)
 
 static int check_mmc_autodetect(void)
 {
-	char *autodetect_str = env_get("mmcautodetect");
+	char *autodetect_str = env_get(ctx_uboot, "mmcautodetect");
 
 	if ((autodetect_str != NULL) &&
 	    (strcmp(autodetect_str, "yes") == 0)) {
@@ -146,12 +146,12 @@ void board_late_mmc_init(void)
 	if (!check_mmc_autodetect())
 		return;
 
-	env_set_ulong("mmcdev", dev_no);
+	env_set_ulong(ctx_uboot, "mmcdev", dev_no);
 
 	/* Set mmcblk env */
 	sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw",
 		dev_no);
-	env_set("mmcroot", mmcblk);
+	env_set(ctx_uboot, "mmcroot", mmcblk);
 
 	sprintf(cmd, "mmc dev %d", dev_no);
 	run_command(cmd, 0);
diff --git a/board/highbank/highbank.c b/board/highbank/highbank.c
index 9563763dfa53..ef2f6f1f16a8 100644
--- a/board/highbank/highbank.c
+++ b/board/highbank/highbank.c
@@ -80,11 +80,12 @@ int misc_init_r(void)
 
 	boot_choice = readl(HB_SREG_A9_BOOT_SRC_STAT) & 0xff;
 	sprintf(envbuffer, "bootcmd%d", boot_choice);
-	if (env_get(envbuffer)) {
+	if (env_get(ctx_uboot, envbuffer)) {
 		sprintf(envbuffer, "run bootcmd%d", boot_choice);
-		env_set("bootcmd", envbuffer);
-	} else
-		env_set("bootcmd", "");
+		env_set(ctx_uboot, "bootcmd", envbuffer);
+	} else {
+		env_set(ctx_uboot, "bootcmd", "");
+	}
 
 	return 0;
 }
diff --git a/board/hisilicon/poplar/poplar.c b/board/hisilicon/poplar/poplar.c
index 4926419a905a..1177e91a688a 100644
--- a/board/hisilicon/poplar/poplar.c
+++ b/board/hisilicon/poplar/poplar.c
@@ -177,7 +177,7 @@ int board_usb_init(int index, enum usb_init_type init)
 
 int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
 {
-	if (!env_get("serial#"))
+	if (!env_get(ctx_uboot, "serial#"))
 		g_dnl_set_serialnumber("0123456789POPLAR");
 	return 0;
 }
diff --git a/board/imgtec/ci20/ci20.c b/board/imgtec/ci20/ci20.c
index 5368b67b38b6..a34553a7bb3b 100644
--- a/board/imgtec/ci20/ci20.c
+++ b/board/imgtec/ci20/ci20.c
@@ -181,12 +181,12 @@ int misc_init_r(void)
 	eth_env_set_enetaddr("ethaddr", otp.mac);
 
 	/* Put other board information into the environment */
-	env_set_ulong("serial#", otp.serial_number);
-	env_set_ulong("board_date", otp.date);
+	env_set_ulong(ctx_uboot, "serial#", otp.serial_number);
+	env_set_ulong(ctx_uboot, "board_date", otp.date);
 	manufacturer[0] = otp.manufacturer[0];
 	manufacturer[1] = otp.manufacturer[1];
 	manufacturer[2] = 0;
-	env_set("board_mfr", manufacturer);
+	env_set(ctx_uboot, "board_mfr", manufacturer);
 
 	return 0;
 }
diff --git a/board/intel/edison/edison.c b/board/intel/edison/edison.c
index f56b5b1affef..2de8a4936286 100644
--- a/board/intel/edison/edison.c
+++ b/board/intel/edison/edison.c
@@ -71,14 +71,14 @@ static void assign_serial(void)
 
 	snprintf(usb0addr, sizeof(usb0addr), "02:00:86:%02x:%02x:%02x",
 		 ssn[13], ssn[14], ssn[15]);
-	env_set("usb0addr", usb0addr);
+	env_set(ctx_uboot, "usb0addr", usb0addr);
 
 	for (i = 0; i < 16; i++)
 		snprintf(&serial[2 * i], 3, "%02x", ssn[i]);
-	env_set("serial#", serial);
+	env_set(ctx_uboot, "serial#", serial);
 
 #if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
-	env_save();
+	env_save(ctx_uboot);
 #endif
 }
 
@@ -93,19 +93,19 @@ static void assign_hardware_id(void)
 		printf("Can't retrieve hardware revision\n");
 
 	snprintf(hardware_id, sizeof(hardware_id), "%02X", v.hardware_id);
-	env_set("hardware_id", hardware_id);
+	env_set(ctx_uboot, "hardware_id", hardware_id);
 
 #if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
-	env_save();
+	env_save(ctx_uboot);
 #endif
 }
 
 int board_late_init(void)
 {
-	if (!env_get("serial#"))
+	if (!env_get(ctx_uboot, "serial#"))
 		assign_serial();
 
-	if (!env_get("hardware_id"))
+	if (!env_get(ctx_uboot, "hardware_id"))
 		assign_hardware_id();
 
 	return 0;
diff --git a/board/isee/igep003x/board.c b/board/isee/igep003x/board.c
index a8c2b121a476..56ecf3497245 100644
--- a/board/isee/igep003x/board.c
+++ b/board/isee/igep003x/board.c
@@ -193,13 +193,13 @@ int board_late_init(void)
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 	switch (get_board_revision()) {
 		case 0:
-			env_set("board_name", "igep0034-lite");
+			env_set(ctx_uboot, "board_name", "igep0034-lite");
 			break;
 		case 1:
-			env_set("board_name", "igep0034");
+			env_set(ctx_uboot, "board_name", "igep0034");
 			break;
 		default:
-			env_set("board_name", "igep0033");
+			env_set(ctx_uboot, "board_name", "igep0033");
 			break;
 	}
 #endif
diff --git a/board/isee/igep00x0/igep00x0.c b/board/isee/igep00x0/igep00x0.c
index 74fc5f08900a..42476b2b657b 100644
--- a/board/isee/igep00x0/igep00x0.c
+++ b/board/isee/igep00x0/igep00x0.c
@@ -199,8 +199,8 @@ void set_boardname(void)
 	int i = get_board_revision();
 
 	rev[i+1] = 0;
-	env_set("board_rev", rev + i);
-	env_set("board_name", i < 2 ? "igep0020" : "igep0030");
+	env_set(ctx_uboot, "board_rev", rev + i);
+	env_set(ctx_uboot, "board_name", i < 2 ? "igep0020" : "igep0030");
 }
 
 /*
diff --git a/board/k+p/kp_imx53/kp_id_rev.c b/board/k+p/kp_imx53/kp_id_rev.c
index 9dae54dda5fc..5c9258912c89 100644
--- a/board/k+p/kp_imx53/kp_id_rev.c
+++ b/board/k+p/kp_imx53/kp_id_rev.c
@@ -31,7 +31,7 @@ void show_eeprom(void)
 
 	if (!strncmp(safe_string, "TQM", 3)) {
 		printf("  ID: %s\n", safe_string);
-		env_set("boardtype", safe_string);
+		env_set(ctx_uboot, "boardtype", safe_string);
 	} else {
 		puts("  unknown hardware variant\n");
 	}
@@ -45,7 +45,7 @@ void show_eeprom(void)
 
 	if (strlen(safe_string) == 8) {
 		printf("  SN: %s\n", safe_string);
-		env_set("serial#", safe_string);
+		env_set(ctx_uboot, "serial#", safe_string);
 	} else {
 		puts("  unknown serial number\n");
 	}
@@ -103,18 +103,18 @@ int read_board_id(void)
 	sprintf(rev_str, "%02X", rev_id);
 	if (rev_id & 0x80) {
 		printf("BBoard:4x00 Rev:%s\n", rev_str);
-		env_set("boardtype", "ddc");
-		env_set("fit_config", "imx53_kb_conf");
+		env_set(ctx_uboot, "boardtype", "ddc");
+		env_set(ctx_uboot, "fit_config", "imx53_kb_conf");
 	} else {
 		printf("BBoard:40x0 Rev:%s\n", rev_str);
-		env_set("boardtype", "hsc");
-		env_set("fit_config", "imx53_kb_40x0_conf");
+		env_set(ctx_uboot, "boardtype", "hsc");
+		env_set(ctx_uboot, "fit_config", "imx53_kb_40x0_conf");
 	}
 
-	sprintf(buf, "kp-%s", env_get("boardtype"));
-	env_set("boardname", buf);
-	env_set("boardsoc", "imx53");
-	env_set("kb53_rev", rev_str);
+	sprintf(buf, "kp-%s", env_get(ctx_uboot, "boardtype"));
+	env_set(ctx_uboot, "boardname", buf);
+	env_set(ctx_uboot, "boardsoc", "imx53");
+	env_set(ctx_uboot, "kb53_rev", rev_str);
 
 	return 0;
 }
diff --git a/board/k+p/kp_imx53/kp_imx53.c b/board/k+p/kp_imx53/kp_imx53.c
index 84cddd489490..36b9b9377f03 100644
--- a/board/k+p/kp_imx53/kp_imx53.c
+++ b/board/k+p/kp_imx53/kp_imx53.c
@@ -124,9 +124,9 @@ void board_misc_setup(void)
 	gpio_direction_input(KEY1);
 
 	if (gpio_get_value(KEY1))
-		env_set("key1", "off");
+		env_set(ctx_uboot, "key1", "off");
 	else
-		env_set("key1", "on");
+		env_set(ctx_uboot, "key1", "on");
 }
 
 int board_late_init(void)
diff --git a/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c
index 2c541ace0210..9536ae2171d2 100644
--- a/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c
+++ b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c
@@ -290,8 +290,8 @@ int board_late_init(void)
 	add_board_boot_modes(board_boot_modes);
 #endif
 
-	env_set("boardname", "kp-tpc");
-	env_set("boardsoc", "imx6q");
+	env_set(ctx_uboot, "boardname", "kp-tpc");
+	env_set(ctx_uboot, "boardsoc", "imx6q");
 	return 0;
 }
 
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
index 08f7f8d88451..3e15a063b34a 100644
--- a/board/keymile/common/common.c
+++ b/board/keymile/common/common.c
@@ -51,24 +51,24 @@ 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);
-	env_set("pnvramaddr", (char *)buf);
+	env_set(ctx_uboot, "pnvramaddr", (char *)buf);
 
 	/* try to read rootfssize (ram image) from environment */
-	p = env_get("rootfssize");
+	p = env_get(ctx_uboot, "rootfssize");
 	if (p != NULL)
 		strict_strtoul(p, 16, &rootfssize);
 	pram = (rootfssize + CONFIG_KM_RESERVED_PRAM + CONFIG_KM_PHRAM +
 		CONFIG_KM_PNVRAM) / 0x400;
 	sprintf((char *)buf, "0x%x", pram);
-	env_set("pram", (char *)buf);
+	env_set(ctx_uboot, "pram", (char *)buf);
 
 	varaddr = gd->ram_size - CONFIG_KM_RESERVED_PRAM - CONFIG_KM_PHRAM;
 	sprintf((char *)buf, "0x%x", varaddr);
-	env_set("varaddr", (char *)buf);
+	env_set(ctx_uboot, "varaddr", (char *)buf);
 
 	kernelmem = gd->ram_size - 0x400 * pram;
 	sprintf((char *)buf, "0x%x", kernelmem);
-	env_set("kernelmem", (char *)buf);
+	env_set(ctx_uboot, "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);
-	env_set("boardid", (char *)buf);
+	env_set(ctx_uboot, "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);
-	env_set("hwkey", (char *)buf);
+	env_set(ctx_uboot, "hwkey", (char *)buf);
 	printf("set hwkey=%s\n", buf);
 	printf("Execute manually saveenv for persistent storage.\n");
 
@@ -236,10 +236,10 @@ static int do_checkboardidhwk(cmd_tbl_t *cmdtp, int flag, int argc,
 	}
 
 	/* now try to read values from environment if available */
-	p = env_get("boardid");
+	p = env_get(ctx_uboot, "boardid");
 	if (p != NULL)
 		rc = strict_strtoul(p, 16, &envbid);
-	p = env_get("hwkey");
+	p = env_get(ctx_uboot, "hwkey");
 	if (p != NULL)
 		rc = strict_strtoul(p, 16, &envhwkey);
 
@@ -253,7 +253,7 @@ static int do_checkboardidhwk(cmd_tbl_t *cmdtp, int flag, int argc,
 		 * BoardId/HWkey not available in the environment, so try the
 		 * environment variable for BoardId/HWkey list
 		 */
-		char *bidhwklist = env_get("boardIdListHex");
+		char *bidhwklist = env_get(ctx_uboot, "boardIdListHex");
 
 		if (bidhwklist) {
 			int found = 0;
@@ -311,9 +311,9 @@ static int do_checkboardidhwk(cmd_tbl_t *cmdtp, int flag, int argc,
 					envbid   = bid;
 					envhwkey = hwkey;
 					sprintf(buf, "%lx", bid);
-					env_set("boardid", buf);
+					env_set(ctx_uboot, "boardid", buf);
 					sprintf(buf, "%lx", hwkey);
-					env_set("hwkey", buf);
+					env_set(ctx_uboot, "hwkey", buf);
 				}
 			} /* end while( ! found ) */
 		}
@@ -355,7 +355,7 @@ static int do_checktestboot(cmd_tbl_t *cmdtp, int flag, int argc,
 #if defined(CONFIG_POST)
 	testpin = post_hotkeys_pressed();
 #endif
-	s = env_get("test_bank");
+	s = env_get(ctx_uboot, "test_bank");
 	/* when test_bank is not set, act as if testpin is not asserted */
 	testboot = (testpin != 0) && (s);
 	if (verbose) {
diff --git a/board/keymile/common/ivm.c b/board/keymile/common/ivm.c
index 50df44d1c110..d255a34ae677 100644
--- a/board/keymile/common/ivm.c
+++ b/board/keymile/common/ivm.c
@@ -261,7 +261,7 @@ int ivm_analyze_eeprom(unsigned char *buf, int len)
 
 	GET_STRING("IVM_Symbol", IVM_POS_SYMBOL_ONLY, 8)
 	GET_STRING("IVM_DeviceName", IVM_POS_SHORT_TEXT, 64)
-	tmp = (unsigned char *)env_get("IVM_DeviceName");
+	tmp = (unsigned char *)env_get(ctx_uboot, "IVM_DeviceName");
 	if (tmp) {
 		int	len = strlen((char *)tmp);
 		int	i = 0;
@@ -310,16 +310,16 @@ 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);
-	env_set((char *)"ethaddr", (char *)valbuf);
+	env_set(ctx_uboot, (char *)"ethaddr", (char *)valbuf);
 #else
 /* KMTEGR1 has a special setup. eth0 has no connection to the outside and
  * gets an locally administred MAC address, eth1 is the debug interface and
  * gets the official MAC address from the IVM
  */
 	process_mac(valbuf, page2, CONFIG_PIGGY_MAC_ADRESS_OFFSET, false);
-	env_set((char *)"ethaddr", (char *)valbuf);
+	env_set(ctx_uboot, (char *)"ethaddr", (char *)valbuf);
 	process_mac(valbuf, page2, CONFIG_PIGGY_MAC_ADRESS_OFFSET, true);
-	env_set((char *)"eth1addr", (char *)valbuf);
+	env_set(ctx_uboot, (char *)"eth1addr", (char *)valbuf);
 #endif
 
 	return 0;
diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c
index 8846b64f7d79..68a1ddb886b9 100644
--- a/board/keymile/km83xx/km83xx.c
+++ b/board/keymile/km83xx/km83xx.c
@@ -199,7 +199,7 @@ int last_stage_init(void)
 	if (dip_switch != 0) {
 		/* start bootloader */
 		puts("DIP:   Enabled\n");
-		env_set("actual_bank", "0");
+		env_set(ctx_uboot, "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 922cc621f780..0c2ede5231bb 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);
-	env_set("bootcountaddr", (char *)buf);
+	env_set(ctx_uboot, "bootcountaddr", (char *)buf);
 }
 
 int misc_init_r(void)
@@ -201,7 +201,7 @@ int misc_init_r(void)
 #if defined(CONFIG_KM_MGCOGE3UN)
 	char *wait_for_ne;
 	u8 dip_switch = kw_gpio_get_value(KM_FLASH_ERASE_ENABLE);
-	wait_for_ne = env_get("waitforne");
+	wait_for_ne = env_get(ctx_uboot, "waitforne");
 
 	if ((wait_for_ne != NULL) && (dip_switch == 0)) {
 		if (strcmp(wait_for_ne, "true") == 0) {
@@ -299,7 +299,7 @@ int board_late_init(void)
 	if (dip_switch != 0) {
 		/* start bootloader */
 		puts("DIP:   Enabled\n");
-		env_set("actual_bank", "0");
+		env_set(ctx_uboot, "actual_bank", "0");
 	}
 #endif
 
diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c
index 4d1e38aa3a7a..f4901f6bed9d 100644
--- a/board/keymile/kmp204x/kmp204x.c
+++ b/board/keymile/kmp204x/kmp204x.c
@@ -220,7 +220,7 @@ int last_stage_init(void)
 	if (dip_switch != 0) {
 		/* start bootloader */
 		puts("DIP:   Enabled\n");
-		env_set("actual_bank", "0");
+		env_set(ctx_uboot, "actual_bank", "0");
 	}
 #endif
 	set_km_env();
@@ -237,7 +237,7 @@ void fdt_fixup_fman_mac_addresses(void *blob)
 	unsigned char mac_addr[6];
 
 	/* get the mac addr from env */
-	tmp = env_get("ethaddr");
+	tmp = env_get(ctx_uboot, "ethaddr");
 	if (!tmp) {
 		printf("ethaddr env variable not defined\n");
 		return;
diff --git a/board/kosagi/novena/novena.c b/board/kosagi/novena/novena.c
index b7b747d19658..968d455b45c6 100644
--- a/board/kosagi/novena/novena.c
+++ b/board/kosagi/novena/novena.c
@@ -201,7 +201,7 @@ int misc_init_r(void)
 	int ret;
 
 	/* If 'ethaddr' is already set, do nothing. */
-	if (env_get("ethaddr"))
+	if (env_get(ctx_uboot, "ethaddr"))
 		return 0;
 
 	/* EEPROM is at bus 2. */
diff --git a/board/laird/wb50n/wb50n.c b/board/laird/wb50n/wb50n.c
index a2f8eaf0ba34..cc7cd3cf7250 100644
--- a/board/laird/wb50n/wb50n.c
+++ b/board/laird/wb50n/wb50n.c
@@ -122,7 +122,7 @@ int board_late_init(void)
 	for (p = name; *p != '\0'; *p = tolower(*p), p++)
 		;
 	strcat(name, "-wb50n");
-	env_set(LAIRD_NAME, name);
+	env_set(ctx_uboot, LAIRD_NAME, name);
 
 #endif
 
diff --git a/board/lg/sniper/sniper.c b/board/lg/sniper/sniper.c
index b4205d6ed4c1..0dff96ef02aa 100644
--- a/board/lg/sniper/sniper.c
+++ b/board/lg/sniper/sniper.c
@@ -133,8 +133,8 @@ int misc_init_r(void)
 	}
 
 	if (reboot_mode[0] > 0 && isascii(reboot_mode[0])) {
-		if (!env_get("reboot-mode"))
-			env_set("reboot-mode", (char *)reboot_mode);
+		if (!env_get(ctx_uboot, "reboot-mode"))
+			env_set(ctx_uboot, "reboot-mode", (char *)reboot_mode);
 	}
 
 	omap_reboot_mode_clear();
diff --git a/board/liebherr/display5/spl.c b/board/liebherr/display5/spl.c
index 354b63e431f6..6ce1554e044d 100644
--- a/board/liebherr/display5/spl.c
+++ b/board/liebherr/display5/spl.c
@@ -284,10 +284,10 @@ void board_boot_order(u32 *spl_boot_list)
 	/* 'fastboot' */
 	const char *s;
 
-	if (env_init() || env_load())
+	if (env_init() || env_load(ctx_uboot))
 		return;
 
-	s = env_get("BOOT_FROM");
+	s = env_get(ctx_uboot, "BOOT_FROM");
 	if (s && !bootcount_error() && strcmp(s, "ACTIVE") == 0) {
 		spl_boot_list[0] = BOOT_DEVICE_MMC1;
 		spl_boot_list[1] = spl_boot_device();
diff --git a/board/liebherr/mccmon6/mccmon6.c b/board/liebherr/mccmon6/mccmon6.c
index 7d2751ab0393..6164317e607c 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)
 {
-	env_set("board_name", "mccmon6");
+	env_set(ctx_uboot, "board_name", "mccmon6");
 
 	return 0;
 }
@@ -467,7 +467,7 @@ int spl_start_uboot(void)
 		return 1;
 
 	env_init();
-	ret = env_get_f("boot_os", s, sizeof(s));
+	ret = env_get_f("boot_os", s, sizeof(ctx_uboot, s));
 	if ((ret != -1) && (strcmp(s, "no") == 0))
 		return 1;
 
@@ -481,7 +481,7 @@ int spl_start_uboot(void)
 	 * recovery_status = <any value> -> start SWUpdate
 	 *
 	 */
-	ret = env_get_f("recovery_status", s, sizeof(s));
+	ret = env_get_f("recovery_status", s, sizeof(ctx_uboot, s));
 	if (ret != -1)
 		return 1;
 
diff --git a/board/logicpd/imx6/imx6logic.c b/board/logicpd/imx6/imx6logic.c
index 7a59b89d94a2..204a92761459 100644
--- a/board/logicpd/imx6/imx6logic.c
+++ b/board/logicpd/imx6/imx6logic.c
@@ -149,12 +149,12 @@ int board_init(void)
 
 int board_late_init(void)
 {
-	env_set("board_name", "imx6logic");
+	env_set(ctx_uboot, "board_name", "imx6logic");
 
 	if (is_mx6dq()) {
-		env_set("board_rev", "MX6DQ");
-		if (!env_get("fdt_file"))
-			env_set("fdt_file", "imx6q-logicpd.dtb");
+		env_set(ctx_uboot, "board_rev", "MX6DQ");
+		if (!env_get(ctx_uboot, "fdt_file"))
+			env_set(ctx_uboot, "fdt_file", "imx6q-logicpd.dtb");
 	}
 
 	return 0;
diff --git a/board/menlo/m53menlo/m53menlo.c b/board/menlo/m53menlo/m53menlo.c
index bda5f0df5bce..f84e0f7d5928 100644
--- a/board/menlo/m53menlo/m53menlo.c
+++ b/board/menlo/m53menlo/m53menlo.c
@@ -339,7 +339,7 @@ int board_late_init(void)
 
 	splash_get_pos(&xpos, &ypos);
 
-	s = env_get("splashimage");
+	s = env_get(ctx_uboot, "splashimage");
 	if (!s)
 		return 0;
 
diff --git a/board/micronas/vct/vct.c b/board/micronas/vct/vct.c
index e73d16db3eaf..6ae3dceaef87 100644
--- a/board/micronas/vct/vct.c
+++ b/board/micronas/vct/vct.c
@@ -72,7 +72,7 @@ int dram_init(void)
 int checkboard(void)
 {
 	char buf[64];
-	int i = env_get_f("serial#", buf, sizeof(buf));
+	int i = env_get_f("serial#", buf, sizeof(ctx_uboot, buf));
 	u32 config0 = read_c0_prid();
 
 	if ((config0 & 0xff0000) == PRID_COMP_LEGACY
diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c
index 71ca79deab7f..ca486eab1e29 100644
--- a/board/nokia/rx51/rx51.c
+++ b/board/nokia/rx51/rx51.c
@@ -234,18 +234,18 @@ void setup_board_tags(struct tag **in_params)
 	params->u.core.rootdev = 0x0;
 
 	/* append omap atag only if env setup_omap_atag is set to 1 */
-	str = env_get("setup_omap_atag");
+	str = env_get(ctx_uboot, "setup_omap_atag");
 	if (!str || str[0] != '1')
 		return;
 
-	str = env_get("setup_console_atag");
+	str = env_get(ctx_uboot, "setup_console_atag");
 	if (str && str[0] == '1')
 		setup_console_atag = 1;
 	else
 		setup_console_atag = 0;
 
-	setup_boot_reason_atag = env_get("setup_boot_reason_atag");
-	setup_boot_mode_atag = env_get("setup_boot_mode_atag");
+	setup_boot_reason_atag = env_get(ctx_uboot, "setup_boot_reason_atag");
+	setup_boot_mode_atag = env_get(ctx_uboot, "setup_boot_mode_atag");
 
 	params = *in_params;
 	t = (struct tag_omap *)&params->u;
@@ -413,7 +413,7 @@ int misc_init_r(void)
 
 	/* set env variable attkernaddr for relocated kernel */
 	sprintf(buf, "%#x", KERNEL_ADDRESS);
-	env_set("attkernaddr", buf);
+	env_set(ctx_uboot, "attkernaddr", buf);
 
 	/* initialize omap tags */
 	init_omap_tags();
diff --git a/board/overo/overo.c b/board/overo/overo.c
index 442028a764c7..f0b230eabb13 100644
--- a/board/overo/overo.c
+++ b/board/overo/overo.c
@@ -170,47 +170,47 @@ int misc_init_r(void)
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
-		env_set("defaultdisplay", "dvi");
-		env_set("expansionname", "summit");
+		env_set(ctx_uboot, "defaultdisplay", "dvi");
+		env_set(ctx_uboot, "expansionname", "summit");
 		break;
 	case GUMSTIX_TOBI:
 		printf("Recognized Tobi expansion board (rev %d %s)\n",
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
-		env_set("defaultdisplay", "dvi");
-		env_set("expansionname", "tobi");
+		env_set(ctx_uboot, "defaultdisplay", "dvi");
+		env_set(ctx_uboot, "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();
-		env_set("expansionname", "tobiduo");
+		env_set(ctx_uboot, "expansionname", "tobiduo");
 		break;
 	case GUMSTIX_PALO35:
 		printf("Recognized Palo35 expansion board (rev %d %s)\n",
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
-		env_set("defaultdisplay", "lcd35");
-		env_set("expansionname", "palo35");
+		env_set(ctx_uboot, "defaultdisplay", "lcd35");
+		env_set(ctx_uboot, "expansionname", "palo35");
 		break;
 	case GUMSTIX_PALO43:
 		printf("Recognized Palo43 expansion board (rev %d %s)\n",
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
-		env_set("defaultdisplay", "lcd43");
-		env_set("expansionname", "palo43");
+		env_set(ctx_uboot, "defaultdisplay", "lcd43");
+		env_set(ctx_uboot, "expansionname", "palo43");
 		break;
 	case GUMSTIX_CHESTNUT43:
 		printf("Recognized Chestnut43 expansion board (rev %d %s)\n",
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
-		env_set("defaultdisplay", "lcd43");
-		env_set("expansionname", "chestnut43");
+		env_set(ctx_uboot, "defaultdisplay", "lcd43");
+		env_set(ctx_uboot, "expansionname", "chestnut43");
 		break;
 	case GUMSTIX_PINTO:
 		printf("Recognized Pinto expansion board (rev %d %s)\n",
@@ -223,8 +223,8 @@ int misc_init_r(void)
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
-		env_set("defaultdisplay", "lcd43");
-		env_set("expansionname", "gallop43");
+		env_set(ctx_uboot, "defaultdisplay", "lcd43");
+		env_set(ctx_uboot, "expansionname", "gallop43");
 		break;
 	case GUMSTIX_ALTO35:
 		printf("Recognized Alto35 expansion board (rev %d %s)\n",
@@ -232,8 +232,8 @@ int misc_init_r(void)
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
 		MUX_ALTO35();
-		env_set("defaultdisplay", "lcd35");
-		env_set("expansionname", "alto35");
+		env_set(ctx_uboot, "defaultdisplay", "lcd35");
+		env_set(ctx_uboot, "expansionname", "alto35");
 		break;
 	case GUMSTIX_STAGECOACH:
 		printf("Recognized Stagecoach expansion board (rev %d %s)\n",
@@ -259,8 +259,8 @@ int misc_init_r(void)
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
 		MUX_ARBOR43C();
-		env_set("defaultdisplay", "lcd43");
-		env_set("expansionname", "arbor43c");
+		env_set(ctx_uboot, "defaultdisplay", "lcd43");
+		env_set(ctx_uboot, "expansionname", "arbor43c");
 		break;
 	case ETTUS_USRP_E:
 		printf("Recognized Ettus Research USRP-E (rev %d %s)\n",
@@ -268,13 +268,13 @@ int misc_init_r(void)
 			expansion_config.fab_revision);
 		MUX_GUMSTIX();
 		MUX_USRP_E();
-		env_set("defaultdisplay", "dvi");
+		env_set(ctx_uboot, "defaultdisplay", "dvi");
 		break;
 	case GUMSTIX_NO_EEPROM:
 	case GUMSTIX_EMPTY_EEPROM:
 		puts("No or empty EEPROM on expansion board\n");
 		MUX_GUMSTIX();
-		env_set("expansionname", "tobi");
+		env_set(ctx_uboot, "expansionname", "tobi");
 		break;
 	default:
 		printf("Unrecognized expansion board 0x%08x\n", expansion_id);
@@ -282,14 +282,15 @@ int misc_init_r(void)
 	}
 
 	if (expansion_config.content == 1)
-		env_set(expansion_config.env_var, expansion_config.env_setting);
+		env_set(ctx_uboot, expansion_config.env_var,
+			expansion_config.env_setting);
 
 	omap_die_id_display();
 
 	if (get_cpu_family() == CPU_OMAP34XX)
-		env_set("boardname", "overo");
+		env_set(ctx_uboot, "boardname", "overo");
 	else
-		env_set("boardname", "overo-storm");
+		env_set(ctx_uboot, "boardname", "overo-storm");
 
 	return 0;
 }
diff --git a/board/phytec/pcm052/pcm052.c b/board/phytec/pcm052/pcm052.c
index e1ebe8e75d00..f66bacfb2172 100644
--- a/board/phytec/pcm052/pcm052.c
+++ b/board/phytec/pcm052/pcm052.c
@@ -376,8 +376,8 @@ int board_late_init(void)
 	if ((reg & SRC_SBMR1_BOOTCFG1_SDMMC) &&
 	    !(reg & SRC_SBMR1_BOOTCFG1_MMC)) {
 		printf("------ SD card boot -------\n");
-		env_set_default("!LVFBootloader", 0);
-		env_set("bootcmd",
+		env_set_default(ctx_uboot, "!LVFBootloader", 0);
+		env_set(ctx_uboot, "bootcmd",
 			"run prepare_install_bk4r1_envs; run install_bk4r1rs");
 	}
 
diff --git a/board/phytec/pfla02/pfla02.c b/board/phytec/pfla02/pfla02.c
index ae9ffe0390c3..bbcd8cf934d3 100644
--- a/board/phytec/pfla02/pfla02.c
+++ b/board/phytec/pfla02/pfla02.c
@@ -392,7 +392,7 @@ int board_late_init(void)
 #endif
 
 	snprintf(buf, sizeof(buf), "%d", get_board_rev());
-	env_set("board_rev", buf);
+	env_set(ctx_uboot, "board_rev", buf);
 
 	return 0;
 }
diff --git a/board/qualcomm/dragonboard410c/dragonboard410c.c b/board/qualcomm/dragonboard410c/dragonboard410c.c
index d7f0f93fb109..bdf6e13ad06f 100644
--- a/board/qualcomm/dragonboard410c/dragonboard410c.c
+++ b/board/qualcomm/dragonboard410c/dragonboard410c.c
@@ -139,8 +139,8 @@ int misc_init_r(void)
 	}
 
 	if (dm_gpio_get_value(&resin)) {
-		env_set("bootdelay", "-1");
-		env_set("bootcmd", "fastboot 0");
+		env_set(ctx_uboot, "bootdelay", "-1");
+		env_set(ctx_uboot, "bootcmd", "fastboot 0");
 		printf("key_vol_down pressed - Starting fastboot.\n");
 	}
 
@@ -158,7 +158,7 @@ int board_late_init(void)
 
 	memset(serial, 0, 16);
 	snprintf(serial, 13, "%x", msm_board_serial());
-	env_set("serial#", serial);
+	env_set(ctx_uboot, "serial#", serial);
 	return 0;
 }
 
diff --git a/board/qualcomm/dragonboard820c/dragonboard820c.c b/board/qualcomm/dragonboard820c/dragonboard820c.c
index 7a889646df8d..475e1aa64560 100644
--- a/board/qualcomm/dragonboard820c/dragonboard820c.c
+++ b/board/qualcomm/dragonboard820c/dragonboard820c.c
@@ -155,7 +155,7 @@ int misc_init_r(void)
 	}
 
 	if (dm_gpio_get_value(&resin)) {
-		env_set("bootdelay", "-1");
+		env_set(ctx_uboot, "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 7a6ca8f759e6..5d4d59fd25ca 100644
--- a/board/raspberrypi/rpi/rpi.c
+++ b/board/raspberrypi/rpi/rpi.c
@@ -290,11 +290,11 @@ static void set_fdtfile(void)
 {
 	const char *fdtfile;
 
-	if (env_get("fdtfile"))
+	if (env_get(ctx_uboot, "fdtfile"))
 		return;
 
 	fdtfile = model->fdtfile;
-	env_set("fdtfile", fdtfile);
+	env_set(ctx_uboot, "fdtfile", fdtfile);
 }
 
 /*
@@ -303,13 +303,13 @@ static void set_fdtfile(void)
  */
 static void set_fdt_addr(void)
 {
-	if (env_get("fdt_addr"))
+	if (env_get(ctx_uboot, "fdt_addr"))
 		return;
 
 	if (fdt_magic(fw_dtb_pointer) != FDT_MAGIC)
 		return;
 
-	env_set_hex("fdt_addr", fw_dtb_pointer);
+	env_set_hex(ctx_uboot, "fdt_addr", fw_dtb_pointer);
 }
 
 /*
@@ -330,7 +330,7 @@ static void set_usbethaddr(void)
 	if (!model->has_onboard_eth)
 		return;
 
-	if (env_get("usbethaddr"))
+	if (env_get(ctx_uboot, "usbethaddr"))
 		return;
 
 	BCM2835_MBOX_INIT_HDR(msg);
@@ -345,8 +345,8 @@ static void set_usbethaddr(void)
 
 	eth_env_set_enetaddr("usbethaddr", msg->get_mac_address.body.resp.mac);
 
-	if (!env_get("ethaddr"))
-		env_set("ethaddr", env_get("usbethaddr"));
+	if (!env_get(ctx_uboot, "ethaddr"))
+		env_set(ctx_uboot, "ethaddr", env_get("usbethaddr"));
 
 	return;
 }
@@ -357,13 +357,13 @@ static void set_board_info(void)
 	char s[11];
 
 	snprintf(s, sizeof(s), "0x%X", revision);
-	env_set("board_revision", s);
+	env_set(ctx_uboot, "board_revision", s);
 	snprintf(s, sizeof(s), "%d", rev_scheme);
-	env_set("board_rev_scheme", s);
+	env_set(ctx_uboot, "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);
-	env_set("board_rev", s);
-	env_set("board_name", model->name);
+	env_set(ctx_uboot, "board_rev", s);
+	env_set(ctx_uboot, "board_name", model->name);
 }
 #endif /* CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG */
 
@@ -373,7 +373,7 @@ static void set_serial_number(void)
 	int ret;
 	char serial_string[17] = { 0 };
 
-	if (env_get("serial#"))
+	if (env_get(ctx_uboot, "serial#"))
 		return;
 
 	BCM2835_MBOX_INIT_HDR(msg);
@@ -388,7 +388,7 @@ static void set_serial_number(void)
 
 	snprintf(serial_string, sizeof(serial_string), "%016llx",
 		 msg->get_board_serial.body.resp.serial);
-	env_set("serial#", serial_string);
+	env_set(ctx_uboot, "serial#", serial_string);
 }
 
 int misc_init_r(void)
diff --git a/board/renesas/alt/alt.c b/board/renesas/alt/alt.c
index 10ef7f931b1f..bc94a22e9603 100644
--- a/board/renesas/alt/alt.c
+++ b/board/renesas/alt/alt.c
@@ -128,7 +128,8 @@ void reset_cpu(ulong addr)
 		hang();
 }
 
-enum env_location env_get_location(enum env_operation op, int prio)
+enum env_location env_get_location(struct env_context *ctx,
+				   enum env_operation op, int prio)
 {
 	const u32 load_magic = 0xb33fc0de;
 
diff --git a/board/renesas/gose/gose.c b/board/renesas/gose/gose.c
index f86c9f1a6350..d3ec352e2a03 100644
--- a/board/renesas/gose/gose.c
+++ b/board/renesas/gose/gose.c
@@ -134,7 +134,8 @@ void reset_cpu(ulong addr)
 		hang();
 }
 
-enum env_location env_get_location(enum env_operation op, int prio)
+enum env_location env_get_location(struct env_context *ctx,
+				   enum env_operation op, int prio)
 {
 	const u32 load_magic = 0xb33fc0de;
 
diff --git a/board/renesas/koelsch/koelsch.c b/board/renesas/koelsch/koelsch.c
index 841d337f4d3c..871308e405d3 100644
--- a/board/renesas/koelsch/koelsch.c
+++ b/board/renesas/koelsch/koelsch.c
@@ -136,7 +136,8 @@ void reset_cpu(ulong addr)
 		hang();
 }
 
-enum env_location env_get_location(enum env_operation op, int prio)
+enum env_location env_get_location(struct env_context *ctx,
+				   enum env_operation op, int prio)
 {
 	const u32 load_magic = 0xb33fc0de;
 
diff --git a/board/renesas/lager/lager.c b/board/renesas/lager/lager.c
index 3cb1a56142a9..6867ae5c4008 100644
--- a/board/renesas/lager/lager.c
+++ b/board/renesas/lager/lager.c
@@ -145,7 +145,8 @@ void reset_cpu(ulong addr)
 		hang();
 }
 
-enum env_location env_get_location(enum env_operation op, int prio)
+enum env_location env_get_location(struct env_context *ctx,
+				   enum env_operation op, int prio)
 {
 	const u32 load_magic = 0xb33fc0de;
 
diff --git a/board/renesas/porter/porter.c b/board/renesas/porter/porter.c
index 86f79da7fdb4..3dc9310e0fc4 100644
--- a/board/renesas/porter/porter.c
+++ b/board/renesas/porter/porter.c
@@ -134,7 +134,8 @@ void reset_cpu(ulong addr)
 		hang();
 }
 
-enum env_location env_get_location(enum env_operation op, int prio)
+enum env_location env_get_location(struct env_context *ctx,
+				   enum env_operation op, int prio)
 {
 	const u32 load_magic = 0xb33fc0de;
 
diff --git a/board/renesas/sh7752evb/sh7752evb.c b/board/renesas/sh7752evb/sh7752evb.c
index d0b850f35d49..540ec9bfd019 100644
--- a/board/renesas/sh7752evb/sh7752evb.c
+++ b/board/renesas/sh7752evb/sh7752evb.c
@@ -223,10 +223,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)
-			env_set("ethaddr", mac_string);
+			env_set(ctx_uboot, "ethaddr", mac_string);
 		else {
 			sprintf(env_string, "eth%daddr", i);
-			env_set(env_string, mac_string);
+			env_set(ctx_uboot, 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 e1bed7dcc371..3ec2591cb7ed 100644
--- a/board/renesas/sh7753evb/sh7753evb.c
+++ b/board/renesas/sh7753evb/sh7753evb.c
@@ -239,10 +239,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)
-			env_set("ethaddr", mac_string);
+			env_set(ctx_uboot, "ethaddr", mac_string);
 		else {
 			sprintf(env_string, "eth%daddr", i);
-			env_set(env_string, mac_string);
+			env_set(ctx_uboot, 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 d2671202e981..4b06387d5f22 100644
--- a/board/renesas/sh7757lcr/sh7757lcr.c
+++ b/board/renesas/sh7757lcr/sh7757lcr.c
@@ -285,10 +285,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)
-			env_set("ethaddr", mac_string);
+			env_set(ctx_uboot, "ethaddr", mac_string);
 		else {
 			sprintf(env_string, "eth%daddr", i);
-			env_set(env_string, mac_string);
+			env_set(ctx_uboot, env_string, mac_string);
 		}
 
 		set_mac_to_sh_eth_register(i, mac_string);
@@ -298,7 +298,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);
-		env_set(env_string, mac_string);
+		env_set(ctx_uboot, env_string, mac_string);
 
 		set_mac_to_sh_giga_eth_register(i, mac_string);
 	}
diff --git a/board/renesas/silk/silk.c b/board/renesas/silk/silk.c
index 25221e3c55cc..946232e3ba7b 100644
--- a/board/renesas/silk/silk.c
+++ b/board/renesas/silk/silk.c
@@ -129,7 +129,8 @@ void reset_cpu(ulong addr)
 		hang();
 }
 
-enum env_location env_get_location(enum env_operation op, int prio)
+enum env_location env_get_location(struct env_context *ctx,
+				   enum env_operation op, int prio)
 {
 	const u32 load_magic = 0xb33fc0de;
 
diff --git a/board/renesas/stout/stout.c b/board/renesas/stout/stout.c
index 0a0ff5ff76d2..d0b20f3c5902 100644
--- a/board/renesas/stout/stout.c
+++ b/board/renesas/stout/stout.c
@@ -125,7 +125,8 @@ int board_phy_config(struct phy_device *phydev)
 	return 0;
 }
 
-enum env_location env_get_location(enum env_operation op, int prio)
+enum env_location env_get_location(struct env_context *ctx,
+				   enum env_operation op, int prio)
 {
 	const u32 load_magic = 0xb33fc0de;
 
diff --git a/board/rockchip/kylin_rk3036/kylin_rk3036.c b/board/rockchip/kylin_rk3036/kylin_rk3036.c
index 2faeab9baf51..6481f6c11633 100644
--- a/board/rockchip/kylin_rk3036/kylin_rk3036.c
+++ b/board/rockchip/kylin_rk3036/kylin_rk3036.c
@@ -41,7 +41,7 @@ int rk_board_late_init(void)
 {
 	if (fastboot_key_pressed()) {
 		printf("enter fastboot!\n");
-		env_set("preboot", "setenv preboot; fastboot usb0");
+		env_set(ctx_uboot, "preboot", "setenv preboot; fastboot usb0");
 	}
 
 	return 0;
diff --git a/board/samsung/common/exynos5-dt.c b/board/samsung/common/exynos5-dt.c
index 387d1b91809c..1c44effe7224 100644
--- a/board/samsung/common/exynos5-dt.c
+++ b/board/samsung/common/exynos5-dt.c
@@ -154,7 +154,7 @@ char *get_dfu_alt_system(char *interface, char *devstr)
 	if (board_is_odroidxu4() || board_is_odroidhc1() || board_is_odroidhc2())
 		return info;
 
-	return env_get("dfu_alt_system");
+	return env_get(ctx_uboot, "dfu_alt_system");
 }
 
 char *get_dfu_alt_boot(char *interface, char *devstr)
diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index 3ef1e7998013..3086df745fe5 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) {
-		env_set("dfu_alt_boot", alt_setting);
+		env_set(ctx_uboot, "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";
 	}
 
-	env_set("dfu_alt_info", alt_info);
+	env_set(ctx_uboot, "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);
-	env_set("soc_rev", info);
+	env_set(ctx_uboot, "soc_rev", info);
 
 	snprintf(info, ARRAY_SIZE(info), "%x", s5p_cpu_id);
-	env_set("soc_id", info);
+	env_set(ctx_uboot, "soc_id", info);
 
 #ifdef CONFIG_REVISION_TAG
 	snprintf(info, ARRAY_SIZE(info), "%x", get_board_rev());
-	env_set("board_rev", info);
+	env_set(ctx_uboot, "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);
-	env_set("board_name", info);
+	env_set(ctx_uboot, "board_name", info);
 #endif
 	snprintf(info, ARRAY_SIZE(info),  "%s%x-%s%s.dtb",
 		 CONFIG_SYS_SOC, s5p_cpu_id, bdname, bdtype);
-	env_set("fdtfile", info);
+	env_set(ctx_uboot, "fdtfile", info);
 #endif
 }
 #endif /* CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG */
diff --git a/board/samsung/odroid/odroid.c b/board/samsung/odroid/odroid.c
index 9aa97f0f2cad..472dce81f680 100644
--- a/board/samsung/odroid/odroid.c
+++ b/board/samsung/odroid/odroid.c
@@ -74,7 +74,7 @@ const char *get_board_type(void)
 #ifdef CONFIG_SET_DFU_ALT_INFO
 char *get_dfu_alt_system(char *interface, char *devstr)
 {
-	return env_get("dfu_alt_system");
+	return env_get(ctx_uboot, "dfu_alt_system");
 }
 
 char *get_dfu_alt_boot(char *interface, char *devstr)
diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index ec85f707c19a..d4540a2ac932 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -467,7 +467,7 @@ void exynos_lcd_misc_init(vidinfo_t *vid)
 #endif
 #ifdef CONFIG_S6E8AX0
 	s6e8ax0_init();
-	env_set("lcdinfo", "lcd=s6e8ax0");
+	env_set(ctx_uboot, "lcdinfo", "lcd=s6e8ax0");
 #endif
 }
 #endif
diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
index ed9c5b50d927..9fea29e965bd 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;
 
-	env_set("lcdinfo", "lcd=ld9040");
+	env_set(ctx_uboot, "lcdinfo", "lcd=ld9040");
 }
 #endif
diff --git a/board/samtec/vining_fpga/socfpga.c b/board/samtec/vining_fpga/socfpga.c
index 1e095a4e7db0..75ddbcf07fa7 100644
--- a/board/samtec/vining_fpga/socfpga.c
+++ b/board/samtec/vining_fpga/socfpga.c
@@ -62,30 +62,30 @@ int misc_init_r(void)
 	/* Check EEPROM signature. */
 	if (!(data[0] == 0xa5 && data[1] == 0x5a)) {
 		puts("Invalid I2C EEPROM signature.\n");
-		env_set("unit_serial", "invalid");
-		env_set("unit_ident", "VINing-xxxx-STD");
-		env_set("hostname", "vining-invalid");
+		env_set(ctx_uboot, "unit_serial", "invalid");
+		env_set(ctx_uboot, "unit_ident", "VINing-xxxx-STD");
+		env_set(ctx_uboot, "hostname", "vining-invalid");
 		return 0;
 	}
 
 	/* If 'unit_serial' is already set, do nothing. */
-	if (!env_get("unit_serial")) {
+	if (!env_get(ctx_uboot, "unit_serial")) {
 		/* This field is Big Endian ! */
 		serial = (data[0x54] << 24) | (data[0x55] << 16) |
 			 (data[0x56] << 8) | (data[0x57] << 0);
 		memset(str, 0, sizeof(str));
 		sprintf(str, "%07i", serial);
-		env_set("unit_serial", str);
+		env_set(ctx_uboot, "unit_serial", str);
 	}
 
-	if (!env_get("unit_ident")) {
+	if (!env_get(ctx_uboot, "unit_ident")) {
 		memset(str, 0, sizeof(str));
 		memcpy(str, &data[0x2e], 18);
-		env_set("unit_ident", str);
+		env_set(ctx_uboot, "unit_ident", str);
 	}
 
 	/* Set ethernet address from EEPROM. */
-	if (!env_get("ethaddr") && is_valid_ethaddr(&data[0x62]))
+	if (!env_get(ctx_uboot, "ethaddr") && is_valid_ethaddr(&data[0x62]))
 		eth_env_set_enetaddr("ethaddr", &data[0x62]);
 
 	return 0;
diff --git a/board/siemens/common/board.c b/board/siemens/common/board.c
index 676935a84321..63dcf2b83132 100644
--- a/board/siemens/common/board.c
+++ b/board/siemens/common/board.c
@@ -121,7 +121,7 @@ unsigned char get_button_state(char * const envname, unsigned char def)
 	char *ptr_env;
 
 	/* If button is not found we take default */
-	ptr_env = env_get(envname);
+	ptr_env = env_get(ctx_uboot, envname);
 	if (NULL == ptr_env) {
 		gpio = def;
 	} else {
@@ -199,7 +199,7 @@ void set_env_gpios(unsigned char state)
 		strcat(str_tmp, num);
 
 		/* If env var is not found we stop */
-		ptr_env = env_get(str_tmp);
+		ptr_env = env_get(ctx_uboot, str_tmp);
 		if (NULL == ptr_env)
 			break;
 
diff --git a/board/siemens/draco/board.c b/board/siemens/draco/board.c
index a6840b895b27..9cb1b1301855 100644
--- a/board/siemens/draco/board.c
+++ b/board/siemens/draco/board.c
@@ -270,13 +270,13 @@ int board_late_init(void)
 #ifdef CONFIG_FACTORYSET
 	/* Set ASN in environment*/
 	if (factory_dat.asn[0] != 0) {
-		env_set("dtb_name", (char *)factory_dat.asn);
+		env_set(ctx_uboot, "dtb_name", (char *)factory_dat.asn);
 	} else {
 		/* dtb suffix gets added in load script */
-		env_set("dtb_name", "am335x-draco");
+		env_set(ctx_uboot, "dtb_name", "am335x-draco");
 	}
 #else
-	env_set("dtb_name", "am335x-draco");
+	env_set(ctx_uboot, "dtb_name", "am335x-draco");
 #endif
 
 	return 0;
diff --git a/board/siemens/pxm2/board.c b/board/siemens/pxm2/board.c
index 30f0902701ee..e57ab33da88b 100644
--- a/board/siemens/pxm2/board.c
+++ b/board/siemens/pxm2/board.c
@@ -444,12 +444,12 @@ int board_late_init(void)
 			factory_dat.pxm50 = 0;
 		sprintf(tmp, "%s_%s", factory_dat.asn,
 			factory_dat.comp_version);
-		ret = env_set("boardid", tmp);
+		ret = env_set(ctx_uboot, "boardid", tmp);
 		if (ret)
 			printf("error setting board id\n");
 	} else {
 		factory_dat.pxm50 = 1;
-		ret = env_set("boardid", "PXM50_1.0");
+		ret = env_set(ctx_uboot, "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 539ecef22cb4..809cea42f86b 100644
--- a/board/siemens/rut/board.c
+++ b/board/siemens/rut/board.c
@@ -480,7 +480,7 @@ int board_late_init(void)
 	else
 		strcpy(tmp, "QMX7.E38_4.0");
 
-	ret = env_set("boardid", tmp);
+	ret = env_set(ctx_uboot, "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 1cf1f9e1f7ca..980d773a77bb 100644
--- a/board/siemens/taurus/taurus.c
+++ b/board/siemens/taurus/taurus.c
@@ -350,36 +350,36 @@ static int upgrade_failure_fallback(void)
 	char *kern_size;
 	char *kern_size_fb;
 
-	partitionset_active = env_get("partitionset_active");
+	partitionset_active = env_get(ctx_uboot, "partitionset_active");
 	if (partitionset_active) {
 		if (partitionset_active[0] == 'A')
-			env_set("partitionset_active", "B");
+			env_set(ctx_uboot, "partitionset_active", "B");
 		else
-			env_set("partitionset_active", "A");
+			env_set(ctx_uboot, "partitionset_active", "A");
 	} else {
 		printf("partitionset_active missing.\n");
 		return -ENOENT;
 	}
 
-	rootfs = env_get("rootfs");
-	rootfs_fallback = env_get("rootfs_fallback");
-	env_set("rootfs", rootfs_fallback);
-	env_set("rootfs_fallback", rootfs);
+	rootfs = env_get(ctx_uboot, "rootfs");
+	rootfs_fallback = env_get(ctx_uboot, "rootfs_fallback");
+	env_set(ctx_uboot, "rootfs", rootfs_fallback);
+	env_set(ctx_uboot, "rootfs_fallback", rootfs);
 
-	kern_size = env_get("kernel_size");
-	kern_size_fb = env_get("kernel_size_fallback");
-	env_set("kernel_size", kern_size_fb);
-	env_set("kernel_size_fallback", kern_size);
+	kern_size = env_get(ctx_uboot, "kernel_size");
+	kern_size_fb = env_get(ctx_uboot, "kernel_size_fallback");
+	env_set(ctx_uboot, "kernel_size", kern_size_fb);
+	env_set(ctx_uboot, "kernel_size_fallback", kern_size);
 
-	kern_off = env_get("kernel_Off");
-	kern_off_fb = env_get("kernel_Off_fallback");
-	env_set("kernel_Off", kern_off_fb);
-	env_set("kernel_Off_fallback", kern_off);
+	kern_off = env_get(ctx_uboot, "kernel_Off");
+	kern_off_fb = env_get(ctx_uboot, "kernel_Off_fallback");
+	env_set(ctx_uboot, "kernel_Off", kern_off_fb);
+	env_set(ctx_uboot, "kernel_Off_fallback", kern_off);
 
-	env_set("bootargs", '\0');
-	env_set("upgrade_available", '\0');
-	env_set("boot_retries", '\0');
-	env_save();
+	env_set(ctx_uboot, "bootargs", '\0');
+	env_set(ctx_uboot, "upgrade_available", '\0');
+	env_set(ctx_uboot, "boot_retries", '\0');
+	env_save(ctx_uboot);
 
 	return 0;
 }
@@ -391,14 +391,16 @@ static int do_upgrade_available(cmd_tbl_t *cmdtp, int flag, int argc,
 	unsigned long boot_retry = 0;
 	char boot_buf[10];
 
-	upgrade_available = simple_strtoul(env_get("upgrade_available"), NULL,
-					   10);
+	upgrade_available = simple_strtoul(env_get(ctx_uboot,
+						   "upgrade_available"),
+					   NULL, 10);
 	if (upgrade_available) {
-		boot_retry = simple_strtoul(env_get("boot_retries"), NULL, 10);
+		boot_retry = simple_strtoul(env_get(ctx_uboot, "boot_retries"),
+					    NULL, 10);
 		boot_retry++;
 		sprintf(boot_buf, "%lx", boot_retry);
-		env_set("boot_retries", boot_buf);
-		env_save();
+		env_set(ctx_uboot, "boot_retries", boot_buf);
+		env_save(ctx_uboot);
 
 		/*
 		 * Here the boot_retries count is checked, and if the
diff --git a/board/socrates/socrates.c b/board/socrates/socrates.c
index da9ae5bebb7e..277f9e107080 100644
--- a/board/socrates/socrates.c
+++ b/board/socrates/socrates.c
@@ -38,7 +38,7 @@ int checkboard (void)
 	volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
 	char buf[64];
 	int f;
-	int i = env_get_f("serial#", buf, sizeof(buf));
+	int i = env_get_f("serial#", buf, sizeof(ctx_uboot, buf));
 #ifdef CONFIG_PCI
 	char *src;
 #endif
@@ -409,7 +409,7 @@ void board_backlight_switch (int flag)
 		printf ("hwmon IC init failed\n");
 
 	if (flag) {
-		param = env_get("brightness");
+		param = env_get(ctx_uboot, "brightness");
 		rc = param ? simple_strtol(param, NULL, 10) : -1;
 		if (rc < 0)
 			rc = DEFAULT_BRIGHTNESS;
diff --git a/board/softing/vining_2000/vining_2000.c b/board/softing/vining_2000/vining_2000.c
index 51985b91c226..5d4d0f29c44f 100644
--- a/board/softing/vining_2000/vining_2000.c
+++ b/board/softing/vining_2000/vining_2000.c
@@ -102,7 +102,7 @@ int board_eth_init(bd_t *bis)
 
 	/* just to get secound mac address */
 	imx_get_mac_from_fuse(1, eth1addr);
-	if (!env_get("eth1addr") && is_valid_ethaddr(eth1addr))
+	if (!env_get(ctx_uboot, "eth1addr") && is_valid_ethaddr(eth1addr))
 		eth_env_set_enetaddr("eth1addr", eth1addr);
 
 	imx_iomux_v3_setup_multiple_pads(fec1_pads, ARRAY_SIZE(fec1_pads));
@@ -385,11 +385,11 @@ static int set_pin_state(void)
 		return ret;
 
 	if (val >= VAL_UPPER)
-		env_set("pin_state", "connected");
+		env_set(ctx_uboot, "pin_state", "connected");
 	else if (val < VAL_UPPER && val > VAL_LOWER)
-		env_set("pin_state", "open");
+		env_set(ctx_uboot, "pin_state", "open");
 	else
-		env_set("pin_state", "button");
+		env_set(ctx_uboot, "pin_state", "button");
 
 	return ret;
 }
diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c
index f82fb0786a94..52177b918d83 100644
--- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
+++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
@@ -569,29 +569,29 @@ int board_late_init(void)
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 	switch (board_type()) {
 	case CUBOXI:
-		env_set("board_name", "CUBOXI");
+		env_set(ctx_uboot, "board_name", "CUBOXI");
 		break;
 	case HUMMINGBOARD:
-		env_set("board_name", "HUMMINGBOARD");
+		env_set(ctx_uboot, "board_name", "HUMMINGBOARD");
 		break;
 	case HUMMINGBOARD2:
-		env_set("board_name", "HUMMINGBOARD2");
+		env_set(ctx_uboot, "board_name", "HUMMINGBOARD2");
 		break;
 	case UNKNOWN:
 	default:
-		env_set("board_name", "CUBOXI");
+		env_set(ctx_uboot, "board_name", "CUBOXI");
 	}
 
 	if (is_mx6dq())
-		env_set("board_rev", "MX6Q");
+		env_set(ctx_uboot, "board_rev", "MX6Q");
 	else
-		env_set("board_rev", "MX6DL");
+		env_set(ctx_uboot, "board_rev", "MX6DL");
 
 	if (is_rev_15_som())
-		env_set("som_rev", "V15");
+		env_set(ctx_uboot, "som_rev", "V15");
 
 	if (has_emmc())
-		env_set("has_emmc", "yes");
+		env_set(ctx_uboot, "has_emmc", "yes");
 
 #endif
 
diff --git a/board/st/stm32f429-discovery/stm32f429-discovery.c b/board/st/stm32f429-discovery/stm32f429-discovery.c
index 500dc5fe3a6b..3ae0c17d7720 100644
--- a/board/st/stm32f429-discovery/stm32f429-discovery.c
+++ b/board/st/stm32f429-discovery/stm32f429-discovery.c
@@ -65,13 +65,13 @@ int misc_init_r(void)
 	char serialno[25];
 	uint32_t u_id_low, u_id_mid, u_id_high;
 
-	if (!env_get("serial#")) {
+	if (!env_get(ctx_uboot, "serial#")) {
 		u_id_low  = readl(&STM32_U_ID->u_id_low);
 		u_id_mid  = readl(&STM32_U_ID->u_id_mid);
 		u_id_high = readl(&STM32_U_ID->u_id_high);
 		sprintf(serialno, "%08x%08x%08x",
 			u_id_high, u_id_mid, u_id_low);
-		env_set("serial#", serialno);
+		env_set(ctx_uboot, "serial#", serialno);
 	}
 
 	return 0;
diff --git a/board/st/stm32f429-evaluation/stm32f429-evaluation.c b/board/st/stm32f429-evaluation/stm32f429-evaluation.c
index 8ab2fa5d59ab..3a1c578cdad8 100644
--- a/board/st/stm32f429-evaluation/stm32f429-evaluation.c
+++ b/board/st/stm32f429-evaluation/stm32f429-evaluation.c
@@ -59,13 +59,13 @@ int misc_init_r(void)
 	char serialno[25];
 	u32 u_id_low, u_id_mid, u_id_high;
 
-	if (!env_get("serial#")) {
+	if (!env_get(ctx_uboot, "serial#")) {
 		u_id_low  = readl(&STM32_U_ID->u_id_low);
 		u_id_mid  = readl(&STM32_U_ID->u_id_mid);
 		u_id_high = readl(&STM32_U_ID->u_id_high);
 		sprintf(serialno, "%08x%08x%08x",
 			u_id_high, u_id_mid, u_id_low);
-		env_set("serial#", serialno);
+		env_set(ctx_uboot, "serial#", serialno);
 	}
 
 	return 0;
diff --git a/board/st/stm32f469-discovery/stm32f469-discovery.c b/board/st/stm32f469-discovery/stm32f469-discovery.c
index 70d23d90f4ca..e475296919e0 100644
--- a/board/st/stm32f469-discovery/stm32f469-discovery.c
+++ b/board/st/stm32f469-discovery/stm32f469-discovery.c
@@ -59,13 +59,13 @@ int misc_init_r(void)
 	char serialno[25];
 	u32 u_id_low, u_id_mid, u_id_high;
 
-	if (!env_get("serial#")) {
+	if (!env_get(ctx_uboot, "serial#")) {
 		u_id_low  = readl(&STM32_U_ID->u_id_low);
 		u_id_mid  = readl(&STM32_U_ID->u_id_mid);
 		u_id_high = readl(&STM32_U_ID->u_id_high);
 		sprintf(serialno, "%08x%08x%08x",
 			u_id_high, u_id_mid, u_id_low);
-		env_set("serial#", serialno);
+		env_set(ctx_uboot, "serial#", serialno);
 	}
 
 	return 0;
diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index 279c7b779799..188f4a7eae12 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -544,9 +544,9 @@ int board_late_init(void)
 				 &fdt_compat_len);
 	if (fdt_compat && fdt_compat_len) {
 		if (strncmp(fdt_compat, "st,", 3) != 0)
-			env_set("board_name", fdt_compat);
+			env_set(ctx_uboot, "board_name", fdt_compat);
 		else
-			env_set("board_name", fdt_compat + 3);
+			env_set(ctx_uboot, "board_name", fdt_compat + 3);
 	}
 #endif
 
@@ -623,7 +623,8 @@ int board_interface_eth_init(phy_interface_t interface_type,
 	return 0;
 }
 
-enum env_location env_get_location(enum env_operation op, int prio)
+enum env_location env_get_location(struct env_context *ctx,
+				   enum env_operation op, int prio)
 {
 	u32 bootmode = get_bootmode();
 
@@ -688,8 +689,8 @@ const char *env_ext4_get_dev_part(void)
 static const char *env_get_mtdparts(const char *str, char *buf)
 {
 	if (gd->flags & GD_FLG_ENV_READY)
-		return env_get(str);
-	if (env_get_f(str, buf, MTDPARTS_LEN) != -1)
+		return env_get(ctx_uboot, str);
+	if (env_get_f(ctx_uboot, str, buf, MTDPARTS_LEN) != -1)
 		return buf;
 
 	return NULL;
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index e3b2d13892c8..d5f172eb8082 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -194,7 +194,8 @@ void i2c_init_board(void)
 }
 
 #if defined(CONFIG_ENV_IS_IN_MMC) && defined(CONFIG_ENV_IS_IN_FAT)
-enum env_location env_get_location(enum env_operation op, int prio)
+enum env_location env_get_location(struct env_context *ctx,
+				   enum env_operation op, int prio)
 {
 	switch (prio) {
 	case 0:
@@ -725,7 +726,7 @@ void get_board_serial(struct tag_serialnr *serialnr)
 	char *serial_string;
 	unsigned long long serial;
 
-	serial_string = env_get("serial#");
+	serial_string = env_get(ctx_uboot, "serial#");
 
 	if (serial_string) {
 		serial = simple_strtoull(serial_string, NULL, 16);
@@ -764,7 +765,7 @@ static void parse_spl_header(const uint32_t spl_addr)
 		return;
 	}
 	/* otherwise assume .scr format (mkimage-type script) */
-	env_set_hex("fel_scriptaddr", spl->fel_script_address);
+	env_set_hex(ctx_uboot, "fel_scriptaddr", spl->fel_script_address);
 }
 
 /*
@@ -812,7 +813,7 @@ static void setup_environment(const void *fdt)
 			else
 				sprintf(ethaddr, "eth%daddr", i);
 
-			if (env_get(ethaddr))
+			if (env_get(ctx_uboot, ethaddr))
 				continue;
 
 			/* Non OUI / registered MAC address */
@@ -826,11 +827,11 @@ static void setup_environment(const void *fdt)
 			eth_env_set_enetaddr(ethaddr, mac_addr);
 		}
 
-		if (!env_get("serial#")) {
+		if (!env_get(ctx_uboot, "serial#")) {
 			snprintf(serial_string, sizeof(serial_string),
 				"%08x%08x", sid[0], sid[3]);
 
-			env_set("serial#", serial_string);
+			env_set(ctx_uboot, "serial#", serial_string);
 		}
 	}
 }
@@ -839,20 +840,20 @@ int misc_init_r(void)
 {
 	uint boot;
 
-	env_set("fel_booted", NULL);
-	env_set("fel_scriptaddr", NULL);
-	env_set("mmc_bootdev", NULL);
+	env_set(ctx_uboot, "fel_booted", NULL);
+	env_set(ctx_uboot, "fel_scriptaddr", NULL);
+	env_set(ctx_uboot, "mmc_bootdev", NULL);
 
 	boot = sunxi_get_boot_device();
 	/* determine if we are running in FEL mode */
 	if (boot == BOOT_DEVICE_BOARD) {
-		env_set("fel_booted", "1");
+		env_set(ctx_uboot, "fel_booted", "1");
 		parse_spl_header(SPL_ADDR);
 	/* or if we booted from MMC, and which one */
 	} else if (boot == BOOT_DEVICE_MMC1) {
-		env_set("mmc_bootdev", "0");
+		env_set(ctx_uboot, "mmc_bootdev", "0");
 	} else if (boot == BOOT_DEVICE_MMC2) {
-		env_set("mmc_bootdev", "1");
+		env_set(ctx_uboot, "mmc_bootdev", "1");
 	}
 
 	setup_environment(gd->fdt_blob);
diff --git a/board/synopsys/hsdk/env-lib.c b/board/synopsys/hsdk/env-lib.c
index f443c21e6d99..eca2211246b4 100644
--- a/board/synopsys/hsdk/env-lib.c
+++ b/board/synopsys/hsdk/env-lib.c
@@ -21,10 +21,12 @@ static int env_read_common(u32 index, const struct env_map_common *map)
 
 	if (!env_get_yesno(map[index].env_name)) {
 		if (map[index].type == ENV_HEX) {
-			val = (u32)env_get_hex(map[index].env_name, 0);
+			val = (u32)env_get_hex(ctx_uboot, map[index].env_name,
+					       0);
 			debug("ENV: %s: = %#x\n", map[index].env_name, val);
 		} else {
-			val = (u32)env_get_ulong(map[index].env_name, 10, 0);
+			val = (u32)env_get_ulong(ctx_uboot,
+						 map[index].env_name, 10, 0);
 			debug("ENV: %s: = %d\n", map[index].env_name, val);
 		}
 
@@ -52,10 +54,11 @@ static int env_read_core(u32 index, const struct env_map_percpu *map)
 		sprintf(command, "%s_%u", map[index].env_name, i);
 		if (!env_get_yesno(command)) {
 			if (map[index].type == ENV_HEX) {
-				val = (u32)env_get_hex(command, 0);
+				val = (u32)env_get_hex(ctx_uboot, command, 0);
 				debug("ENV: %s: = %#x\n", command, val);
 			} else {
-				val = (u32)env_get_ulong(command, 10, 0);
+				val = (u32)env_get_ulong(ctx_uboot, command,
+							 10, 0);
 				debug("ENV: %s: = %d\n", command, val);
 			}
 
diff --git a/board/synopsys/hsdk/hsdk.c b/board/synopsys/hsdk/hsdk.c
index 8a7642a0aaaa..ab97b97bcde3 100644
--- a/board/synopsys/hsdk/hsdk.c
+++ b/board/synopsys/hsdk/hsdk.c
@@ -854,19 +854,19 @@ static int do_hsdk_clock_get(cmd_tbl_t *cmdtp, int flag, int argc,
 	if (soc_clk_ctl("cpu-clk", &rate, CLK_GET | CLK_MHZ))
 		return CMD_RET_FAILURE;
 
-	if (env_set_ulong("cpu_freq", rate))
+	if (env_set_ulong(ctx_uboot, "cpu_freq", rate))
 		return CMD_RET_FAILURE;
 
 	if (soc_clk_ctl("tun-clk", &rate, CLK_GET | CLK_MHZ))
 		return CMD_RET_FAILURE;
 
-	if (env_set_ulong("tun_freq", rate))
+	if (env_set_ulong(ctx_uboot, "tun_freq", rate))
 		return CMD_RET_FAILURE;
 
 	if (soc_clk_ctl("axi-clk", &rate, CLK_GET | CLK_MHZ))
 		return CMD_RET_FAILURE;
 
-	if (env_set_ulong("axi_freq", rate))
+	if (env_set_ulong(ctx_uboot, "axi_freq", rate))
 		return CMD_RET_FAILURE;
 
 	printf("Clock values are saved to environment\n");
diff --git a/board/syteco/zmx25/zmx25.c b/board/syteco/zmx25/zmx25.c
index d2318457b431..c49ac35c2933 100644
--- a/board/syteco/zmx25/zmx25.c
+++ b/board/syteco/zmx25/zmx25.c
@@ -145,7 +145,7 @@ int board_late_init(void)
 	udelay(5000);
 #endif
 
-	e = env_get("gs_base_board");
+	e = env_get(ctx_uboot, "gs_base_board");
 	if (e != NULL) {
 		if (strcmp(e, "G283") == 0) {
 			int key = gpio_get_value(IMX_GPIO_NR(2, 29));
@@ -155,9 +155,11 @@ int board_late_init(void)
 				gpio_set_value(IMX_GPIO_NR(1, 29), 0);
 				gpio_set_value(IMX_GPIO_NR(4, 21), 0);
 
-				env_set("preboot", "run gs_slow_boot");
+				env_set(ctx_uboot, "preboot",
+					"run gs_slow_boot");
 			} else
-				env_set("preboot", "run gs_fast_boot");
+				env_set(ctx_uboot, "preboot",
+					"run gs_fast_boot");
 		}
 	}
 
diff --git a/board/tcl/sl50/board.c b/board/tcl/sl50/board.c
index c7eed319461a..79598cd36a5e 100644
--- a/board/tcl/sl50/board.c
+++ b/board/tcl/sl50/board.c
@@ -75,7 +75,7 @@ int spl_start_uboot(void)
 
 #ifdef CONFIG_SPL_ENV_SUPPORT
 	env_init();
-	env_load();
+	env_load(ctx_uboot);
 	if (env_get_yesno("boot_os") != 1)
 		return 1;
 #endif
@@ -321,7 +321,7 @@ int board_eth_init(bd_t *bis)
 
 #if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \
 	(defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))
-	if (!env_get("ethaddr")) {
+	if (!env_get(ctx_uboot, "ethaddr")) {
 		printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
 		if (is_valid_ethaddr(mac_addr))
@@ -339,7 +339,7 @@ int board_eth_init(bd_t *bis)
 	mac_addr[4] = mac_lo & 0xFF;
 	mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
-	if (!env_get("eth1addr")) {
+	if (!env_get(ctx_uboot, "eth1addr")) {
 		if (is_valid_ethaddr(mac_addr))
 			eth_env_set_enetaddr("eth1addr", mac_addr);
 	}
diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
index 47259b714961..d0150a127dd6 100644
--- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c
+++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
@@ -58,8 +58,8 @@ static int setup_boottargets(void)
 	}
 	debug("%s: booted from %s\n", __func__, boot_device);
 
-	env_default = env_get_default("boot_targets");
-	env = env_get("boot_targets");
+	env_default = env_get_default(ctx_uboot, "boot_targets");
+	env = env_get(ctx_uboot, "boot_targets");
 	if (!env) {
 		debug("%s: boot_targets does not exist\n", __func__);
 		return -1;
@@ -102,7 +102,7 @@ static int setup_boottargets(void)
 			mmc0[3] = '1';
 			mmc1[3] = '0';
 			debug("%s: set boot_targets to: %s\n", __func__, env);
-			env_set("boot_targets", env);
+			env_set(ctx_uboot, "boot_targets", env);
 		}
 	}
 
@@ -140,7 +140,7 @@ void get_board_serial(struct tag_serialnr *serialnr)
 	char *serial_string;
 	u64 serial = 0;
 
-	serial_string = env_get("serial#");
+	serial_string = env_get(ctx_uboot, "serial#");
 
 	if (serial_string)
 		serial = simple_strtoull(serial_string, NULL, 16);
diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
index 7eaa6cd96d60..b1f432332d8c 100644
--- a/board/ti/am335x/board.c
+++ b/board/ti/am335x/board.c
@@ -251,7 +251,7 @@ int spl_start_uboot(void)
 
 #ifdef CONFIG_SPL_ENV_SUPPORT
 	env_init();
-	env_load();
+	env_load(ctx_uboot);
 	if (env_get_yesno("boot_os") != 1)
 		return 1;
 #endif
@@ -825,7 +825,7 @@ int board_late_init(void)
 	 * on HS devices.
 	 */
 	if (get_device_type() == HS_DEVICE)
-		env_set("boot_fit", "1");
+		env_set(ctx_uboot, "boot_fit", "1");
 #endif
 
 #if !defined(CONFIG_SPL_BUILD)
@@ -839,7 +839,7 @@ int board_late_init(void)
 	mac_addr[4] = mac_lo & 0xFF;
 	mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
-	if (!env_get("ethaddr")) {
+	if (!env_get(ctx_uboot, "ethaddr")) {
 		printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
 		if (is_valid_ethaddr(mac_addr))
@@ -855,20 +855,20 @@ int board_late_init(void)
 	mac_addr[4] = mac_lo & 0xFF;
 	mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
-	if (!env_get("eth1addr")) {
+	if (!env_get(ctx_uboot, "eth1addr")) {
 		if (is_valid_ethaddr(mac_addr))
 			eth_env_set_enetaddr("eth1addr", mac_addr);
 	}
 #endif
 
-	if (!env_get("serial#")) {
-		char *board_serial = env_get("board_serial");
-		char *ethaddr = env_get("ethaddr");
+	if (!env_get(ctx_uboot, "serial#")) {
+		char *board_serial = env_get(ctx_uboot, "board_serial");
+		char *ethaddr = env_get(ctx_uboot, "ethaddr");
 
 		if (!board_serial || !strncmp(board_serial, "unknown", 7))
-			env_set("serial#", ethaddr);
+			env_set(ctx_uboot, "serial#", ethaddr);
 		else
-			env_set("serial#", board_serial);
+			env_set(ctx_uboot, "serial#", board_serial);
 	}
 
 	return 0;
diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c
index 2e09cc20e8c2..7eb71cd4d8d1 100644
--- a/board/ti/am43xx/board.c
+++ b/board/ti/am43xx/board.c
@@ -728,7 +728,7 @@ int board_late_init(void)
 	 * on HS devices.
 	 */
 	if (get_device_type() == HS_DEVICE)
-		env_set("boot_fit", "1");
+		env_set(ctx_uboot, "boot_fit", "1");
 #endif
 
 #if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL)
@@ -902,7 +902,7 @@ int board_eth_init(bd_t *bis)
 	mac_addr[4] = mac_lo & 0xFF;
 	mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
-	if (!env_get("ethaddr")) {
+	if (!env_get(ctx_uboot, "ethaddr")) {
 		puts("<ethaddr> not set. Validating first E-fuse MAC\n");
 		if (is_valid_ethaddr(mac_addr))
 			eth_env_set_enetaddr("ethaddr", mac_addr);
@@ -917,7 +917,7 @@ int board_eth_init(bd_t *bis)
 	mac_addr[4] = mac_lo & 0xFF;
 	mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
-	if (!env_get("eth1addr")) {
+	if (!env_get(ctx_uboot, "eth1addr")) {
 		if (is_valid_ethaddr(mac_addr))
 			eth_env_set_enetaddr("eth1addr", mac_addr);
 	}
diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c
index f78e6c2e1f6e..222049d541de 100644
--- a/board/ti/am57xx/board.c
+++ b/board/ti/am57xx/board.c
@@ -668,7 +668,7 @@ void am57x_idk_lcd_detect(void)
 		/* we will let default be "no lcd" */
 	}
 out:
-	env_set("idk_lcd", idk_lcd);
+	env_set(ctx_uboot, "idk_lcd", idk_lcd);
 	return;
 }
 
@@ -701,7 +701,7 @@ int board_late_init(void)
 	 * on HS devices.
 	 */
 	if (get_device_type() == HS_DEVICE)
-		env_set("boot_fit", "1");
+		env_set(ctx_uboot, "boot_fit", "1");
 
 	/*
 	 * Set the GPIO7 Pad to POWERHOLD. This has higher priority
@@ -871,7 +871,7 @@ int spl_start_uboot(void)
 
 #ifdef CONFIG_SPL_ENV_SUPPORT
 	env_init();
-	env_load();
+	env_load(ctx_uboot);
 	if (env_get_yesno("boot_os") != 1)
 		return 1;
 #endif
@@ -975,7 +975,7 @@ int board_eth_init(bd_t *bis)
 	mac_addr[4] = (mac_lo & 0xFF00) >> 8;
 	mac_addr[5] = mac_lo & 0xFF;
 
-	if (!env_get("ethaddr")) {
+	if (!env_get(ctx_uboot, "ethaddr")) {
 		printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
 		if (is_valid_ethaddr(mac_addr))
@@ -991,7 +991,7 @@ int board_eth_init(bd_t *bis)
 	mac_addr[4] = (mac_lo & 0xFF00) >> 8;
 	mac_addr[5] = mac_lo & 0xFF;
 
-	if (!env_get("eth1addr")) {
+	if (!env_get(ctx_uboot, "eth1addr")) {
 		if (is_valid_ethaddr(mac_addr))
 			eth_env_set_enetaddr("eth1addr", mac_addr);
 	}
@@ -1100,8 +1100,8 @@ int board_fit_config_name_match(const char *name)
 int fastboot_set_reboot_flag(void)
 {
 	printf("Setting reboot to fastboot flag ...\n");
-	env_set("dofastboot", "1");
-	env_save();
+	env_set(ctx_uboot, "dofastboot", "1");
+	env_save(ctx_uboot);
 	return 0;
 }
 #endif
diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c
index 0138fc91fcbe..7ee36aff7c45 100644
--- a/board/ti/beagle/beagle.c
+++ b/board/ti/beagle/beagle.c
@@ -340,16 +340,16 @@ int misc_init_r(void)
 	switch (get_board_revision()) {
 	case REVISION_AXBX:
 		printf("Beagle Rev Ax/Bx\n");
-		env_set("beaglerev", "AxBx");
+		env_set(ctx_uboot, "beaglerev", "AxBx");
 		break;
 	case REVISION_CX:
 		printf("Beagle Rev C1/C2/C3\n");
-		env_set("beaglerev", "Cx");
+		env_set(ctx_uboot, "beaglerev", "Cx");
 		MUX_BEAGLE_C();
 		break;
 	case REVISION_C4:
 		printf("Beagle Rev C4\n");
-		env_set("beaglerev", "C4");
+		env_set(ctx_uboot, "beaglerev", "C4");
 		MUX_BEAGLE_C();
 		/* Set VAUX2 to 1.8V for EHCI PHY */
 		twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
@@ -359,7 +359,7 @@ int misc_init_r(void)
 		break;
 	case REVISION_XM_AB:
 		printf("Beagle xM Rev A/B\n");
-		env_set("beaglerev", "xMAB");
+		env_set(ctx_uboot, "beaglerev", "xMAB");
 		MUX_BEAGLE_XM();
 		/* Set VAUX2 to 1.8V for EHCI PHY */
 		twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
@@ -370,7 +370,7 @@ int misc_init_r(void)
 		break;
 	case REVISION_XM_C:
 		printf("Beagle xM Rev C\n");
-		env_set("beaglerev", "xMC");
+		env_set(ctx_uboot, "beaglerev", "xMC");
 		MUX_BEAGLE_XM();
 		/* Set VAUX2 to 1.8V for EHCI PHY */
 		twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
@@ -396,14 +396,14 @@ int misc_init_r(void)
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		MUX_TINCANTOOLS_ZIPPY();
-		env_set("buddy", "zippy");
+		env_set(ctx_uboot, "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();
-		env_set("buddy", "zippy2");
+		env_set(ctx_uboot, "buddy", "zippy2");
 		break;
 	case TINCANTOOLS_TRAINER:
 		printf("Recognized Tincantools Trainer board (rev %d %s)\n",
@@ -411,37 +411,37 @@ int misc_init_r(void)
 			expansion_config.fab_revision);
 		MUX_TINCANTOOLS_ZIPPY();
 		MUX_TINCANTOOLS_TRAINER();
-		env_set("buddy", "trainer");
+		env_set(ctx_uboot, "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 */
-		env_set("defaultdisplay", "showdoglcd");
-		env_set("buddy", "showdog");
+		env_set(ctx_uboot, "defaultdisplay", "showdoglcd");
+		env_set(ctx_uboot, "buddy", "showdog");
 		break;
 	case KBADC_BEAGLEFPGA:
 		printf("Recognized KBADC Beagle FPGA board\n");
 		MUX_KBADC_BEAGLEFPGA();
-		env_set("buddy", "beaglefpga");
+		env_set(ctx_uboot, "buddy", "beaglefpga");
 		break;
 	case LW_BEAGLETOUCH:
 		printf("Recognized Liquidware BeagleTouch board\n");
-		env_set("buddy", "beagletouch");
+		env_set(ctx_uboot, "buddy", "beagletouch");
 		break;
 	case BRAINMUX_LCDOG:
 		printf("Recognized Brainmux LCDog board\n");
-		env_set("buddy", "lcdog");
+		env_set(ctx_uboot, "buddy", "lcdog");
 		break;
 	case BRAINMUX_LCDOGTOUCH:
 		printf("Recognized Brainmux LCDog Touch board\n");
-		env_set("buddy", "lcdogtouch");
+		env_set(ctx_uboot, "buddy", "lcdogtouch");
 		break;
 	case BBTOYS_WIFI:
 		printf("Recognized BeagleBoardToys WiFi board\n");
 		MUX_BBTOYS_WIFI()
-		env_set("buddy", "bbtoys-wifi");
+		env_set(ctx_uboot, "buddy", "bbtoys-wifi");
 		break;
 	case BBTOYS_VGA:
 		printf("Recognized BeagleBoardToys VGA board\n");
@@ -458,20 +458,21 @@ int misc_init_r(void)
 	case LSR_COM6L_ADPT:
 		printf("Recognized LSR COM6L Adapter Board\n");
 		MUX_BBTOYS_WIFI()
-		env_set("buddy", "lsr-com6l-adpt");
+		env_set(ctx_uboot, "buddy", "lsr-com6l-adpt");
 		break;
 	case BEAGLE_NO_EEPROM:
 		printf("No EEPROM on expansion board\n");
-		env_set("buddy", "none");
+		env_set(ctx_uboot, "buddy", "none");
 		break;
 	default:
 		printf("Unrecognized expansion board: %x\n",
 			expansion_config.device_vendor);
-		env_set("buddy", "unknown");
+		env_set(ctx_uboot, "buddy", "unknown");
 	}
 
 	if (expansion_config.content == 1)
-		env_set(expansion_config.env_var, expansion_config.env_setting);
+		env_set(ctx_uboot, expansion_config.env_var,
+			expansion_config.env_setting);
 
 	twl4030_power_init();
 	switch (get_board_revision()) {
@@ -511,10 +512,10 @@ int misc_init_r(void)
 
 #if defined(CONFIG_MTDIDS_DEFAULT) && defined(CONFIG_MTDPARTS_DEFAULT)
 	if (strlen(CONFIG_MTDIDS_DEFAULT))
-		env_set("mtdids", CONFIG_MTDIDS_DEFAULT);
+		env_set(ctx_uboot, "mtdids", CONFIG_MTDIDS_DEFAULT);
 
 	if (strlen(CONFIG_MTDPARTS_DEFAULT))
-		env_set("mtdparts", CONFIG_MTDPARTS_DEFAULT);
+		env_set(ctx_uboot, "mtdparts", CONFIG_MTDPARTS_DEFAULT);
 #endif
 
 	return 0;
diff --git a/board/ti/common/board_detect.c b/board/ti/common/board_detect.c
index bc89cc57bd78..fe776f2428d2 100644
--- a/board/ti/common/board_detect.c
+++ b/board/ti/common/board_detect.c
@@ -580,21 +580,21 @@ void __maybe_unused set_board_info_env(char *name)
 	struct ti_common_eeprom *ep = TI_EEPROM_DATA;
 
 	if (name)
-		env_set("board_name", name);
+		env_set(ctx_uboot, "board_name", name);
 	else if (ep->name)
-		env_set("board_name", ep->name);
+		env_set(ctx_uboot, "board_name", ep->name);
 	else
-		env_set("board_name", unknown);
+		env_set(ctx_uboot, "board_name", unknown);
 
 	if (ep->version)
-		env_set("board_rev", ep->version);
+		env_set(ctx_uboot, "board_rev", ep->version);
 	else
-		env_set("board_rev", unknown);
+		env_set(ctx_uboot, "board_rev", unknown);
 
 	if (ep->serial)
-		env_set("board_serial", ep->serial);
+		env_set(ctx_uboot, "board_serial", ep->serial);
 	else
-		env_set("board_serial", unknown);
+		env_set(ctx_uboot, "board_serial", unknown);
 }
 
 void __maybe_unused set_board_info_env_am6(char *name)
diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
index 74d04bb1e393..63ac5b1988bf 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -691,7 +691,7 @@ int board_late_init(void)
 	 * on HS devices.
 	 */
 	if (get_device_type() == HS_DEVICE)
-		env_set("boot_fit", "1");
+		env_set(ctx_uboot, "boot_fit", "1");
 
 	omap_die_id_serial();
 	omap_set_fastboot_vars();
@@ -980,7 +980,7 @@ int spl_start_uboot(void)
 
 #ifdef CONFIG_SPL_ENV_SUPPORT
 	env_init();
-	env_load();
+	env_load(ctx_uboot);
 	if (env_get_yesno("boot_os") != 1)
 		return 1;
 #endif
@@ -1048,7 +1048,7 @@ int board_eth_init(bd_t *bis)
 	mac_addr[4] = (mac_lo & 0xFF00) >> 8;
 	mac_addr[5] = mac_lo & 0xFF;
 
-	if (!env_get("ethaddr")) {
+	if (!env_get(ctx_uboot, "ethaddr")) {
 		printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
 		if (is_valid_ethaddr(mac_addr))
@@ -1064,7 +1064,7 @@ int board_eth_init(bd_t *bis)
 	mac_addr[4] = (mac_lo & 0xFF00) >> 8;
 	mac_addr[5] = mac_lo & 0xFF;
 
-	if (!env_get("eth1addr")) {
+	if (!env_get(ctx_uboot, "eth1addr")) {
 		if (is_valid_ethaddr(mac_addr))
 			eth_env_set_enetaddr("eth1addr", mac_addr);
 	}
@@ -1152,8 +1152,8 @@ int board_fit_config_name_match(const char *name)
 int fastboot_set_reboot_flag(void)
 {
 	printf("Setting reboot to fastboot flag ...\n");
-	env_set("dofastboot", "1");
-	env_save();
+	env_set(ctx_uboot, "dofastboot", "1");
+	env_save(ctx_uboot);
 	return 0;
 }
 #endif
diff --git a/board/ti/evm/evm.c b/board/ti/evm/evm.c
index d0b9bafbd1b6..4053eb7448a6 100644
--- a/board/ti/evm/evm.c
+++ b/board/ti/evm/evm.c
@@ -283,7 +283,7 @@ static void reset_net_chip(void)
 int board_eth_init(bd_t *bis)
 {
 #if defined(CONFIG_SMC911X)
-	env_set("ethaddr", NULL);
+	env_set(ctx_uboot, "ethaddr", NULL);
 	return smc911x_initialize(0, CONFIG_SMC911X_BASE);
 #else
 	return 0;
diff --git a/board/ti/ks2_evm/board.c b/board/ti/ks2_evm/board.c
index e9bc68049b4b..aa447fd886cc 100644
--- a/board/ti/ks2_evm/board.c
+++ b/board/ti/ks2_evm/board.c
@@ -113,7 +113,7 @@ int ft_board_setup(void *blob, bd_t *bd)
 	u64 start[2];
 	u32 ddr3a_size;
 
-	env = env_get("mem_lpae");
+	env = env_get(ctx_uboot, "mem_lpae");
 	lpae = env && simple_strtol(env, NULL, 0);
 
 	ddr3a_size = 0;
@@ -140,13 +140,13 @@ int ft_board_setup(void *blob, bd_t *bd)
 	}
 
 	/* reserve memory at start of bank */
-	env = env_get("mem_reserve_head");
+	env = env_get(ctx_uboot, "mem_reserve_head");
 	if (env) {
 		start[0] += ustrtoul(env, &endp, 0);
 		size[0] -= ustrtoul(env, &endp, 0);
 	}
 
-	env = env_get("mem_reserve");
+	env = env_get(ctx_uboot, "mem_reserve");
 	if (env)
 		size[0] -= ustrtoul(env, &endp, 0);
 
@@ -163,9 +163,9 @@ void ft_board_setup_ex(void *blob, bd_t *bd)
 	u64 *reserve_start;
 	int unitrd_fixup = 0;
 
-	env = env_get("mem_lpae");
+	env = env_get(ctx_uboot, "mem_lpae");
 	lpae = env && simple_strtol(env, NULL, 0);
-	env = env_get("uinitrd_fixup");
+	env = env_get(ctx_uboot, "uinitrd_fixup");
 	unitrd_fixup = env && simple_strtol(env, NULL, 0);
 
 	/* Fix up the initrd */
diff --git a/board/ti/ks2_evm/board_k2g.c b/board/ti/ks2_evm/board_k2g.c
index 4ff9a44b3712..49c09b88bd83 100644
--- a/board/ti/ks2_evm/board_k2g.c
+++ b/board/ti/ks2_evm/board_k2g.c
@@ -353,11 +353,11 @@ int board_late_init(void)
 
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 	if (board_is_k2g_gp())
-		env_set("board_name", "66AK2GGP\0");
+		env_set(ctx_uboot, "board_name", "66AK2GGP\0");
 	else if (board_is_k2g_g1())
-		env_set("board_name", "66AK2GG1\0");
+		env_set(ctx_uboot, "board_name", "66AK2GG1\0");
 	else if (board_is_k2g_ice())
-		env_set("board_name", "66AK2GIC\0");
+		env_set(ctx_uboot, "board_name", "66AK2GIC\0");
 #endif
 	return 0;
 }
@@ -384,7 +384,7 @@ void spl_init_keystone_plls(void)
 #ifdef CONFIG_TI_SECURE_DEVICE
 void board_pmmc_image_process(ulong pmmc_image, size_t pmmc_size)
 {
-	int id = env_get_ulong("dev_pmmc", 10, 0);
+	int id = env_get_ulong(ctx_uboot, "dev_pmmc", 10, 0);
 	int ret;
 
 	if (!rproc_is_initialized())
diff --git a/board/ti/panda/panda.c b/board/ti/panda/panda.c
index 20199da390ec..9d42123de9cc 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
-		env_set("board_name", "panda-es");
+		env_set(ctx_uboot, "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))
-			env_set("board_name", "panda-a4");
+			env_set(ctx_uboot, "board_name", "panda-a4");
 #endif
 	}
 
diff --git a/board/toradex/apalis-imx8/apalis-imx8.c b/board/toradex/apalis-imx8/apalis-imx8.c
index af48b560952e..7e0f01534a9e 100644
--- a/board/toradex/apalis-imx8/apalis-imx8.c
+++ b/board/toradex/apalis-imx8/apalis-imx8.c
@@ -117,8 +117,8 @@ int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 /* TODO move to common */
-	env_set("board_name", "Apalis iMX8QM");
-	env_set("board_rev", "v1.0");
+	env_set(ctx_uboot, "board_name", "Apalis iMX8QM");
+	env_set(ctx_uboot, "board_rev", "v1.0");
 #endif
 
 	return 0;
diff --git a/board/toradex/apalis_imx6/apalis_imx6.c b/board/toradex/apalis_imx6/apalis_imx6.c
index 6421a22c25a7..c40ccedc4c9d 100644
--- a/board/toradex/apalis_imx6/apalis_imx6.c
+++ b/board/toradex/apalis_imx6/apalis_imx6.c
@@ -701,7 +701,7 @@ int board_late_init(void)
 
 	rev = get_board_rev();
 	snprintf(env_str, ARRAY_SIZE(env_str), "%.4x", rev);
-	env_set("board_rev", env_str);
+	env_set(ctx_uboot, "board_rev", env_str);
 
 #ifndef CONFIG_TDX_APALIS_IMX6_V1_0
 	if ((rev & 0xfff0) == 0x0100) {
@@ -711,12 +711,12 @@ int board_late_init(void)
 		setup_iomux_dce_uart();
 
 		/* if using the default device tree, use version for V1.0 HW */
-		fdt_env = env_get("fdt_file");
+		fdt_env = env_get(ctx_uboot, "fdt_file");
 		if ((fdt_env != NULL) && (strcmp(FDT_FILE, fdt_env) == 0)) {
-			env_set("fdt_file", FDT_FILE_V1_0);
+			env_set(ctx_uboot, "fdt_file", FDT_FILE_V1_0);
 			printf("patching fdt_file to " FDT_FILE_V1_0 "\n");
 #ifndef CONFIG_ENV_IS_NOWHERE
-			env_save();
+			env_save(ctx_uboot);
 #endif
 		}
 	}
@@ -726,8 +726,8 @@ int board_late_init(void)
 #ifdef CONFIG_CMD_USB_SDP
 	if (is_boot_from_usb()) {
 		printf("Serial Downloader recovery mode, using sdp command\n");
-		env_set("bootdelay", "0");
-		env_set("bootcmd", "sdp 0");
+		env_set(ctx_uboot, "bootdelay", "0");
+		env_set(ctx_uboot, "bootcmd", "sdp 0");
 	}
 #endif /* CONFIG_CMD_USB_SDP */
 
diff --git a/board/toradex/colibri-imx6ull/colibri-imx6ull.c b/board/toradex/colibri-imx6ull/colibri-imx6ull.c
index d1ae463941ae..160b79ba0b27 100644
--- a/board/toradex/colibri-imx6ull/colibri-imx6ull.c
+++ b/board/toradex/colibri-imx6ull/colibri-imx6ull.c
@@ -178,7 +178,7 @@ int board_late_init(void)
 	 */
 	if (tdx_hw_tag.prodid == COLIBRI_IMX6ULL_WIFI_BT_IT ||
 	    tdx_hw_tag.prodid == COLIBRI_IMX6ULL_WIFI_BT)
-		env_set("variant", "-wifi");
+		env_set(ctx_uboot, "variant", "-wifi");
 #endif
 
 	/*
@@ -196,8 +196,8 @@ int board_late_init(void)
 #ifdef CONFIG_CMD_USB_SDP
 	if (is_boot_from_usb()) {
 		printf("Serial Downloader recovery mode, using sdp command\n");
-		env_set("bootdelay", "0");
-		env_set("bootcmd", "sdp 0");
+		env_set(ctx_uboot, "bootdelay", "0");
+		env_set(ctx_uboot, "bootcmd", "sdp 0");
 	}
 #endif /* CONFIG_CMD_USB_SDP */
 
diff --git a/board/toradex/colibri-imx8x/colibri-imx8x.c b/board/toradex/colibri-imx8x/colibri-imx8x.c
index eae3c591a164..ef52f95dc93e 100644
--- a/board/toradex/colibri-imx8x/colibri-imx8x.c
+++ b/board/toradex/colibri-imx8x/colibri-imx8x.c
@@ -129,8 +129,8 @@ int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 /* TODO move to common */
-	env_set("board_name", "Colibri iMX8QXP");
-	env_set("board_rev", "v1.0");
+	env_set(ctx_uboot, "board_name", "Colibri iMX8QXP");
+	env_set(ctx_uboot, "board_rev", "v1.0");
 #endif
 
 	return 0;
diff --git a/board/toradex/colibri_imx6/colibri_imx6.c b/board/toradex/colibri_imx6/colibri_imx6.c
index ad40b589c1ed..1c1c1577eb1f 100644
--- a/board/toradex/colibri_imx6/colibri_imx6.c
+++ b/board/toradex/colibri_imx6/colibri_imx6.c
@@ -661,14 +661,14 @@ int board_late_init(void)
 
 	rev = get_board_rev();
 	snprintf(env_str, ARRAY_SIZE(env_str), "%.4x", rev);
-	env_set("board_rev", env_str);
+	env_set(ctx_uboot, "board_rev", env_str);
 #endif
 
 #ifdef CONFIG_CMD_USB_SDP
 	if (is_boot_from_usb()) {
 		printf("Serial Downloader recovery mode, using sdp command\n");
-		env_set("bootdelay", "0");
-		env_set("bootcmd", "sdp 0");
+		env_set(ctx_uboot, "bootdelay", "0");
+		env_set(ctx_uboot, "bootcmd", "sdp 0");
 	}
 #endif /* CONFIG_CMD_USB_SDP */
 
@@ -702,7 +702,7 @@ int ft_board_setup(void *blob, bd_t *bd)
 
 	ft_common_board_setup(blob, bd);
 
-	cma_size = env_get_ulong("cma-size", 10, 320 * 1024 * 1024);
+	cma_size = env_get_ulong(ctx_uboot, "cma-size", 10, 320 * 1024 * 1024);
 	cma_size = min((u32)(gd->ram_size >> 1), cma_size);
 
 	fdt_setprop_u32(blob,
diff --git a/board/toradex/colibri_vf/colibri_vf.c b/board/toradex/colibri_vf/colibri_vf.c
index 04d8ffd1e666..e466d8aad6e1 100644
--- a/board/toradex/colibri_vf/colibri_vf.c
+++ b/board/toradex/colibri_vf/colibri_vf.c
@@ -392,7 +392,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");
-		env_set("bootdelay", "-1");
+		env_set(ctx_uboot, "bootdelay", "-1");
 	}
 
 	return 0;
diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c
index 9c86230595b9..6897ced0f7fe 100644
--- a/board/toradex/common/tdx-cfg-block.c
+++ b/board/toradex/common/tdx-cfg-block.c
@@ -314,7 +314,7 @@ static int get_cfgblock_interactive(void)
 	wb = console_buffer[0];
 #endif
 
-	soc = env_get("soc");
+	soc = env_get(ctx_uboot, "soc");
 	if (!strcmp("mx6", soc)) {
 #ifdef CONFIG_TARGET_APALIS_IMX6
 		if (it == 'y' || it == 'Y') {
diff --git a/board/toradex/common/tdx-common.c b/board/toradex/common/tdx-common.c
index e9441a7979d2..a51749dd78c2 100644
--- a/board/toradex/common/tdx-common.c
+++ b/board/toradex/common/tdx-common.c
@@ -81,7 +81,7 @@ int show_board_info(void)
 			tdx_hw_tag.ver_minor,
 			(char)tdx_hw_tag.ver_assembly + 'A');
 
-		env_set("serial#", tdx_serial_str);
+		env_set(ctx_uboot, "serial#", tdx_serial_str);
 
 		printf("Model: Toradex %s %s, Serial# %s\n",
 		       toradex_modules[tdx_hw_tag.prodid],
diff --git a/board/tqc/tqma6/tqma6.c b/board/tqc/tqma6/tqma6.c
index 5b20afd48814..f13126c2ee59 100644
--- a/board/tqc/tqma6/tqma6.c
+++ b/board/tqc/tqma6/tqma6.c
@@ -253,7 +253,7 @@ int power_init_board(void)
 
 int board_late_init(void)
 {
-	env_set("board_name", tqma6_get_boardname());
+	env_set(ctx_uboot, "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 5c468a6a973e..2a61dc29ef92 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
-	env_set("board_name", board_string());
+	env_set(ctx_uboot, "board_name", board_string());
 #endif
 
 	return 0;
diff --git a/board/udoo/udoo.c b/board/udoo/udoo.c
index f2c2bf47b0fd..88bc24b2b475 100644
--- a/board/udoo/udoo.c
+++ b/board/udoo/udoo.c
@@ -254,9 +254,9 @@ int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 	if (is_cpu_type(MXC_CPU_MX6Q))
-		env_set("board_rev", "MX6Q");
+		env_set(ctx_uboot, "board_rev", "MX6Q");
 	else
-		env_set("board_rev", "MX6DL");
+		env_set(ctx_uboot, "board_rev", "MX6DL");
 #endif
 	return 0;
 }
diff --git a/board/varisys/common/sys_eeprom.c b/board/varisys/common/sys_eeprom.c
index 77772a6923e4..5b248f8b0f44 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);
-		env_set(envvar, ethaddr);
+		env_set(ctx_uboot, envvar, ethaddr);
 	}
 
 	return ret;
@@ -486,8 +486,8 @@ int mac_read_from_eeprom_common(void)
 			/* Only initialize environment variables that are blank
 			 * (i.e. have not yet been set)
 			 */
-			if (!env_get(enetvar))
-				env_set(enetvar, ethaddr);
+			if (!env_get(ctx_uboot, enetvar))
+				env_set(ctx_uboot, enetvar, ethaddr);
 		}
 	}
 
diff --git a/board/vscom/baltos/board.c b/board/vscom/baltos/board.c
index 1ba58d0f11dd..5e799d546786 100644
--- a/board/vscom/baltos/board.c
+++ b/board/vscom/baltos/board.c
@@ -65,7 +65,7 @@ static int baltos_set_console(void)
 	printf("DIPs: 0x%1x\n", (~dips) & 0xf);
 
 	if ((dips & 0xf) == 0xe)
-		env_set("console", "ttyUSB0,115200n8");
+		env_set(ctx_uboot, "console", "ttyUSB0,115200n8");
 
 	return 0;
 }
@@ -367,7 +367,7 @@ int board_late_init(void)
 		return -ENODEV;
 	}
 
-	env_set("board_name", model);
+	env_set(ctx_uboot, "board_name", model);
 #endif
 
 	return 0;
@@ -447,7 +447,7 @@ int board_eth_init(bd_t *bis)
 
 #if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \
 	(defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))
-	if (!env_get("ethaddr")) {
+	if (!env_get(ctx_uboot, "ethaddr")) {
 		printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
 		if (is_valid_ethaddr(mac_addr))
diff --git a/board/wandboard/wandboard.c b/board/wandboard/wandboard.c
index 69cdf3e9c96b..4ba472cae9b8 100644
--- a/board/wandboard/wandboard.c
+++ b/board/wandboard/wandboard.c
@@ -451,18 +451,18 @@ int board_late_init(void)
 
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 	if (is_mx6dqp())
-		env_set("board_rev", "MX6QP");
+		env_set(ctx_uboot, "board_rev", "MX6QP");
 	else if (is_mx6dq())
-		env_set("board_rev", "MX6Q");
+		env_set(ctx_uboot, "board_rev", "MX6Q");
 	else
-		env_set("board_rev", "MX6DL");
+		env_set(ctx_uboot, "board_rev", "MX6DL");
 
 	if (is_revd1())
-		env_set("board_name", "D1");
+		env_set(ctx_uboot, "board_name", "D1");
 	else if (is_revc1())
-		env_set("board_name", "C1");
+		env_set(ctx_uboot, "board_name", "C1");
 	else
-		env_set("board_name", "B1");
+		env_set(ctx_uboot, "board_name", "B1");
 #endif
 	return 0;
 }
diff --git a/board/warp7/warp7.c b/board/warp7/warp7.c
index 39ae98225738..549d65b3469d 100644
--- a/board/warp7/warp7.c
+++ b/board/warp7/warp7.c
@@ -148,9 +148,9 @@ int board_late_init(void)
 
 #ifdef CONFIG_SECURE_BOOT
 	/* Determine HAB state */
-	env_set_ulong(HAB_ENABLED_ENVNAME, imx_hab_is_enabled());
+	env_set_ulong(ctx_uboot, HAB_ENABLED_ENVNAME, imx_hab_is_enabled());
 #else
-	env_set_ulong(HAB_ENABLED_ENVNAME, 0);
+	env_set_ulong(ctx_uboot, HAB_ENABLED_ENVNAME, 0);
 #endif
 
 #ifdef CONFIG_SERIAL_TAG
@@ -158,7 +158,7 @@ int board_late_init(void)
 	get_board_serial(&serialnr);
 	snprintf(serial_string, sizeof(serial_string), "WaRP7-0x%08x%08x",
 		 serialnr.low, serialnr.high);
-	env_set("serial#", serial_string);
+	env_set(ctx_uboot, "serial#", serial_string);
 #endif
 
 	return 0;
diff --git a/board/work-microwave/work_92105/work_92105_display.c b/board/work-microwave/work_92105/work_92105_display.c
index db04dcabc7bc..e673921b7bbc 100644
--- a/board/work-microwave/work_92105/work_92105_display.c
+++ b/board/work-microwave/work_92105/work_92105_display.c
@@ -228,7 +228,7 @@ void work_92105_display_init(void)
 	i2c_write(0x2c, 0x01, 1, &enable_backlight, 1);
 
 	/* set display contrast */
-	display_contrast_str = env_get("fwopt_dispcontrast");
+	display_contrast_str = env_get(ctx_uboot, "fwopt_dispcontrast");
 	if (display_contrast_str)
 		display_contrast = simple_strtoul(display_contrast_str,
 			NULL, 10);
diff --git a/board/xes/common/board.c b/board/xes/common/board.c
index 43575bc302d6..b5cc9a69508a 100644
--- a/board/xes/common/board.c
+++ b/board/xes/common/board.c
@@ -51,13 +51,13 @@ int checkboard(void)
 
 	/* Display board specific information */
 	puts("       ");
-	i = env_get_f("board_rev", buf, sizeof(buf));
+	i = env_get_f("board_rev", buf, sizeof(ctx_uboot, buf));
 	if (i > 0)
 		printf("Rev %s, ", buf);
-	i = env_get_f("serial#", buf, sizeof(buf));
+	i = env_get_f("serial#", buf, sizeof(ctx_uboot, buf));
 	if (i > 0)
 		printf("Serial# %s, ", buf);
-	i = env_get_f("board_cfg", buf, sizeof(buf));
+	i = env_get_f("board_cfg", buf, sizeof(ctx_uboot, buf));
 	if (i > 0)
 		printf("Cfg %s", buf);
 	puts("\n");
diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c
index 35191b2f813b..509834c679ab 100644
--- a/board/xilinx/zynq/board.c
+++ b/board/xilinx/zynq/board.c
@@ -41,27 +41,27 @@ int board_late_init(void)
 	switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) {
 	case ZYNQ_BM_QSPI:
 		mode = "qspi";
-		env_set("modeboot", "qspiboot");
+		env_set(ctx_uboot, "modeboot", "qspiboot");
 		break;
 	case ZYNQ_BM_NAND:
 		mode = "nand";
-		env_set("modeboot", "nandboot");
+		env_set(ctx_uboot, "modeboot", "nandboot");
 		break;
 	case ZYNQ_BM_NOR:
 		mode = "nor";
-		env_set("modeboot", "norboot");
+		env_set(ctx_uboot, "modeboot", "norboot");
 		break;
 	case ZYNQ_BM_SD:
 		mode = "mmc";
-		env_set("modeboot", "sdboot");
+		env_set(ctx_uboot, "modeboot", "sdboot");
 		break;
 	case ZYNQ_BM_JTAG:
 		mode = "pxe dhcp";
-		env_set("modeboot", "jtagboot");
+		env_set(ctx_uboot, "modeboot", "jtagboot");
 		break;
 	default:
 		mode = "";
-		env_set("modeboot", "");
+		env_set(ctx_uboot, "modeboot", "");
 		break;
 	}
 
@@ -69,7 +69,7 @@ int board_late_init(void)
 	 * One terminating char + one byte for space between mode
 	 * and default boot_targets
 	 */
-	env_targets = env_get("boot_targets");
+	env_targets = env_get(ctx_uboot, "boot_targets");
 	if (env_targets)
 		env_targets_len = strlen(env_targets);
 
@@ -80,7 +80,7 @@ int board_late_init(void)
 	sprintf(new_targets, "%s %s", mode,
 		env_targets ? env_targets : "");
 
-	env_set("boot_targets", new_targets);
+	env_set(ctx_uboot, "boot_targets", new_targets);
 
 	return 0;
 }
diff --git a/board/xilinx/zynqmp/cmds.c b/board/xilinx/zynqmp/cmds.c
index ed7ba58c6475..e5c1dab091ca 100644
--- a/board/xilinx/zynqmp/cmds.c
+++ b/board/xilinx/zynqmp/cmds.c
@@ -57,7 +57,7 @@ static int do_zynqmp_verify_secure(cmd_tbl_t *cmdtp, int flag, int argc,
 	} else {
 		addr = (u64)ret_payload[1] << 32 | ret_payload[2];
 		printf("Verified image at 0x%llx\n", addr);
-		env_set_hex("zynqmp_verified_img_addr", addr);
+		env_set_hex(ctx_uboot, "zynqmp_verified_img_addr", addr);
 	}
 
 	return ret;
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index d649daba96d4..31e26fb097a4 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -479,7 +479,7 @@ static int reset_reason(void)
 
 	puts("\n");
 
-	env_set("reset_reason", reason);
+	env_set(ctx_uboot, "reset_reason", reason);
 
 	ret = zynqmp_mmio_write(~0, ~0, (ulong)&crlapb_base->reset_reason);
 	if (ret)
@@ -494,7 +494,7 @@ static int set_fdtfile(void)
 	const char *suffix = ".dtb";
 	const char *vendor = "xilinx/";
 
-	if (env_get("fdtfile"))
+	if (env_get(ctx_uboot, "fdtfile"))
 		return 0;
 
 	compatible = (char *)fdt_getprop(gd->fdt_blob, 0, "compatible", NULL);
@@ -511,7 +511,7 @@ static int set_fdtfile(void)
 
 		sprintf(fdtfile, "%s%s%s", vendor, compatible, suffix);
 
-		env_set("fdtfile", fdtfile);
+		env_set(ctx_uboot, "fdtfile", fdtfile);
 		free(fdtfile);
 	}
 
@@ -558,23 +558,23 @@ int board_late_init(void)
 	case USB_MODE:
 		puts("USB_MODE\n");
 		mode = "usb";
-		env_set("modeboot", "usb_dfu_spl");
+		env_set(ctx_uboot, "modeboot", "usb_dfu_spl");
 		break;
 	case JTAG_MODE:
 		puts("JTAG_MODE\n");
 		mode = "pxe dhcp";
-		env_set("modeboot", "jtagboot");
+		env_set(ctx_uboot, "modeboot", "jtagboot");
 		break;
 	case QSPI_MODE_24BIT:
 	case QSPI_MODE_32BIT:
 		mode = "qspi0";
 		puts("QSPI_MODE\n");
-		env_set("modeboot", "qspiboot");
+		env_set(ctx_uboot, "modeboot", "qspiboot");
 		break;
 	case EMMC_MODE:
 		puts("EMMC_MODE\n");
 		mode = "mmc0";
-		env_set("modeboot", "emmcboot");
+		env_set(ctx_uboot, "modeboot", "emmcboot");
 		break;
 	case SD_MODE:
 		puts("SD_MODE\n");
@@ -589,7 +589,7 @@ int board_late_init(void)
 
 		mode = "mmc";
 		bootseq = dev->seq;
-		env_set("modeboot", "sdboot");
+		env_set(ctx_uboot, "modeboot", "sdboot");
 		break;
 	case SD1_LSHFT_MODE:
 		puts("LVL_SHFT_");
@@ -607,12 +607,12 @@ int board_late_init(void)
 
 		mode = "mmc";
 		bootseq = dev->seq;
-		env_set("modeboot", "sdboot");
+		env_set(ctx_uboot, "modeboot", "sdboot");
 		break;
 	case NAND_MODE:
 		puts("NAND_MODE\n");
 		mode = "nand0";
-		env_set("modeboot", "nandboot");
+		env_set(ctx_uboot, "modeboot", "nandboot");
 		break;
 	default:
 		mode = "";
@@ -629,7 +629,7 @@ int board_late_init(void)
 	 * One terminating char + one byte for space between mode
 	 * and default boot_targets
 	 */
-	env_targets = env_get("boot_targets");
+	env_targets = env_get(ctx_uboot, "boot_targets");
 	if (env_targets)
 		env_targets_len = strlen(env_targets);
 
@@ -645,7 +645,7 @@ int board_late_init(void)
 		sprintf(new_targets, "%s %s", mode,
 			env_targets ? env_targets : "");
 
-	env_set("boot_targets", new_targets);
+	env_set(ctx_uboot, "boot_targets", new_targets);
 
 	reset_reason();
 
-- 
2.21.0



More information about the U-Boot mailing list