Access u-boot varibale from linux user space

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

Access u-boot varibale from linux user space

1,801 Views
kartheek
Contributor III

Hi,

Processor: IMX8M PLUS

Yocto : 5.15-kirkstone

While booting through SD card able to access fw_printenv/setenv by adding below line in image recipe of yocto build.

IMAGE_INSTALL += " u-boot-fw-utils"

u-boot configuration is as below.

CONFIG_ENV_SIZE=0x80000
CONFIG_ENV_OFFSET=0x380000
CONFIG_ENV_IS_NOWHERE=y
CONFIG_ENV_IS_IN_MMC=y
CONFIG_SYS_MMC_ENV_DEV=1
CONFIG_SYS_MMC_ENV_PART=0

 

 

 But when executing those commands on target gives below error.

~# fw_printenv
Configuration file wrong or corrupted

 
Kindly suggest a procedure to make fw_printenv/setenv work.

Thanks,
Kartheek

0 Kudos
Reply
6 Replies

1,734 Views
kartheek
Contributor III

Hi,

After configuring fw_env.config in etc folder and running saveenv in U-Boot, I can access U-Boot environment variables from Linux user space.

However, we plan to remove the serial debugger later. In that case, we won’t be able to execute saveenv at the U-Boot prompt. Is there a way to automatically save the environment during the boot process?

Thanks,
Kartheek

0 Kudos
Reply

1,544 Views
vopal
Contributor I

If you carefully read the u-boot documentation, you'll find that u-boot provides a complete solution. During u-boot compilation, `make u-boot-initial-env` generates default u-boot environment variables. `fw_printenv`/`fw_setenv` can use the `-f` parameter on the first run to access this default u-boot environment variable file. This is also the method used by swupate on its first run.

0 Kudos
Reply

1,533 Views
vopal
Contributor I

If I remember correctly, yocto generates a default environment variable file for u-boot by default.

0 Kudos
Reply

1,524 Views
vopal
Contributor I
0 Kudos
Reply

1,684 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hi,

You can define a command in uboot env, then run it in mmcboot(include/configs/<board>.h).


Best Regards,
Zhiming

0 Kudos
Reply