uboot environment variable should be written in which partition on sdcard?

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

uboot environment variable should be written in which partition on sdcard?

1,443 Views
gonewithwind-peter
Senior Contributor I

Hi all 

I am playing rauc ,and need fw_printenv and fw_setenv to switch rootfs 

I put my Qz here:

https://community.nxp.com/t5/i-MX-Processors/I-can-not-build-u-boot-fw-utils-in-yocto-for-maaxboard-...

 

now I can build fw_printenv and fw_setenv in my yocto image.

my sd card partation is like that using file imx-uboot-bootpart.wks

 

uboot image is in from 33k offset to write in sdcard(that is dos)

boot partition is from offset 4M  and size is 16M, ext4, will write kernel image ,dtb and uEnv.txt ...

 

 
# - --------- -------------- --------------
# |.............. | u-boot | boot | rootfs |
# - --------- -------------- --------------
# ^ ^ ^ ^
# |...............|         .. |.        |
# 0............33kiB 4MiB 16MiB + rootfs + IMAGE_EXTRA_SPACE (default 10MiB)
#
part u-boot --source rawcopy --sourceparams="file=imx-boot-imx8mqevk-sd.bin" --ondisk mmcblk0 --no-table --align 33
part /boot --source bootimg-partition --ondisk mmcblk0 --fstype=vfat --label boot --active --align 4096 --size 16
part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --label root_A --align 4096 --overhead-factor 1
part / --source rootfs --ondisk mmcblk --fstype=ext4 --label root_B --align 4096 --overhead-factor 1

,,

I follow the guide here:

https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/Linux-fw-printenv-fw-setenv-to-access-U-...

in the "demo image layout"  page shows it seems the env should be write in boot partition.

but in uboot  config  .h file CONFIG_ENV_OFFSE  0x400000, it seems  the offset is base 0, so the position is from absolute  0x400000,  and it seem it is in uboot partition?

I was confused!

after uboot startup and I push CTL+C to enter it and use saveenv to save the environment variable, but It will demage my  boot partition that kernel image ,dtb... files are in here. so I can not boot  kernel again.

my Question is that   where boot environment should be written in ?  there are  choices: 

 1, the spare space after u-boot image in uboot partition?

2 boot partition?

3. roofs partition?

and  

how to calculation the   CONFIG_ENV_OFFSET  ?  so I can set /etc/fw_env.config correctly.

 

any help?

Thank you very much.

 

,,,

 

fw_env.config default directory is in the /etc/

/dev/mmcblk0 0x400000  0x1000

 

uboot/include/configs/imx8qxp_mek.h

0x2000 : #define CONFIG_ENV_SIZE.  0x2000

 

#define CONFIG_ENV_OFFSET   (64 * SZ_64K)

0 Kudos
Reply
3 Replies

1,417 Views
gonewithwind-peter
Senior Contributor I
0 Kudos
Reply

1,421 Views
gonewithwind-peter
Senior Contributor I

why saveenv command in uboot damage boot partition?
how to set and make sure saveenv can work well with fw_printenv and fw_setenv ?

I tried to set /etc/fw_env.config as 

 /dev/mmcblk1 0x400000  0x2000

or 

 /dev/mmcblk0 0x400000  0x2000

fw_printenv works, but saveenv command in uboot always damage boot partititon?

where is the wrong? how can I do?
Thanks!

0 Kudos
Reply

1,334 Views
AldoG
NXP TechSupport
NXP TechSupport

Hello,

The u-boot environment is always saved to user partition. 
/etc/fw_env.config  should be 
dev/mmcblk2 0x400000 0x1000

Best regards,
Aldo.

0 Kudos
Reply