Default environment is not loaded on boot on i.MX8 Mini

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Default environment is not loaded on boot on i.MX8 Mini

3,583 Views
jclsn
Contributor IV

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?

Labels (1)
0 Kudos
Reply
12 Replies

3,574 Views
BiyongSUN
NXP Employee
NXP Employee

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

0 Kudos
Reply

3,569 Views
jclsn
Contributor IV

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.

0 Kudos
Reply

3,483 Views
weidong_sun
NXP TechSupport
NXP TechSupport

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

0 Kudos
Reply

3,564 Views
BiyongSUN
NXP Employee
NXP Employee

If you are not using the NXP BSP release, I can not give you right answer. 

 

0 Kudos
Reply

3,559 Views
jclsn
Contributor IV

We are using that, but modified it of course. It should be identical for the most part still.

0 Kudos
Reply

3,556 Views
BiyongSUN
NXP Employee
NXP Employee

doesn't matter.

Use that offset to erase. 

0 Kudos
Reply

3,552 Views
jclsn
Contributor IV

So mmc erase 0x400000 0x1000 ?

0 Kudos
Reply

3,543 Views
BiyongSUN
NXP Employee
NXP Employee

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 ? 

0 Kudos
Reply

3,539 Views
jclsn
Contributor IV

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

 

0 Kudos
Reply

3,530 Views
BiyongSUN
NXP Employee
NXP Employee

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.

0 Kudos
Reply

3,523 Views
jclsn
Contributor IV

Thanks, but it doesn't work for me. Really weird. The wrong mmcroot is loaded every time when I reboot

0 Kudos
Reply

3,495 Views
BiyongSUN
NXP Employee
NXP Employee

The bsp has been  customized.

I  think you'd better to check your own design document.

 

0 Kudos
Reply