Hi all
I want to solve my Qz here
running uboot 's saveenv damage boot partition and can not boot again on maaxboard
so I have to know that fw_printenv(fw_setenv ) read from (write to ) which partition on sdcard?
I following the guide here: https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/Linux-fw-printenv-fw-setenv-to-access-U-...
I am play rauc , so I add one more addition rootfs. there are following partitions (using lsblck or gparted to show) in my bootable sdcard:
mmcblk0p1 (boot partition, kernel image, dtb uEnv.txt in it) (notes: uboot image is msdos. can not show with lsblk)
mmcblk0p2 (rootfs_A) normally mount at / after bootup
mmcblk0p3 (rootfs_B) I want to switch it using rauc.
condition 1:
I tried first with file: /etc/fw_env.conf
/dev/mmcblk0 0x400000 0x1000
I can successfully run fw_printenv and fw_setenv ,
my Qz 1: at /dev/mmcblk0 , fw_printenv(fw_setenv ) read from (write to ) which partition? mmcblk0p1 ? mmcblk0p2?
condition 2:
I tried secondly with file: /etc/fw_env.conf
/dev/mmcblk0p1 0x400000 0x1000
I can successfully run fw_printenv and fw_setenv and I can set different content environment variable with condition 1. and both condition 1 and 2 can exist same time. if I change the file /etc/fw_env.conf .I can fw_printenv different content that I set before.
my Qz: so I condition 2 the environment variable is in which partition? mmcblk0p1 ? mmcblk0p2? ???
I was confused.
any help ?
Thank you very much.
Please try to dump the contents in the SD card. Check the changes are properly write to the correct offset in the storage.
Hi
@jimmychan
thank you very much for your reply.
I think that is a good idea to dump the contents in the SD card to find the ENV position. but I do not how to dump.
before I tried to write c code to read /dev/mmcblk0 ,but the code not work. and I tried dd , but I did know what the options.
do you have more details to dump the contents in the SD card?
Thank you very much.
I have found the dd command how to dump, thanks
https://imxdev.gitlab.io/tutorial/How_to_dump_the_SDCard_content_to_an_image_file/
I find partial answer
/etc/fw_env.conf
/dev/mmcblk0 0x400000 0x1000 and the fw_printenv will damage the boot partition.
if /dev/mmcblk 0x2904000 0x1000 fw_printenv fw_setenv will work well.
fw_printenv should write to absolute address 0x400000 (0x2904000) from sd card 0 sector
I am searching saveenv in uboot command to write where and calculate how to set .h file in uboot source code.
it seem I set define CONFIG_ENV_OFFSET in .h file in uboot code is not work
#define CONFIG_ENV_OFFSET 0x2904000
it still savenev at 0x400000 (that is default setting for imx) (64 * SZ_64K) in sdcard and just damage the boot partition
it seems my setting is not working and can not change the default setting. but I wrote a wrong syntax to compile the code. it displayed error and I made sure it was compiled.
Let me try again.