Cannot set environment variable in the u-boot

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

Cannot set environment variable in the u-boot

1,897 Views
emb-bharpay
Contributor I

Hello Team,

I am trying to set the environment variable from u-boot but after rebooting the system it is taking the default one.
Following are the details that I am trying to implement.

u-boot

>> setenv mmcroot '/dev/mmcblk0p3 rootwait rw'

>>saveenv

But after rebooting I could not able to boot from /dev/mmcblk0p3, instead, the system is restarting from dev/mmcblk0p2.

Can anyone let me know what is the correct way to set the environment variable in u-boot?

FYI: Using iMX8QM-MEK board.

Thanks in advance.

0 Kudos
7 Replies

1,833 Views
Rita_Wang
NXP TechSupport
NXP TechSupport

Reading the kernel image from eMMC
eMMC has user area, boot partition 1, and boot partition 2. To switch between the eMMC partitions, the user needs to use the
command mmc dev [dev id] [partition id]. For example,
mmc dev 2 0 ---> user area
mmc dev 2 1 ---> boot partition 1
mmc dev 2 2 ---> boot partition 2

0 Kudos

1,886 Views
nikhil_sahu2
Contributor III

 

you can make this entry in your u-boot source code, so whenever it will boot normaly it will use the same patrition, below is the command you can use and under the common/autoboot.c such as  __abortboot(int bootdelay) function.

run_command("setenv mmcroot \"/dev/mmcblk0p3 rootwait rw\"",0);

Thanks,

Nikhil

0 Kudos

1,828 Views
emb-bharpay
Contributor I

Thank you for your reply.

I will try this out.

Regards,

Payal

0 Kudos

1,881 Views
emb-bharpay
Contributor I

Thank you for your reply,

Actually, I want to access the partition during runtime. So as per my need, I have to switch the partition whenever it is required. 

So I wanted to know if it is possible to access the partition from u-boot environment.

0 Kudos

1,834 Views
Rita_Wang
NXP TechSupport
NXP TechSupport

The kernel boot command lines you can set when u-boot boot up. For the emmc boot you need to know which uSDHC or emmc dev are you using in your board. Are you using the iMX8QM-MEK board from NXP?

0 Kudos

1,827 Views
emb-bharpay
Contributor I
Yes, I am using the iMX8QM-MEK board.
u boot >> mmc list
FSL_SDHC: 0 (eMMC)
FSL_SDHC: 1
0 Kudos

1,822 Views
Rita_Wang
NXP TechSupport
NXP TechSupport

The emmc on the The eMMC5.0 on the i.MX 8QuadMax MEK board, i.MX 8QuadXPlus MEK board, and i.MX 8M Quad EVK board are mmcblk0. The i.MX8QuadMax MEK use the eMMC0, so use the mmc dev 0.

0 Kudos