diff --git a/arch/arm/cpu/arm926ejs/spear/spr_misc.c b/arch/arm/cpu/arm926ejs/spear/spr_misc.c
index 371dea5657..533268513e 100644
--- a/arch/arm/cpu/arm926ejs/spear/spr_misc.c
+++ b/arch/arm/cpu/arm926ejs/spear/spr_misc.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <env.h>
 #include <environment.h>
 #include <i2c.h>
 #include <net.h>
diff --git a/arch/arm/cpu/armv7/vf610/generic.c b/arch/arm/cpu/armv7/vf610/generic.c
index 337f4af7a8..7e4641fd32 100644
--- a/arch/arm/cpu/armv7/vf610/generic.c
+++ b/arch/arm/cpu/armv7/vf610/generic.c
@@ -9,6 +9,7 @@
 #include <asm/arch/clock.h>
 #include <asm/arch/crm_regs.h>
 #include <asm/mach-imx/sys_proto.h>
+#include <env.h>
 #include <netdev.h>
 #ifdef CONFIG_FSL_ESDHC_IMX
 #include <fsl_esdhc_imx.h>
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/soc.c b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
index 7414215208..00c705f74e 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/soc.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <fsl_immap.h>
 #include <fsl_ifc.h>
 #include <asm/arch/fsl_serdes.h>
diff --git a/arch/arm/mach-davinci/misc.c b/arch/arm/mach-davinci/misc.c
index df500c8f35..b310bc7293 100644
--- a/arch/arm/mach-davinci/misc.c
+++ b/arch/arm/mach-davinci/misc.c
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <environment.h>
 #include <i2c.h>
 #include <net.h>
diff --git a/arch/arm/mach-imx/mx6/opos6ul.c b/arch/arm/mach-imx/mx6/opos6ul.c
index 264fa8a48e..8b921a7d37 100644
--- a/arch/arm/mach-imx/mx6/opos6ul.c
+++ b/arch/arm/mach-imx/mx6/opos6ul.c
@@ -13,6 +13,7 @@
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/io.h>
 #include <common.h>
+#include <env.h>
 #include <environment.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/arm/mach-imx/mx7/soc.c b/arch/arm/mach-imx/mx7/soc.c
index 1b4bbc5037..3b8e1ba9c3 100644
--- a/arch/arm/mach-imx/mx7/soc.c
+++ b/arch/arm/mach-imx/mx7/soc.c
@@ -14,6 +14,7 @@
 #include <asm/arch/imx-rdc.h>
 #include <asm/arch/crm_regs.h>
 #include <dm.h>
+#include <env.h>
 #include <imx_thermal.h>
 #include <fsl_sec.h>
 #include <asm/setup.h>
diff --git a/arch/arm/mach-meson/board-common.c b/arch/arm/mach-meson/board-common.c
index 18383f774e..08a7aae2b9 100644
--- a/arch/arm/mach-meson/board-common.c
+++ b/arch/arm/mach-meson/board-common.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <asm/arch/boot.h>
+#include <env.h>
 #include <linux/libfdt.h>
 #include <linux/err.h>
 #include <environment.h>
diff --git a/arch/arm/mach-omap2/utils.c b/arch/arm/mach-omap2/utils.c
index edf5edcb68..cf4f10a8f5 100644
--- a/arch/arm/mach-omap2/utils.c
+++ b/arch/arm/mach-omap2/utils.c
@@ -4,6 +4,7 @@
  * Aneesh V <aneesh@ti.com>
  */
 #include <common.h>
+#include <env.h>
 #include <environment.h>
 #include <asm/setup.h>
 #include <asm/arch/sys_proto.h>
diff --git a/arch/arm/mach-rmobile/cpu_info.c b/arch/arm/mach-rmobile/cpu_info.c
index 784a2a28d5..ef6ab32e65 100644
--- a/arch/arm/mach-rmobile/cpu_info.c
+++ b/arch/arm/mach-rmobile/cpu_info.c
@@ -5,6 +5,7 @@
  */
 #include <common.h>
 #include <asm/io.h>
+#include <env.h>
 #include <linux/ctype.h>
 
 #ifdef CONFIG_ARCH_CPU_INIT
diff --git a/arch/arm/mach-rockchip/rk3288-board.c b/arch/arm/mach-rockchip/rk3288-board.c
index a250d50387..06bb86dae9 100644
--- a/arch/arm/mach-rockchip/rk3288-board.c
+++ b/arch/arm/mach-rockchip/rk3288-board.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <env.h>
 #include <ram.h>
 #include <syscon.h>
 #include <asm/io.h>
diff --git a/arch/arm/mach-socfpga/misc_gen5.c b/arch/arm/mach-socfpga/misc_gen5.c
index 71547d81ab..31681b799d 100644
--- a/arch/arm/mach-socfpga/misc_gen5.c
+++ b/arch/arm/mach-socfpga/misc_gen5.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <asm/io.h>
+#include <env.h>
 #include <errno.h>
 #include <fdtdec.h>
 #include <linux/libfdt.h>
diff --git a/arch/arm/mach-socfpga/misc_s10.c b/arch/arm/mach-socfpga/misc_s10.c
index 29abc4a54c..0a5fab11c0 100644
--- a/arch/arm/mach-socfpga/misc_s10.c
+++ b/arch/arm/mach-socfpga/misc_s10.c
@@ -6,6 +6,7 @@
 
 #include <altera.h>
 #include <common.h>
+#include <env.h>
 #include <errno.h>
 #include <fdtdec.h>
 #include <miiphy.h>
diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c
index 10190f40d4..b06b84c315 100644
--- a/arch/arm/mach-stm32mp/cpu.c
+++ b/arch/arm/mach-stm32mp/cpu.c
@@ -5,6 +5,7 @@
 #include <common.h>
 #include <clk.h>
 #include <debug_uart.h>
+#include <env.h>
 #include <environment.h>
 #include <misc.h>
 #include <asm/io.h>
diff --git a/arch/arm/mach-tegra/board2.c b/arch/arm/mach-tegra/board2.c
index bbc487aa3b..f13bd256cc 100644
--- a/arch/arm/mach-tegra/board2.c
+++ b/arch/arm/mach-tegra/board2.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <dm.h>
 #include <efi_loader.h>
+#include <env.h>
 #include <errno.h>
 #include <ns16550.h>
 #include <usb.h>
diff --git a/board/Arcturus/ucp1020/cmd_arc.c b/board/Arcturus/ucp1020/cmd_arc.c
index 7a510c61fb..755f569d13 100644
--- a/board/Arcturus/ucp1020/cmd_arc.c
+++ b/board/Arcturus/ucp1020/cmd_arc.c
@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <div64.h>
+#include <env.h>
 #include <malloc.h>
 #include <spi_flash.h>
 #include <mmc.h>
diff --git a/board/Arcturus/ucp1020/ucp1020.c b/board/Arcturus/ucp1020/ucp1020.c
index 54fd1782cb..6a880c97bc 100644
--- a/board/Arcturus/ucp1020/ucp1020.c
+++ b/board/Arcturus/ucp1020/ucp1020.c
@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <env.h>
 #include <hwconfig.h>
 #include <pci.h>
 #include <i2c.h>
diff --git a/board/CZ.NIC/turris_mox/turris_mox.c b/board/CZ.NIC/turris_mox/turris_mox.c
index 3818e3752a..f3c89d63d5 100644
--- a/board/CZ.NIC/turris_mox/turris_mox.c
+++ b/board/CZ.NIC/turris_mox/turris_mox.c
@@ -8,6 +8,7 @@
 #include <asm/io.h>
 #include <dm.h>
 #include <clk.h>
+#include <env.h>
 #include <spi.h>
 #include <mvebu/comphy.h>
 #include <miiphy.h>
diff --git a/board/LaCie/net2big_v2/net2big_v2.c b/board/LaCie/net2big_v2/net2big_v2.c
index fb08e50415..1609089502 100644
--- a/board/LaCie/net2big_v2/net2big_v2.c
+++ b/board/LaCie/net2big_v2/net2big_v2.c
@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <env.h>
 #include <environment.h>
 #include <i2c.h>
 #include <asm/mach-types.h>
diff --git a/board/LaCie/netspace_v2/netspace_v2.c b/board/LaCie/netspace_v2/netspace_v2.c
index 453c0dd467..ba667934e4 100644
--- a/board/LaCie/netspace_v2/netspace_v2.c
+++ b/board/LaCie/netspace_v2/netspace_v2.c
@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <env.h>
 #include <environment.h>
 #include <asm/mach-types.h>
 #include <asm/arch/cpu.h>
diff --git a/board/Synology/ds414/cmd_syno.c b/board/Synology/ds414/cmd_syno.c
index 59e6fe0310..777948f90f 100644
--- a/board/Synology/ds414/cmd_syno.c
+++ b/board/Synology/ds414/cmd_syno.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <div64.h>
+#include <env.h>
 #include <spi.h>
 #include <spi_flash.h>
 #include <linux/mtd/mtd.h>
diff --git a/board/alliedtelesis/x530/x530.c b/board/alliedtelesis/x530/x530.c
index 97dbed79dd..e0fa8067c1 100644
--- a/board/alliedtelesis/x530/x530.c
+++ b/board/alliedtelesis/x530/x530.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <command.h>
 #include <dm.h>
+#include <env.h>
 #include <i2c.h>
 #include <wdt.h>
 #include <asm/gpio.h>
diff --git a/board/amazon/kc1/kc1.c b/board/amazon/kc1/kc1.c
index 031fd11092..9034c4fbff 100644
--- a/board/amazon/kc1/kc1.c
+++ b/board/amazon/kc1/kc1.c
@@ -7,6 +7,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <env.h>
 #include <linux/ctype.h>
 #include <linux/usb/musb.h>
 #include <asm/omap_musb.h>
diff --git a/board/amlogic/p200/p200.c b/board/amlogic/p200/p200.c
index 62f0f4c871..7f33ce0f0b 100644
--- a/board/amlogic/p200/p200.c
+++ b/board/amlogic/p200/p200.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <env.h>
 #include <environment.h>
 #include <asm/io.h>
 #include <asm/arch/gx.h>
diff --git a/board/amlogic/p201/p201.c b/board/amlogic/p201/p201.c
index ef0c65cd9f..0a17fbedf1 100644
--- a/board/amlogic/p201/p201.c
+++ b/board/amlogic/p201/p201.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <env.h>
 #include <environment.h>
 #include <asm/io.h>
 #include <asm/arch/gx.h>
diff --git a/board/amlogic/p212/p212.c b/board/amlogic/p212/p212.c
index 1159cee4ce..4d6ac7264c 100644
--- a/board/amlogic/p212/p212.c
+++ b/board/amlogic/p212/p212.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <env.h>
 #include <environment.h>
 #include <asm/io.h>
 #include <asm/arch/gx.h>
diff --git a/board/amlogic/q200/q200.c b/board/amlogic/q200/q200.c
index 2ea97c362e..880945f143 100644
--- a/board/amlogic/q200/q200.c
+++ b/board/amlogic/q200/q200.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <env.h>
 #include <environment.h>
 #include <asm/io.h>
 #include <asm/arch/gx.h>
diff --git a/board/aristainetos/aristainetos-v2.c b/board/aristainetos/aristainetos-v2.c
index c81c441172..c0a2e41f02 100644
--- a/board/aristainetos/aristainetos-v2.c
+++ b/board/aristainetos/aristainetos-v2.c
@@ -13,6 +13,7 @@
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/mx6-pins.h>
+#include <env.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/mach-imx/iomux-v3.h>
diff --git a/board/armltd/integrator/integrator.c b/board/armltd/integrator/integrator.c
index 69d92a32a5..0a2baa7297 100644
--- a/board/armltd/integrator/integrator.c
+++ b/board/armltd/integrator/integrator.c
@@ -18,6 +18,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <env.h>
 #include <netdev.h>
 #include <asm/io.h>
 #include <dm/platform_data/serial_pl01x.h>
diff --git a/board/atmel/common/board.c b/board/atmel/common/board.c
index 20c3b8c086..c41706c400 100644
--- a/board/atmel/common/board.c
+++ b/board/atmel/common/board.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <w1.h>
 #include <w1-eeprom.h>
 #include <dm/device-internal.h>
diff --git a/board/atmel/common/mac_eeprom.c b/board/atmel/common/mac_eeprom.c
index 7ff1ec7462..f016ef7a6a 100644
--- a/board/atmel/common/mac_eeprom.c
+++ b/board/atmel/common/mac_eeprom.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <env.h>
 #include <environment.h>
 #include <i2c_eeprom.h>
 #include <netdev.h>
diff --git a/board/atmel/sama5d3xek/sama5d3xek.c b/board/atmel/sama5d3xek/sama5d3xek.c
index e373f45800..acf61486d2 100644
--- a/board/atmel/sama5d3xek/sama5d3xek.c
+++ b/board/atmel/sama5d3xek/sama5d3xek.c
@@ -12,6 +12,7 @@
 #include <asm/arch/gpio.h>
 #include <asm/arch/clk.h>
 #include <debug_uart.h>
+#include <env.h>
 #include <linux/ctype.h>
 #include <phy.h>
 #include <micrel.h>
diff --git a/board/bachmann/ot1200/ot1200.c b/board/bachmann/ot1200/ot1200.c
index 067a970830..36f37084b3 100644
--- a/board/bachmann/ot1200/ot1200.c
+++ b/board/bachmann/ot1200/ot1200.c
@@ -9,6 +9,7 @@
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
+#include <env.h>
 #include <malloc.h>
 #include <asm/arch/mx6-pins.h>
 #include <asm/mach-imx/iomux-v3.h>
diff --git a/board/bosch/shc/board.c b/board/bosch/shc/board.c
index feed63bdf2..29be3739f9 100644
--- a/board/bosch/shc/board.c
+++ b/board/bosch/shc/board.c
@@ -12,6 +12,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <errno.h>
 #include <spl.h>
 #include <asm/arch/cpu.h>
diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c
index bf69a746e4..b2ccb83c8a 100644
--- a/board/buffalo/lsxl/lsxl.c
+++ b/board/buffalo/lsxl/lsxl.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <environment.h>
 #include <net.h>
 #include <malloc.h>
diff --git a/board/cadence/xtfpga/xtfpga.c b/board/cadence/xtfpga/xtfpga.c
index bdda9314a5..256611638a 100644
--- a/board/cadence/xtfpga/xtfpga.c
+++ b/board/cadence/xtfpga/xtfpga.c
@@ -8,6 +8,7 @@
 #include <command.h>
 #include <dm.h>
 #include <dm/platform_data/net_ethoc.h>
+#include <env.h>
 #include <linux/ctype.h>
 #include <linux/string.h>
 #include <linux/stringify.h>
diff --git a/board/ccv/xpress/xpress.c b/board/ccv/xpress/xpress.c
index 35e1c557b5..05286e643c 100644
--- a/board/ccv/xpress/xpress.c
+++ b/board/ccv/xpress/xpress.c
@@ -16,6 +16,7 @@
 #include <asm/mach-imx/mxc_i2c.h>
 #include <asm/io.h>
 #include <common.h>
+#include <env.h>
 #include <fsl_esdhc_imx.h>
 #include <i2c.h>
 #include <miiphy.h>
diff --git a/board/compulab/cl-som-imx7/cl-som-imx7.c b/board/compulab/cl-som-imx7/cl-som-imx7.c
index 94e7bf194b..6cc7554c1a 100644
--- a/board/compulab/cl-som-imx7/cl-som-imx7.c
+++ b/board/compulab/cl-som-imx7/cl-som-imx7.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <environment.h>
 #include <mmc.h>
 #include <phy.h>
diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c
index e9262c64a5..57bbe41b8c 100644
--- a/board/compulab/cm_fx6/cm_fx6.c
+++ b/board/compulab/cm_fx6/cm_fx6.c
@@ -11,6 +11,7 @@
 #include <ahci.h>
 #include <dm.h>
 #include <dwc_ahsata.h>
+#include <env.h>
 #include <environment.h>
 #include <fsl_esdhc_imx.h>
 #include <miiphy.h>
diff --git a/board/compulab/cm_t335/cm_t335.c b/board/compulab/cm_t335/cm_t335.c
index 95cbb77753..fca7685ca7 100644
--- a/board/compulab/cm_t335/cm_t335.c
+++ b/board/compulab/cm_t335/cm_t335.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <environment.h>
 #include <errno.h>
 #include <miiphy.h>
diff --git a/board/compulab/cm_t35/cm_t35.c b/board/compulab/cm_t35/cm_t35.c
index 4d171f4900..ead4700646 100644
--- a/board/compulab/cm_t35/cm_t35.c
+++ b/board/compulab/cm_t35/cm_t35.c
@@ -12,6 +12,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <environment.h>
 #include <status_led.h>
 #include <netdev.h>
diff --git a/board/compulab/cm_t54/cm_t54.c b/board/compulab/cm_t54/cm_t54.c
index 504a537f45..d7c59d5a32 100644
--- a/board/compulab/cm_t54/cm_t54.c
+++ b/board/compulab/cm_t54/cm_t54.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <environment.h>
 #include <fdt_support.h>
 #include <usb.h>
diff --git a/board/congatec/cgtqmx6eval/cgtqmx6eval.c b/board/congatec/cgtqmx6eval/cgtqmx6eval.c
index 7c767fb8b4..6b3d5b833f 100644
--- a/board/congatec/cgtqmx6eval/cgtqmx6eval.c
+++ b/board/congatec/cgtqmx6eval/cgtqmx6eval.c
@@ -20,6 +20,7 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/mxc_hdmi.h>
 #include <asm/arch/crm_regs.h>
+#include <env.h>
 #include <mmc.h>
 #include <fsl_esdhc_imx.h>
 #include <i2c.h>
diff --git a/board/cssi/MCR3000/MCR3000.c b/board/cssi/MCR3000/MCR3000.c
index d26ac35b44..445b84c180 100644
--- a/board/cssi/MCR3000/MCR3000.c
+++ b/board/cssi/MCR3000/MCR3000.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <hwconfig.h>
 #include <mpc8xx.h>
 #include <fdt_support.h>
diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index 43483d526a..88a21ba433 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <env.h>
 #include <environment.h>
 #include <i2c.h>
 #include <net.h>
diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c b/board/davinci/da8xxevm/omapl138_lcdk.c
index dd11551428..b9f99b351a 100644
--- a/board/davinci/da8xxevm/omapl138_lcdk.c
+++ b/board/davinci/da8xxevm/omapl138_lcdk.c
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <i2c.h>
 #include <net.h>
 #include <spi.h>
diff --git a/board/dhelectronics/dh_imx6/dh_imx6.c b/board/dhelectronics/dh_imx6/dh_imx6.c
index 1d41690c0c..a920e262db 100644
--- a/board/dhelectronics/dh_imx6/dh_imx6.c
+++ b/board/dhelectronics/dh_imx6/dh_imx6.c
@@ -22,6 +22,7 @@
 #include <asm/mach-imx/sata.h>
 #include <ahci.h>
 #include <dwc_ahsata.h>
+#include <env.h>
 #include <environment.h>
 #include <errno.h>
 #include <fsl_esdhc_imx.h>
diff --git a/board/eets/pdu001/board.c b/board/eets/pdu001/board.c
index b857a5a935..74a6684274 100644
--- a/board/eets/pdu001/board.c
+++ b/board/eets/pdu001/board.c
@@ -10,6 +10,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <errno.h>
 #include <spl.h>
 #include <i2c.h>
diff --git a/board/el/el6x/el6x.c b/board/el/el6x/el6x.c
index 55db26a819..18d69a7da3 100644
--- a/board/el/el6x/el6x.c
+++ b/board/el/el6x/el6x.c
@@ -9,6 +9,7 @@
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/mx6-pins.h>
+#include <env.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/mach-imx/mxc_i2c.h>
diff --git a/board/freescale/common/cmd_esbc_validate.c b/board/freescale/common/cmd_esbc_validate.c
index b06235f291..36b620ca23 100644
--- a/board/freescale/common/cmd_esbc_validate.c
+++ b/board/freescale/common/cmd_esbc_validate.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <env.h>
 #include <fsl_validate.h>
 
 int do_esbc_halt(cmd_tbl_t *cmdtp, int flag, int argc,
diff --git a/board/freescale/common/fsl_chain_of_trust.c b/board/freescale/common/fsl_chain_of_trust.c
index dddfd26a13..a024e7239e 100644
--- a/board/freescale/common/fsl_chain_of_trust.c
+++ b/board/freescale/common/fsl_chain_of_trust.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <env.h>
 #include <fsl_validate.h>
 #include <fsl_secboot_err.h>
 #include <fsl_sfp.h>
diff --git a/board/freescale/common/sys_eeprom.c b/board/freescale/common/sys_eeprom.c
index ab0fe0baf1..510d7c266b 100644
--- a/board/freescale/common/sys_eeprom.c
+++ b/board/freescale/common/sys_eeprom.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <env.h>
 #include <i2c.h>
 #include <linux/ctype.h>
 
diff --git a/board/freescale/imx8mq_evk/imx8mq_evk.c b/board/freescale/imx8mq_evk/imx8mq_evk.c
index 322713cced..1463e6e696 100644
--- a/board/freescale/imx8mq_evk/imx8mq_evk.c
+++ b/board/freescale/imx8mq_evk/imx8mq_evk.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <malloc.h>
 #include <errno.h>
 #include <asm/io.h>
diff --git a/board/freescale/imx8qm_mek/imx8qm_mek.c b/board/freescale/imx8qm_mek/imx8qm_mek.c
index e69efc4dd6..b7caa31954 100644
--- a/board/freescale/imx8qm_mek/imx8qm_mek.c
+++ b/board/freescale/imx8qm_mek/imx8qm_mek.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <errno.h>
 #include <linux/libfdt.h>
 #include <environment.h>
diff --git a/board/freescale/imx8qxp_mek/imx8qxp_mek.c b/board/freescale/imx8qxp_mek/imx8qxp_mek.c
index 120731422c..f42a3aa908 100644
--- a/board/freescale/imx8qxp_mek/imx8qxp_mek.c
+++ b/board/freescale/imx8qxp_mek/imx8qxp_mek.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <errno.h>
 #include <linux/libfdt.h>
 #include <environment.h>
diff --git a/board/freescale/ls2080ardb/ls2080ardb.c b/board/freescale/ls2080ardb/ls2080ardb.c
index ce419dfcae..a278e2fc11 100644
--- a/board/freescale/ls2080ardb/ls2080ardb.c
+++ b/board/freescale/ls2080ardb/ls2080ardb.c
@@ -4,6 +4,7 @@
  * Copyright 2017 NXP
  */
 #include <common.h>
+#include <env.h>
 #include <malloc.h>
 #include <errno.h>
 #include <netdev.h>
diff --git a/board/freescale/mpc8323erdb/mpc8323erdb.c b/board/freescale/mpc8323erdb/mpc8323erdb.c
index 2dc6d7f5f5..e5aecc4e1f 100644
--- a/board/freescale/mpc8323erdb/mpc8323erdb.c
+++ b/board/freescale/mpc8323erdb/mpc8323erdb.c
@@ -10,6 +10,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <ioports.h>
 #include <mpc83xx.h>
 #include <i2c.h>
diff --git a/board/freescale/mx53loco/mx53loco.c b/board/freescale/mx53loco/mx53loco.c
index d023ce667d..a177815bb8 100644
--- a/board/freescale/mx53loco/mx53loco.c
+++ b/board/freescale/mx53loco/mx53loco.c
@@ -12,6 +12,7 @@
 #include <asm/arch/clock.h>
 #include <asm/arch/iomux-mx53.h>
 #include <asm/arch/clock.h>
+#include <env.h>
 #include <linux/errno.h>
 #include <asm/mach-imx/mx5_video.h>
 #include <netdev.h>
diff --git a/board/freescale/mx6sabreauto/mx6sabreauto.c b/board/freescale/mx6sabreauto/mx6sabreauto.c
index e1a3b47425..dc156efbbc 100644
--- a/board/freescale/mx6sabreauto/mx6sabreauto.c
+++ b/board/freescale/mx6sabreauto/mx6sabreauto.c
@@ -11,6 +11,7 @@
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/mx6-pins.h>
+#include <env.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/mach-imx/iomux-v3.h>
diff --git a/board/freescale/mx6sabresd/mx6sabresd.c b/board/freescale/mx6sabresd/mx6sabresd.c
index 63e1dd0a83..b0c0117968 100644
--- a/board/freescale/mx6sabresd/mx6sabresd.c
+++ b/board/freescale/mx6sabresd/mx6sabresd.c
@@ -10,6 +10,7 @@
 #include <asm/arch/iomux.h>
 #include <asm/arch/mx6-pins.h>
 #include <asm/mach-imx/spi.h>
+#include <env.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/mach-imx/mxc_i2c.h>
diff --git a/board/freescale/mx6sxsabresd/mx6sxsabresd.c b/board/freescale/mx6sxsabresd/mx6sxsabresd.c
index 8ee85cc384..1c10958879 100644
--- a/board/freescale/mx6sxsabresd/mx6sxsabresd.c
+++ b/board/freescale/mx6sxsabresd/mx6sxsabresd.c
@@ -15,6 +15,7 @@
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/io.h>
 #include <asm/mach-imx/mxc_i2c.h>
+#include <env.h>
 #include <linux/sizes.h>
 #include <common.h>
 #include <fsl_esdhc_imx.h>
diff --git a/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c b/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
index 785247f7e2..ccbe404478 100644
--- a/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
+++ b/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
@@ -16,6 +16,7 @@
 #include <asm/mach-imx/mxc_i2c.h>
 #include <asm/io.h>
 #include <common.h>
+#include <env.h>
 #include <fsl_esdhc_imx.h>
 #include <i2c.h>
 #include <miiphy.h>
diff --git a/board/freescale/mx6ullevk/mx6ullevk.c b/board/freescale/mx6ullevk/mx6ullevk.c
index 1f0f70efbd..e119347802 100644
--- a/board/freescale/mx6ullevk/mx6ullevk.c
+++ b/board/freescale/mx6ullevk/mx6ullevk.c
@@ -14,6 +14,7 @@
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/io.h>
 #include <common.h>
+#include <env.h>
 #include <fsl_esdhc_imx.h>
 #include <linux/sizes.h>
 #include <mmc.h>
diff --git a/board/gardena/smart-gateway-at91sam/board.c b/board/gardena/smart-gateway-at91sam/board.c
index 6a1389eb05..3e2da0d6f8 100644
--- a/board/gardena/smart-gateway-at91sam/board.c
+++ b/board/gardena/smart-gateway-at91sam/board.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <debug_uart.h>
+#include <env.h>
 #include <led.h>
 #include <asm/arch/at91_common.h>
 #include <asm/arch/clk.h>
diff --git a/board/gardena/smart-gateway-mt7688/board.c b/board/gardena/smart-gateway-mt7688/board.c
index 6e11077977..baa3e5726c 100644
--- a/board/gardena/smart-gateway-mt7688/board.c
+++ b/board/gardena/smart-gateway-mt7688/board.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <environment.h>
 #include <led.h>
 #include <net.h>
diff --git a/board/gateworks/gw_ventana/gw_ventana.c b/board/gateworks/gw_ventana/gw_ventana.c
index 92edc10381..3c40a4a892 100644
--- a/board/gateworks/gw_ventana/gw_ventana.c
+++ b/board/gateworks/gw_ventana/gw_ventana.c
@@ -21,6 +21,7 @@
 #include <asm/setup.h>
 #include <dm.h>
 #include <dm/platform_data/serial_mxc.h>
+#include <env.h>
 #include <environment.h>
 #include <hwconfig.h>
 #include <i2c.h>
diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c
index 806525204f..917ecc4c18 100644
--- a/board/ge/bx50v3/bx50v3.c
+++ b/board/ge/bx50v3/bx50v3.c
@@ -9,6 +9,7 @@
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/mx6-pins.h>
+#include <env.h>
 #include <linux/errno.h>
 #include <linux/libfdt.h>
 #include <asm/gpio.h>
diff --git a/board/ge/common/ge_common.c b/board/ge/common/ge_common.c
index 4e6ef9c480..501c8b2daf 100644
--- a/board/ge/common/ge_common.c
+++ b/board/ge/common/ge_common.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <i2c.h>
 #include <rtc.h>
 
diff --git a/board/ge/mx53ppd/mx53ppd.c b/board/ge/mx53ppd/mx53ppd.c
index bf75bd2d46..aadf4668d9 100644
--- a/board/ge/mx53ppd/mx53ppd.c
+++ b/board/ge/mx53ppd/mx53ppd.c
@@ -16,6 +16,7 @@
 #include <asm/arch/clock.h>
 #include <asm/arch/iomux-mx53.h>
 #include <asm/arch/clock.h>
+#include <env.h>
 #include <linux/errno.h>
 #include <linux/libfdt.h>
 #include <asm/mach-imx/mxc_i2c.h>
diff --git a/board/grinn/chiliboard/board.c b/board/grinn/chiliboard/board.c
index dc0de620fc..6b9e6e9a09 100644
--- a/board/grinn/chiliboard/board.c
+++ b/board/grinn/chiliboard/board.c
@@ -16,6 +16,7 @@
 #include <asm/emif.h>
 #include <asm/io.h>
 #include <cpsw.h>
+#include <env.h>
 #include <environment.h>
 #include <errno.h>
 #include <miiphy.h>
diff --git a/board/gumstix/pepper/board.c b/board/gumstix/pepper/board.c
index ea29dcd75e..7ae4c5cd77 100644
--- a/board/gumstix/pepper/board.c
+++ b/board/gumstix/pepper/board.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <errno.h>
 #include <spl.h>
 #include <asm/arch/cpu.h>
diff --git a/board/highbank/highbank.c b/board/highbank/highbank.c
index 996daffa1b..9563763dfa 100644
--- a/board/highbank/highbank.c
+++ b/board/highbank/highbank.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <ahci.h>
+#include <env.h>
 #include <netdev.h>
 #include <scsi.h>
 
diff --git a/board/intel/edison/edison.c b/board/intel/edison/edison.c
index 5faf3c57f2..599e1e35bc 100644
--- a/board/intel/edison/edison.c
+++ b/board/intel/edison/edison.c
@@ -4,6 +4,7 @@
  */
 #include <common.h>
 #include <dwc3-uboot.h>
+#include <env.h>
 #include <environment.h>
 #include <mmc.h>
 #include <u-boot/md5.h>
diff --git a/board/isee/igep003x/board.c b/board/isee/igep003x/board.c
index 965a009a9f..398c945990 100644
--- a/board/isee/igep003x/board.c
+++ b/board/isee/igep003x/board.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <errno.h>
 #include <spl.h>
 #include <asm/arch/cpu.h>
diff --git a/board/isee/igep00x0/igep00x0.c b/board/isee/igep00x0/igep00x0.c
index 367af82d4a..74fc5f0890 100644
--- a/board/isee/igep00x0/igep00x0.c
+++ b/board/isee/igep00x0/igep00x0.c
@@ -4,6 +4,7 @@
  * ISEE 2007 SL, <www.iseebcn.com>
  */
 #include <common.h>
+#include <env.h>
 #include <status_led.h>
 #include <dm.h>
 #include <ns16550.h>
diff --git a/board/k+p/kp_imx53/kp_id_rev.c b/board/k+p/kp_imx53/kp_id_rev.c
index e8f51769f6..642adf78d8 100644
--- a/board/k+p/kp_imx53/kp_id_rev.c
+++ b/board/k+p/kp_imx53/kp_id_rev.c
@@ -10,6 +10,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <environment.h>
 #include <i2c.h>
 #include "kp_id_rev.h"
diff --git a/board/k+p/kp_imx53/kp_imx53.c b/board/k+p/kp_imx53/kp_imx53.c
index b447e13461..84cddd4894 100644
--- a/board/k+p/kp_imx53/kp_imx53.c
+++ b/board/k+p/kp_imx53/kp_imx53.c
@@ -13,6 +13,7 @@
 #include <asm/arch/iomux-mx53.h>
 #include <asm/arch/clock.h>
 #include <asm/gpio.h>
+#include <env.h>
 #include <power/pmic.h>
 #include <fsl_pmic.h>
 #include "kp_id_rev.h"
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 7bdc64b1be..2c541ace02 100644
--- a/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c
+++ b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c
@@ -17,6 +17,7 @@
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/mach-imx/mxc_i2c.h>
+#include <env.h>
 #include <errno.h>
 #include <fsl_esdhc_imx.h>
 #include <fuse.h>
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
index 92d4a6ff61..08f7f8d884 100644
--- a/board/keymile/common/common.c
+++ b/board/keymile/common/common.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <ioports.h>
 #include <command.h>
 #include <malloc.h>
diff --git a/board/keymile/common/ivm.c b/board/keymile/common/ivm.c
index 23bd21c4bc..da0634f01b 100644
--- a/board/keymile/common/ivm.c
+++ b/board/keymile/common/ivm.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <cli_hush.h>
+#include <env.h>
 #include <i2c.h>
 #include "common.h"
 
diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c
index 880ce67fa6..51778368d9 100644
--- a/board/keymile/km83xx/km83xx.c
+++ b/board/keymile/km83xx/km83xx.c
@@ -14,6 +14,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <ioports.h>
 #include <mpc83xx.h>
 #include <i2c.h>
diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index 3db80615ef..922cc621f7 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -12,6 +12,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <i2c.h>
 #include <nand.h>
 #include <netdev.h>
diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c
index e7dcefacdd..4d1e38aa3a 100644
--- a/board/keymile/kmp204x/kmp204x.c
+++ b/board/keymile/kmp204x/kmp204x.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <env.h>
 #include <netdev.h>
 #include <linux/compiler.h>
 #include <asm/mmu.h>
diff --git a/board/kosagi/novena/novena.c b/board/kosagi/novena/novena.c
index dcf3d7ff89..e0f0d7c60c 100644
--- a/board/kosagi/novena/novena.c
+++ b/board/kosagi/novena/novena.c
@@ -9,6 +9,7 @@
 #include <dm.h>
 #include <dm/device-internal.h>
 #include <ahci.h>
+#include <env.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
diff --git a/board/laird/wb50n/wb50n.c b/board/laird/wb50n/wb50n.c
index 89d3795857..a2f8eaf0ba 100644
--- a/board/laird/wb50n/wb50n.c
+++ b/board/laird/wb50n/wb50n.c
@@ -11,6 +11,7 @@
 #include <asm/arch/at91_rstc.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/clk.h>
+#include <env.h>
 #include <micrel.h>
 #include <net.h>
 #include <netdev.h>
diff --git a/board/lg/sniper/sniper.c b/board/lg/sniper/sniper.c
index a7de4c2167..b4205d6ed4 100644
--- a/board/lg/sniper/sniper.c
+++ b/board/lg/sniper/sniper.c
@@ -8,6 +8,7 @@
 #include <config.h>
 #include <common.h>
 #include <dm.h>
+#include <env.h>
 #include <linux/ctype.h>
 #include <linux/usb/musb.h>
 #include <asm/omap_musb.h>
diff --git a/board/liebherr/display5/display5.c b/board/liebherr/display5/display5.c
index 6b7ff0acb6..4dcd52625f 100644
--- a/board/liebherr/display5/display5.c
+++ b/board/liebherr/display5/display5.c
@@ -13,6 +13,7 @@
 #include <asm/arch/mx6-pins.h>
 #include <asm/arch/mx6-ddr.h>
 #include <asm/arch/sys_proto.h>
+#include <env.h>
 #include <errno.h>
 #include <asm/gpio.h>
 #include <malloc.h>
diff --git a/board/logicpd/imx6/imx6logic.c b/board/logicpd/imx6/imx6logic.c
index e48b3beb16..3dbea3a98a 100644
--- a/board/logicpd/imx6/imx6logic.c
+++ b/board/logicpd/imx6/imx6logic.c
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <miiphy.h>
 #include <input.h>
 #include <mmc.h>
diff --git a/board/logicpd/zoom1/zoom1.c b/board/logicpd/zoom1/zoom1.c
index 5e32077d64..54716125f3 100644
--- a/board/logicpd/zoom1/zoom1.c
+++ b/board/logicpd/zoom1/zoom1.c
@@ -15,6 +15,7 @@
  */
 #include <common.h>
 #include <dm.h>
+#include <env.h>
 #include <environment.h>
 #include <ns16550.h>
 #include <netdev.h>
diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c
index 76f6ede38c..71ca79deab 100644
--- a/board/nokia/rx51/rx51.c
+++ b/board/nokia/rx51/rx51.c
@@ -22,6 +22,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <watchdog.h>
 #include <malloc.h>
 #include <twl4030.h>
diff --git a/board/overo/overo.c b/board/overo/overo.c
index 8fa41f8155..f13bff1871 100644
--- a/board/overo/overo.c
+++ b/board/overo/overo.c
@@ -13,6 +13,7 @@
  */
 #include <common.h>
 #include <dm.h>
+#include <env.h>
 #include <ns16550.h>
 #include <netdev.h>
 #include <twl4030.h>
diff --git a/board/phytec/pcm051/board.c b/board/phytec/pcm051/board.c
index e720fdc0d9..0cb85e940c 100644
--- a/board/phytec/pcm051/board.c
+++ b/board/phytec/pcm051/board.c
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <environment.h>
 #include <errno.h>
 #include <spl.h>
diff --git a/board/phytec/pcm052/pcm052.c b/board/phytec/pcm052/pcm052.c
index c30df5df9d..dffd03786d 100644
--- a/board/phytec/pcm052/pcm052.c
+++ b/board/phytec/pcm052/pcm052.c
@@ -13,6 +13,7 @@
 #include <asm/arch/ddrmc-vf610.h>
 #include <asm/arch/crm_regs.h>
 #include <asm/arch/clock.h>
+#include <env.h>
 #include <led.h>
 #include <environment.h>
 #include <miiphy.h>
diff --git a/board/phytec/pfla02/pfla02.c b/board/phytec/pfla02/pfla02.c
index 753cf2b87d..ae9ffe0390 100644
--- a/board/phytec/pfla02/pfla02.c
+++ b/board/phytec/pfla02/pfla02.c
@@ -15,6 +15,7 @@
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/mach-imx/mxc_i2c.h>
 #include <asm/mach-imx/spi.h>
+#include <env.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <mmc.h>
diff --git a/board/phytec/phycore_rk3288/phycore-rk3288.c b/board/phytec/phycore_rk3288/phycore-rk3288.c
index ffe1833b06..0a341e717f 100644
--- a/board/phytec/phycore_rk3288/phycore-rk3288.c
+++ b/board/phytec/phycore_rk3288/phycore-rk3288.c
@@ -7,6 +7,7 @@
 #include <asm/io.h>
 #include <common.h>
 #include <dm.h>
+#include <env.h>
 #include <environment.h>
 #include <i2c.h>
 #include <i2c_eeprom.h>
diff --git a/board/qualcomm/dragonboard410c/dragonboard410c.c b/board/qualcomm/dragonboard410c/dragonboard410c.c
index 9ceed3ad9b..06d3d7e0f8 100644
--- a/board/qualcomm/dragonboard410c/dragonboard410c.c
+++ b/board/qualcomm/dragonboard410c/dragonboard410c.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <env.h>
 #include <usb.h>
 #include <asm/gpio.h>
 #include <fdt_support.h>
diff --git a/board/qualcomm/dragonboard820c/dragonboard820c.c b/board/qualcomm/dragonboard820c/dragonboard820c.c
index ff6903523d..7a889646df 100644
--- a/board/qualcomm/dragonboard820c/dragonboard820c.c
+++ b/board/qualcomm/dragonboard820c/dragonboard820c.c
@@ -6,6 +6,7 @@
  */
 
 #include <asm/arch/sysmap-apq8096.h>
+#include <env.h>
 #include <linux/arm-smccc.h>
 #include <linux/psci.h>
 #include <common.h>
diff --git a/board/renesas/blanche/blanche.c b/board/renesas/blanche/blanche.c
index f5ada6e288..898abfbd85 100644
--- a/board/renesas/blanche/blanche.c
+++ b/board/renesas/blanche/blanche.c
@@ -18,6 +18,7 @@
 #include <asm/processor.h>
 #include <dm.h>
 #include <dm/platform_data/serial_sh.h>
+#include <env.h>
 #include <environment.h>
 #include <i2c.h>
 #include <linux/errno.h>
diff --git a/board/renesas/sh7752evb/sh7752evb.c b/board/renesas/sh7752evb/sh7752evb.c
index da33a0bd8a..b14ce263f7 100644
--- a/board/renesas/sh7752evb/sh7752evb.c
+++ b/board/renesas/sh7752evb/sh7752evb.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <environment.h>
 #include <malloc.h>
 #include <asm/processor.h>
diff --git a/board/renesas/sh7753evb/sh7753evb.c b/board/renesas/sh7753evb/sh7753evb.c
index 5ddddb6571..f643867806 100644
--- a/board/renesas/sh7753evb/sh7753evb.c
+++ b/board/renesas/sh7753evb/sh7753evb.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <environment.h>
 #include <malloc.h>
 #include <asm/processor.h>
diff --git a/board/renesas/sh7757lcr/sh7757lcr.c b/board/renesas/sh7757lcr/sh7757lcr.c
index 3222701ad2..2d32440aeb 100644
--- a/board/renesas/sh7757lcr/sh7757lcr.c
+++ b/board/renesas/sh7757lcr/sh7757lcr.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <environment.h>
 #include <malloc.h>
 #include <asm/processor.h>
diff --git a/board/rockchip/tinker_rk3288/tinker-rk3288.c b/board/rockchip/tinker_rk3288/tinker-rk3288.c
index 44f13183a5..de9f1e4a8c 100644
--- a/board/rockchip/tinker_rk3288/tinker-rk3288.c
+++ b/board/rockchip/tinker_rk3288/tinker-rk3288.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <env.h>
 #include <environment.h>
 #include <i2c_eeprom.h>
 #include <netdev.h>
diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index 53cd1b2907..3ef1e79980 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <lcd.h>
 #include <libtizen.h>
 #include <samsung/misc.h>
diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index e0846bcb5b..ec85f707c1 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <lcd.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
index f8281f209a..ed9c5b50d9 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <spi.h>
 #include <lcd.h>
 #include <asm/io.h>
diff --git a/board/samtec/vining_fpga/socfpga.c b/board/samtec/vining_fpga/socfpga.c
index efc8ddf162..63ce4a20b5 100644
--- a/board/samtec/vining_fpga/socfpga.c
+++ b/board/samtec/vining_fpga/socfpga.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <environment.h>
 #include <asm/arch/reset_manager.h>
 #include <asm/io.h>
diff --git a/board/siemens/common/factoryset.c b/board/siemens/common/factoryset.c
index 96615424f6..cd224a8e1c 100644
--- a/board/siemens/common/factoryset.c
+++ b/board/siemens/common/factoryset.c
@@ -8,6 +8,7 @@
 #if !defined(CONFIG_SPL_BUILD)
 
 #include <common.h>
+#include <env.h>
 #include <environment.h>
 #include <i2c.h>
 #include <asm/io.h>
diff --git a/board/siemens/draco/board.c b/board/siemens/draco/board.c
index 95b89dac0e..a6840b895b 100644
--- a/board/siemens/draco/board.c
+++ b/board/siemens/draco/board.c
@@ -13,6 +13,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <errno.h>
 #include <spl.h>
 #include <asm/arch/cpu.h>
diff --git a/board/siemens/pxm2/board.c b/board/siemens/pxm2/board.c
index 1b9e83e248..0a82a5ef5c 100644
--- a/board/siemens/pxm2/board.c
+++ b/board/siemens/pxm2/board.c
@@ -13,6 +13,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <environment.h>
 #include <errno.h>
 #include <spl.h>
diff --git a/board/siemens/rut/board.c b/board/siemens/rut/board.c
index 25e2ed22a6..539ecef22c 100644
--- a/board/siemens/rut/board.c
+++ b/board/siemens/rut/board.c
@@ -11,6 +11,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <errno.h>
 #include <spi.h>
 #include <spl.h>
diff --git a/board/siemens/taurus/taurus.c b/board/siemens/taurus/taurus.c
index 6ea97eb4e8..d0efb67bbc 100644
--- a/board/siemens/taurus/taurus.c
+++ b/board/siemens/taurus/taurus.c
@@ -14,6 +14,7 @@
 #include <command.h>
 #include <common.h>
 #include <dm.h>
+#include <env.h>
 #include <environment.h>
 #include <asm/io.h>
 #include <asm/arch/at91sam9260_matrix.h>
diff --git a/board/silica/pengwyn/board.c b/board/silica/pengwyn/board.c
index 90ea8c601c..dc10b76160 100644
--- a/board/silica/pengwyn/board.c
+++ b/board/silica/pengwyn/board.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <environment.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/hardware.h>
diff --git a/board/softing/vining_2000/vining_2000.c b/board/softing/vining_2000/vining_2000.c
index 533280130e..d1df8fc0cc 100644
--- a/board/softing/vining_2000/vining_2000.c
+++ b/board/softing/vining_2000/vining_2000.c
@@ -16,6 +16,7 @@
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/io.h>
 #include <asm/mach-imx/mxc_i2c.h>
+#include <env.h>
 #include <linux/sizes.h>
 #include <common.h>
 #include <environment.h>
diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c
index d333ccc446..f82fb0786a 100644
--- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
+++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
@@ -18,6 +18,7 @@
 #include <asm/arch/iomux.h>
 #include <asm/arch/mx6-pins.h>
 #include <asm/arch/mxc_hdmi.h>
+#include <env.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/mach-imx/iomux-v3.h>
diff --git a/board/technologic/ts4800/ts4800.c b/board/technologic/ts4800/ts4800.c
index 927a19d05a..38d3a3de26 100644
--- a/board/technologic/ts4800/ts4800.c
+++ b/board/technologic/ts4800/ts4800.c
@@ -11,6 +11,7 @@
 #include <asm/gpio.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux-mx51.h>
+#include <env.h>
 #include <linux/errno.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/crm_regs.h>
diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
index 251cd2d566..49d7979ec1 100644
--- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c
+++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <env.h>
 #include <environment.h>
 #include <misc.h>
 #include <spl.h>
diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c
index d29a22cf05..756b516aa6 100644
--- a/board/ti/am43xx/board.c
+++ b/board/ti/am43xx/board.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <environment.h>
 #include <i2c.h>
 #include <linux/errno.h>
diff --git a/board/ti/am65x/evm.c b/board/ti/am65x/evm.c
index 7bd8c4fa66..e01adcd642 100644
--- a/board/ti/am65x/evm.c
+++ b/board/ti/am65x/evm.c
@@ -14,6 +14,7 @@
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <asm/omap_common.h>
+#include <env.h>
 #include <spl.h>
 #include <asm/arch/sys_proto.h>
 
diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c
index 91e0a4c026..0138fc91fc 100644
--- a/board/ti/beagle/beagle.c
+++ b/board/ti/beagle/beagle.c
@@ -14,6 +14,7 @@
  */
 #include <common.h>
 #include <dm.h>
+#include <env.h>
 #include <ns16550.h>
 #ifdef CONFIG_LED_STATUS
 #include <status_led.h>
diff --git a/board/ti/common/board_detect.c b/board/ti/common/board_detect.c
index 32fa10599e..bc89cc57bd 100644
--- a/board/ti/common/board_detect.c
+++ b/board/ti/common/board_detect.c
@@ -11,6 +11,7 @@
 #include <asm/arch/hardware.h>
 #include <asm/omap_common.h>
 #include <dm/uclass.h>
+#include <env.h>
 #include <i2c.h>
 
 #include "board_detect.h"
diff --git a/board/ti/evm/evm.c b/board/ti/evm/evm.c
index 93408047b2..d0b9bafbd1 100644
--- a/board/ti/evm/evm.c
+++ b/board/ti/evm/evm.c
@@ -12,6 +12,7 @@
  */
 #include <common.h>
 #include <dm.h>
+#include <env.h>
 #include <ns16550.h>
 #include <netdev.h>
 #include <asm/io.h>
diff --git a/board/ti/panda/panda.c b/board/ti/panda/panda.c
index f88aa4dfc6..20199da390 100644
--- a/board/ti/panda/panda.c
+++ b/board/ti/panda/panda.c
@@ -11,6 +11,7 @@
 #include <asm/arch/clock.h>
 #include <asm/arch/gpio.h>
 #include <asm/gpio.h>
+#include <env.h>
 #include <twl6030.h>
 
 #include "panda_mux_data.h"
diff --git a/board/ti/ti814x/evm.c b/board/ti/ti814x/evm.c
index d8ee51b366..a4c094b6dc 100644
--- a/board/ti/ti814x/evm.c
+++ b/board/ti/ti814x/evm.c
@@ -9,6 +9,7 @@
 
 #include <common.h>
 #include <cpsw.h>
+#include <env.h>
 #include <environment.h>
 #include <errno.h>
 #include <spl.h>
diff --git a/board/ti/ti816x/evm.c b/board/ti/ti816x/evm.c
index 240df8cbe1..de9e91a685 100644
--- a/board/ti/ti816x/evm.c
+++ b/board/ti/ti816x/evm.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <environment.h>
 #include <spl.h>
 #include <asm/cache.h>
diff --git a/board/timll/devkit8000/devkit8000.c b/board/timll/devkit8000/devkit8000.c
index 50b70a501c..f8970b0b6d 100644
--- a/board/timll/devkit8000/devkit8000.c
+++ b/board/timll/devkit8000/devkit8000.c
@@ -17,6 +17,7 @@
  */
 #include <common.h>
 #include <dm.h>
+#include <env.h>
 #include <environment.h>
 #include <ns16550.h>
 #include <twl4030.h>
diff --git a/board/toradex/apalis-imx8/apalis-imx8.c b/board/toradex/apalis-imx8/apalis-imx8.c
index f516e546a8..135cf0c237 100644
--- a/board/toradex/apalis-imx8/apalis-imx8.c
+++ b/board/toradex/apalis-imx8/apalis-imx8.c
@@ -12,6 +12,7 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
+#include <env.h>
 #include <environment.h>
 #include <errno.h>
 #include <linux/libfdt.h>
diff --git a/board/toradex/apalis_imx6/apalis_imx6.c b/board/toradex/apalis_imx6/apalis_imx6.c
index 341735153b..89f1b728fd 100644
--- a/board/toradex/apalis_imx6/apalis_imx6.c
+++ b/board/toradex/apalis_imx6/apalis_imx6.c
@@ -26,6 +26,7 @@
 #include <dm/device-internal.h>
 #include <dm/platform_data/serial_mxc.h>
 #include <dwc_ahsata.h>
+#include <env.h>
 #include <environment.h>
 #include <fsl_esdhc_imx.h>
 #include <imx_thermal.h>
diff --git a/board/toradex/colibri-imx6ull/colibri-imx6ull.c b/board/toradex/colibri-imx6ull/colibri-imx6ull.c
index 21addaf6ed..d1ae463941 100644
--- a/board/toradex/colibri-imx6ull/colibri-imx6ull.c
+++ b/board/toradex/colibri-imx6ull/colibri-imx6ull.c
@@ -17,6 +17,7 @@
 #include <asm/io.h>
 #include <dm.h>
 #include <dm/platform_data/serial_mxc.h>
+#include <env.h>
 #include <fdt_support.h>
 #include <imx_thermal.h>
 #include <jffs2/load_kernel.h>
diff --git a/board/toradex/colibri-imx8x/colibri-imx8x.c b/board/toradex/colibri-imx8x/colibri-imx8x.c
index aa8eaa0ea1..366cfb53d7 100644
--- a/board/toradex/colibri-imx8x/colibri-imx8x.c
+++ b/board/toradex/colibri-imx8x/colibri-imx8x.c
@@ -12,6 +12,7 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
+#include <env.h>
 #include <environment.h>
 #include <errno.h>
 #include <linux/libfdt.h>
diff --git a/board/toradex/colibri_vf/colibri_vf.c b/board/toradex/colibri_vf/colibri_vf.c
index 9d63fbf3bd..3096dab679 100644
--- a/board/toradex/colibri_vf/colibri_vf.c
+++ b/board/toradex/colibri_vf/colibri_vf.c
@@ -15,6 +15,7 @@
 #include <asm/arch/iomux-vf610.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
+#include <env.h>
 #include <fdt_support.h>
 #include <fsl_dcu_fb.h>
 #include <g_dnl.h>
diff --git a/board/toradex/common/tdx-common.c b/board/toradex/common/tdx-common.c
index 2d560cceaf..71642a13ea 100644
--- a/board/toradex/common/tdx-common.c
+++ b/board/toradex/common/tdx-common.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <environment.h>
 #include <g_dnl.h>
 #include <linux/libfdt.h>
diff --git a/board/tqc/tqma6/tqma6.c b/board/tqc/tqma6/tqma6.c
index 5f0c7aace3..5b20afd488 100644
--- a/board/tqc/tqma6/tqma6.c
+++ b/board/tqc/tqma6/tqma6.c
@@ -12,6 +12,7 @@
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/sys_proto.h>
+#include <env.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
diff --git a/board/udoo/neo/neo.c b/board/udoo/neo/neo.c
index d51f648178..5c468a6a97 100644
--- a/board/udoo/neo/neo.c
+++ b/board/udoo/neo/neo.c
@@ -15,6 +15,7 @@
 #include <asm/arch/mx6-pins.h>
 #include <asm/gpio.h>
 #include <asm/mach-imx/iomux-v3.h>
+#include <env.h>
 #include <mmc.h>
 #include <fsl_esdhc_imx.h>
 #include <asm/arch/crm_regs.h>
diff --git a/board/udoo/udoo.c b/board/udoo/udoo.c
index c34a5a636b..f2c2bf47b0 100644
--- a/board/udoo/udoo.c
+++ b/board/udoo/udoo.c
@@ -8,6 +8,7 @@
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
+#include <env.h>
 #include <malloc.h>
 #include <asm/arch/mx6-pins.h>
 #include <linux/errno.h>
diff --git a/board/varisys/common/sys_eeprom.c b/board/varisys/common/sys_eeprom.c
index dea9af9b5d..77772a6923 100644
--- a/board/varisys/common/sys_eeprom.c
+++ b/board/varisys/common/sys_eeprom.c
@@ -12,6 +12,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <env.h>
 #include <i2c.h>
 #include <linux/ctype.h>
 
diff --git a/board/vscom/baltos/board.c b/board/vscom/baltos/board.c
index c5949ad267..5f5a51bfbf 100644
--- a/board/vscom/baltos/board.c
+++ b/board/vscom/baltos/board.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <errno.h>
 #include <linux/libfdt.h>
 #include <spl.h>
diff --git a/board/wandboard/wandboard.c b/board/wandboard/wandboard.c
index 74d7a17028..69cdf3e9c9 100644
--- a/board/wandboard/wandboard.c
+++ b/board/wandboard/wandboard.c
@@ -20,6 +20,7 @@
 #include <asm/mach-imx/video.h>
 #include <asm/mach-imx/sata.h>
 #include <asm/io.h>
+#include <env.h>
 #include <linux/sizes.h>
 #include <common.h>
 #include <miiphy.h>
diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c
index 6857f2c0b8..35191b2f81 100644
--- a/board/xilinx/zynq/board.c
+++ b/board/xilinx/zynq/board.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm/uclass.h>
+#include <env.h>
 #include <fdtdec.h>
 #include <fpga.h>
 #include <malloc.h>
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index c840e92d9c..dafb079a4b 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <sata.h>
 #include <ahci.h>
 #include <scsi.h>
diff --git a/cmd/avb.c b/cmd/avb.c
index c5af4a2e46..7054601f85 100644
--- a/cmd/avb.c
+++ b/cmd/avb.c
@@ -7,6 +7,7 @@
 
 #include <avb_verify.h>
 #include <command.h>
+#include <env.h>
 #include <image.h>
 #include <malloc.h>
 #include <mmc.h>
diff --git a/cmd/binop.c b/cmd/binop.c
index 116a2c0d55..6d2df5f3dd 100644
--- a/cmd/binop.c
+++ b/cmd/binop.c
@@ -2,6 +2,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <env.h>
 #include <hexdump.h>
 #include <malloc.h>
 #include <mapmem.h>
diff --git a/cmd/dtimg.c b/cmd/dtimg.c
index ae7d82f26d..6c5d53cc68 100644
--- a/cmd/dtimg.c
+++ b/cmd/dtimg.c
@@ -4,6 +4,7 @@
  * Sam Protsenko <semen.protsenko@linaro.org>
  */
 
+#include <env.h>
 #include <image-android-dt.h>
 #include <common.h>
 
diff --git a/cmd/gpt.c b/cmd/gpt.c
index 33cda51396..0c4349f4b2 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -11,6 +11,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <malloc.h>
 #include <command.h>
 #include <part_efi.h>
diff --git a/cmd/ini.c b/cmd/ini.c
index 8c28fa6394..f4faa7cae1 100644
--- a/cmd/ini.c
+++ b/cmd/ini.c
@@ -13,6 +13,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <env.h>
 #include <environment.h>
 #include <linux/ctype.h>
 #include <linux/string.h>
diff --git a/cmd/md5sum.c b/cmd/md5sum.c
index 9d2d4180c5..63cbae0364 100644
--- a/cmd/md5sum.c
+++ b/cmd/md5sum.c
@@ -9,6 +9,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <env.h>
 #include <mapmem.h>
 #include <u-boot/md5.h>
 #include <asm/io.h>
diff --git a/cmd/net.c b/cmd/net.c
index 89721b8f8b..237403977e 100644
--- a/cmd/net.c
+++ b/cmd/net.c
@@ -9,6 +9,7 @@
  */
 #include <common.h>
 #include <command.h>
+#include <env.h>
 #include <net.h>
 
 static int netboot_common(enum proto_t, cmd_tbl_t *, int, char * const []);
diff --git a/cmd/nvedit_efi.c b/cmd/nvedit_efi.c
index 60a8ac84c8..ed6d09a530 100644
--- a/cmd/nvedit_efi.c
+++ b/cmd/nvedit_efi.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <command.h>
 #include <efi_loader.h>
+#include <env.h>
 #include <exports.h>
 #include <hexdump.h>
 #include <malloc.h>
diff --git a/cmd/part.c b/cmd/part.c
index 653e13ced1..6cfb67b279 100644
--- a/cmd/part.c
+++ b/cmd/part.c
@@ -18,6 +18,7 @@
 #include <common.h>
 #include <config.h>
 #include <command.h>
+#include <env.h>
 #include <part.h>
 #include <vsprintf.h>
 
diff --git a/cmd/pxe.c b/cmd/pxe.c
index 1dd0a74ea3..2059975446 100644
--- a/cmd/pxe.c
+++ b/cmd/pxe.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <env.h>
 #include <malloc.h>
 #include <mapmem.h>
 #include <lcd.h>
diff --git a/cmd/qfw.c b/cmd/qfw.c
index 7bf700538c..af826627a2 100644
--- a/cmd/qfw.c
+++ b/cmd/qfw.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <env.h>
 #include <errno.h>
 #include <qfw.h>
 
diff --git a/common/cli_hush.c b/common/cli_hush.c
index 955e8fe536..8f86e4aa4a 100644
--- a/common/cli_hush.c
+++ b/common/cli_hush.c
@@ -75,6 +75,7 @@
 
 #define __U_BOOT__
 #ifdef __U_BOOT__
+#include <env.h>
 #include <malloc.h>         /* malloc, free, realloc*/
 #include <linux/ctype.h>    /* isalpha, isdigit */
 #include <common.h>        /* readline */
diff --git a/common/console.c b/common/console.c
index 0b0dd76256..4c5f7d8f1f 100644
--- a/common/console.c
+++ b/common/console.c
@@ -8,6 +8,7 @@
 #include <console.h>
 #include <debug_uart.h>
 #include <dm.h>
+#include <env.h>
 #include <stdarg.h>
 #include <iomux.h>
 #include <malloc.h>
diff --git a/common/hash.c b/common/hash.c
index 413a5bfcda..d33e329897 100644
--- a/common/hash.c
+++ b/common/hash.c
@@ -12,6 +12,7 @@
 #ifndef USE_HOSTCC
 #include <common.h>
 #include <command.h>
+#include <env.h>
 #include <malloc.h>
 #include <mapmem.h>
 #include <hw_sha.h>
diff --git a/common/hwconfig.c b/common/hwconfig.c
index e9e956a322..72f3c4e0fa 100644
--- a/common/hwconfig.c
+++ b/common/hwconfig.c
@@ -11,6 +11,7 @@
 #ifndef HWCONFIG_TEST
 #include <config.h>
 #include <common.h>
+#include <env.h>
 #include <exports.h>
 #include <hwconfig.h>
 #include <linux/types.h>
diff --git a/common/image-android.c b/common/image-android.c
index 6c9568a655..264bf90007 100644
--- a/common/image-android.c
+++ b/common/image-android.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <image.h>
 #include <android_image.h>
 #include <malloc.h>
diff --git a/common/main.c b/common/main.c
index 07b34bf2b0..02ecd71f88 100644
--- a/common/main.c
+++ b/common/main.c
@@ -10,6 +10,7 @@
 #include <autoboot.h>
 #include <cli.h>
 #include <console.h>
+#include <env.h>
 #include <version.h>
 
 /*
diff --git a/common/spl/spl_dfu.c b/common/spl/spl_dfu.c
index c0225dc4e1..a05b867567 100644
--- a/common/spl/spl_dfu.c
+++ b/common/spl/spl_dfu.c
@@ -6,6 +6,7 @@
  * Ravi B <ravibabu@ti.com>
  */
 #include <common.h>
+#include <env.h>
 #include <spl.h>
 #include <linux/compiler.h>
 #include <errno.h>
diff --git a/common/update.c b/common/update.c
index f237ea53bb..457b29f42a 100644
--- a/common/update.c
+++ b/common/update.c
@@ -17,6 +17,7 @@
 #endif
 
 #include <command.h>
+#include <env.h>
 #include <flash.h>
 #include <net.h>
 #include <net/tftp.h>
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index d7c080943a..9fb3ac9ccd 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -9,6 +9,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <env.h>
 #include <environment.h>
 #include <malloc.h>
 #include <memalign.h>
diff --git a/drivers/net/lan91c96.c b/drivers/net/lan91c96.c
index f2489aaf82..c08bd21f95 100644
--- a/drivers/net/lan91c96.c
+++ b/drivers/net/lan91c96.c
@@ -46,6 +46,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <env.h>
 #include <malloc.h>
 #include "lan91c96.h"
 #include <net.h>
diff --git a/drivers/net/ne2000_base.c b/drivers/net/ne2000_base.c
index 421aa20ea6..3bc7a35086 100644
--- a/drivers/net/ne2000_base.c
+++ b/drivers/net/ne2000_base.c
@@ -74,6 +74,7 @@ Add SNMP
 
 #include <common.h>
 #include <command.h>
+#include <env.h>
 #include <environment.h>
 #include <net.h>
 #include <malloc.h>
diff --git a/drivers/net/sandbox-raw.c b/drivers/net/sandbox-raw.c
index 7e6625d020..3707ee35eb 100644
--- a/drivers/net/sandbox-raw.c
+++ b/drivers/net/sandbox-raw.c
@@ -9,6 +9,7 @@
 #include <asm/eth-raw-os.h>
 #include <common.h>
 #include <dm.h>
+#include <env.h>
 #include <malloc.h>
 #include <net.h>
 
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 0b5a1a4796..fa49d3126f 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -9,6 +9,7 @@
 
 #include <common.h>
 #include <console.h>
+#include <env.h>
 #include <environment.h>
 #include <linux/errno.h>
 #include <linux/netdevice.h>
diff --git a/env/flags.c b/env/flags.c
index 79dccc05fe..7277711594 100644
--- a/env/flags.c
+++ b/env/flags.c
@@ -4,6 +4,7 @@
  * Joe Hershberger, National Instruments, joe.hershberger@ni.com
  */
 
+#include <env.h>
 #include <linux/string.h>
 #include <linux/ctype.h>
 
diff --git a/examples/api/demo.c b/examples/api/demo.c
index e177bf17eb..e7523786b4 100644
--- a/examples/api/demo.c
+++ b/examples/api/demo.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <linux/types.h>
 #include <api_public.h>
 
diff --git a/include/command.h b/include/command.h
index 2bfee89df3..f6170e7151 100644
--- a/include/command.h
+++ b/include/command.h
@@ -10,6 +10,7 @@
 #ifndef __COMMAND_H
 #define __COMMAND_H
 
+#include <env.h>
 #include <linker_lists.h>
 
 #ifndef NULL
diff --git a/include/common.h b/include/common.h
index 8d8bbc4da3..739bbd400a 100644
--- a/include/common.h
+++ b/include/common.h
@@ -157,18 +157,6 @@ int do_ext2load(cmd_tbl_t *, int, int, char * const []);
  */
 char *env_get(const char *varname);
 
-/**
- * env_set() - set an environment variable
- *
- * This sets or deletes the value of an environment variable. For setting the
- * value the variable is created if it does not already exist.
- *
- * @varname: Variable to adjust
- * @value: Value to set for the variable, or NULL or "" to delete the variable
- * @return 0 if OK, 1 on error
- */
-int env_set(const char *varname, const char *value);
-
 void	pci_init_board(void);
 
 /* common/exports.c */
diff --git a/include/env.h b/include/env.h
index dd063feb39..6770a6176d 100644
--- a/include/env.h
+++ b/include/env.h
@@ -71,6 +71,18 @@ int env_get_f(const char *name, char *buf, unsigned int len);
  */
 int env_get_yesno(const char *var);
 
+/**
+ * env_set() - set an environment variable
+ *
+ * This sets or deletes the value of an environment variable. For setting the
+ * value the variable is created if it does not already exist.
+ *
+ * @varname: Variable to adjust
+ * @value: Value to set for the variable, or NULL or "" to delete the variable
+ * @return 0 if OK, 1 on error
+ */
+int env_set(const char *varname, const char *value);
+
 /**
  * env_get_ulong() - Return an environment variable as an integer value
  *
diff --git a/include/env_flags.h b/include/env_flags.h
index 23744e395c..f2306436b4 100644
--- a/include/env_flags.h
+++ b/include/env_flags.h
@@ -146,6 +146,7 @@ int env_flags_validate_env_set_params(char *name, char *const val[], int count);
 
 #else /* !USE_HOSTCC */
 
+#include <env.h>
 #include <search.h>
 
 /*
diff --git a/include/exports.h b/include/exports.h
index a4b862f191..0b80a67be3 100644
--- a/include/exports.h
+++ b/include/exports.h
@@ -3,6 +3,7 @@
 
 #ifndef __ASSEMBLY__
 #ifdef CONFIG_PHY_AQUANTIA
+#include <env.h>
 #include <phy_interface.h>
 #endif
 
diff --git a/include/net.h b/include/net.h
index 7684076af6..0262175c81 100644
--- a/include/net.h
+++ b/include/net.h
@@ -14,6 +14,7 @@
 
 #include <asm/cache.h>
 #include <asm/byteorder.h>	/* for nton* / ntoh* stuff */
+#include <env.h>
 #include <linux/if_ether.h>
 
 #define DEBUG_LL_STATE 0	/* Link local state machine changes */
diff --git a/include/search.h b/include/search.h
index 5d07b49073..9750336b5e 100644
--- a/include/search.h
+++ b/include/search.h
@@ -14,6 +14,7 @@
 #ifndef _SEARCH_H_
 #define _SEARCH_H_
 
+#include <env.h>
 #include <stddef.h>
 
 #define __set_errno(val) do { errno = val; } while (0)
diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
index 889a7f2ba0..8a0e0db13e 100644
--- a/lib/efi_loader/efi_variable.c
+++ b/lib/efi_loader/efi_variable.c
@@ -5,6 +5,7 @@
  *  Copyright (c) 2017 Rob Clark
  */
 
+#include <env.h>
 #include <malloc.h>
 #include <charset.h>
 #include <efi_loader.h>
diff --git a/lib/uuid.c b/lib/uuid.c
index 7d7a2749b6..527868c753 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <linux/ctype.h>
 #include <errno.h>
 #include <common.h>
diff --git a/net/dns.c b/net/dns.c
index eee8a02f7c..67d761d7c0 100644
--- a/net/dns.c
+++ b/net/dns.c
@@ -24,6 +24,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <env.h>
 #include <net.h>
 #include <asm/unaligned.h>
 
diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index 031d558625..4e4f472431 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <env.h>
 #include <environment.h>
 #include <net.h>
 #include <dm/device-internal.h>
diff --git a/net/eth_legacy.c b/net/eth_legacy.c
index e250a430f3..0f558b23ce 100644
--- a/net/eth_legacy.c
+++ b/net/eth_legacy.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <env.h>
 #include <environment.h>
 #include <net.h>
 #include <phy.h>
diff --git a/net/wol.c b/net/wol.c
index 946bd91b47..51543343e4 100644
--- a/net/wol.c
+++ b/net/wol.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <env.h>
 #include <net.h>
 #include <environment.h>
 #include "wol.h"
diff --git a/test/dm/eth.c b/test/dm/eth.c
index 6e002b8dce..ad5354b4bf 100644
--- a/test/dm/eth.c
+++ b/test/dm/eth.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <env.h>
 #include <fdtdec.h>
 #include <malloc.h>
 #include <net.h>
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index eef12dd2b7..f06252d916 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -10,6 +10,7 @@
 #define _GNU_SOURCE
 
 #include <compiler.h>
+#include <env.h>
 #include <errno.h>
 #include <env_flags.h>
 #include <fcntl.h>
diff --git a/tools/env/fw_env.h b/tools/env/fw_env.h
index b250e2f3d7..3d2b457b31 100644
--- a/tools/env/fw_env.h
+++ b/tools/env/fw_env.h
@@ -4,6 +4,7 @@
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  */
 
+#include <env.h>
 #include <stdint.h>
 
 /*
diff --git a/tools/env/fw_env_main.c b/tools/env/fw_env_main.c
index 26ba6624cd..1d193bd437 100644
--- a/tools/env/fw_env_main.c
+++ b/tools/env/fw_env_main.c
@@ -26,6 +26,7 @@
  * of AES key), eg. '-a aabbccddeeff00112233445566778899'.
  */
 
+#include <env.h>
 #include <fcntl.h>
 #include <getopt.h>
 #include <stdio.h>
