diff options
author | Stefan Agner <stefan.agner@toradex.com> | 2016-09-20 18:15:35 -0700 |
---|---|---|
committer | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2016-09-29 06:10:21 +0200 |
commit | 5330bd8f569afffe978350ee15ba84599af3632d (patch) | |
tree | 9b56fb2b00a4180920df0ed8544c2b083a049736 /board | |
parent | cedd8fa2920779e7fd9fbb1b43d0597f5a965b08 (diff) |
toradex: common: add common code which avoids loading environment
Add common code for i.MX SoC's which avoids loading the environment.
This reimplements the functionaltiy lost with ("common: autoboot:
do not reset environment") by not loading the environment from the
beginning. The main difference will be that dynamically set
environment variables such as "soc" in the i.MX 7 case will still
be set.
Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Diffstat (limited to 'board')
-rw-r--r-- | board/toradex/common/common-imx.c | 20 | ||||
-rw-r--r-- | board/toradex/common/common.mk | 3 |
2 files changed, 23 insertions, 0 deletions
diff --git a/board/toradex/common/common-imx.c b/board/toradex/common/common-imx.c new file mode 100644 index 00000000000..0fa3402eed2 --- /dev/null +++ b/board/toradex/common/common-imx.c @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2016 Toradex, Inc. + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <asm/arch/imx-regs.h> +#include <asm/io.h> +#include <common.h> + +int should_load_env(void) +{ + /* Do not load environment from eMMC/NAND, it could be hostile */ + if (is_boot_from_usb()) { + puts("Serial Downloader mode, not loading environment\n"); + return 0; + } + + return 1; +} diff --git a/board/toradex/common/common.mk b/board/toradex/common/common.mk index 469189a315f..2679dea1691 100644 --- a/board/toradex/common/common.mk +++ b/board/toradex/common/common.mk @@ -5,4 +5,7 @@ obj- := __dummy__.o else obj-$(CONFIG_TRDX_CFG_BLOCK) += ../common/configblock.o obj-y += ../common/common.o +ifeq ($(SOC),$(filter $(SOC),mx6 mx7)) +obj-y += ../common/common-imx.o +endif endif |