I am setting my default environment in the board header file. Especially the mmcroot, but it is not loaded at boot. When I type env default -a, the default environment is loaded, but even after typing savenv, it is not persistent until next boot. There is no boot script that sets the mmcroot and I have searched through the whole U-Boot code. Could it be that the environment is saved somewhere on the device? If yes, how can I erase it?
try "mmc erase 0x2000 0x08"
here is the code:
CONFIG_ENV_OFFSET=0x400000
CONFIG_ENV_SIZE=0x1000
uboot-imx\configs\imx8mm_evk_defconfig
CONFIG_SYS_I2C_MXC_I2C3=y
CONFIG_ENV_SIZE=0x1000
CONFIG_ENV_OFFSET=0x400000
CONFIG_DM_GPIO=y
CONFIG_TARGET_IMX8MM_EVK=y
No that didn't have the desired effect.
u-boot=> mmc erase 0x2000 0x20
MMC erase: dev # 1, block # 8192, count 32 ...
Caution! Your devices Erase group is 0x400
The erase range would be change to 0x2000~0x23ff
32 blocks erased: OK
In my board header I have
#define CONFIG_ENV_OFFSET (60 << 20)
#define CONFIG_ENV_SIZE 0x1000
Should I try those instead? Don't want to brick my board.
Hello @jclsn ,
I tested it on i.mx8mm board.
1. saveenv
I changed fdt_file name and save it, no prblem.
2. adding pci=nomsi to default enviroment
include/configs/imx8mm_evk.h
......
"mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
"mmcautodetect=yes\0" \
"mmcargs=setenv bootargs ${jh_clk} console=${console} root=${mmcroot} pci=nomsi\0 " \
......
the modification is valid.
Have a good day!
Regards,
weidong
You said it is different from the NXP BSP.
So you need to use your define.
"In my board header I have
#define CONFIG_ENV_OFFSET (60 << 20)
#define CONFIG_ENV_SIZE 0x1000
"
BTW, why not using NXP BSP ?
When I look at imx8mm_evk.h, I see the exact same values
#define CONFIG_ENV_OVERWRITE
#if defined(CONFIG_ENV_IS_IN_MMC)
#define CONFIG_ENV_OFFSET (64 * SZ_64K)
#elif defined(CONFIG_ENV_IS_IN_SPI_FLASH)
#define CONFIG_ENV_OFFSET (4 * 1024 * 1024)
#define CONFIG_ENV_SECT_SIZE (64 * 1024)
#define CONFIG_ENV_SPI_BUS CONFIG_SF_DEFAULT_BUS
#define CONFIG_ENV_SPI_CS CONFIG_SF_DEFAULT_CS
#define CONFIG_ENV_SPI_MODE CONFIG_SF_DEFAULT_MODE
#define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED
#elif defined(CONFIG_ENV_IS_IN_NAND)
#define CONFIG_ENV_OFFSET (60 << 20)
#endif
#define CONFIG_ENV_SIZE 0x1000
#define CONFIG_SYS_MMC_ENV_DEV 0 /* USDHC2 */
#define CONFIG_MMCROOT "/dev/mmcblk1p2" /* USDHC2 */
Ours is called gpv_imx8mm.h. Not sure if this is a different BSP or just our modified version of the imx8mm_evk.h.
What I posted earlier was wrong. It is surrounded in that #ifdef defined(CONFIG_EVN_IS_IN_NAND) as well. We have nothing specific set there, so I am assuming that the default is CONFIG_ENV_IS_IN_MMC
It says #elif defined(CONFIG_ENV_IS_IN_NAND)
#define CONFIG_ENV_OFFSET (60 << 20)
imx8mm_evk.h\configs\include - uboot-imx - i.MX U-Boot (codeaurora.org)
And I am very sure for it. I change the size because it is not enough for my project.
And I use the command
mmc erase 0x2000 0x10 to erase the environment during the test.
You can read my
SWUpdate OTA i.MX8MM EVK / i.MX8QXP MEK
https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/SWUpdate-OTA-i-MX8MM-EVK-i-MX8QXP-MEK/ta...
2000-u-boot-append-emmc-L5.4.70-2.3.0.patch
+--- u-boot/configs/imx8mm_evk_defconfig.orig 2021-06-18 12:28:14.278961177 +0800
++++ u-boot/configs/imx8mm_evk_defconfig 2021-06-18 12:29:23.779361965 +0800
+@@ -10,14 +10,17 @@ CONFIG_SYS_MALLOC_F_LEN=0x2000
+ CONFIG_SYS_I2C_MXC_I2C1=y
+ CONFIG_SYS_I2C_MXC_I2C2=y
+ CONFIG_SYS_I2C_MXC_I2C3=y
+-CONFIG_ENV_SIZE=0x1000
++CONFIG_ENV_SIZE=0x2000
+ CONFIG_ENV_OFFSET=0x400000
++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
++CONFIG_ENV_OFFSET_REDUND=0x402000
+ CONFIG_DM_GPIO=y
BTW, it is patch's patch for yocto.