- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hi!
What should I do to use fw_printenv/setenv on imx8mm?
【Conditions】
・hardware: imx8mm(on custom board)
・bsp: imx 6.1.55-2.2.0
・base image: core-image-minimal
・IMAGE_INSTALL += "u-boot-fw-utils"
・MACHINE = 'imx8mm-lpddr4-evk'
・boot storage:emmc
【log】
root@XXX:~# fw_printenv
Configuration file wrong or corrupted
root@XXX:~# strace fw_printenv
(omit)
openat(AT_FDCWD, "/etc/fw_env.config", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "Configuration file wrong or corr"..., 38Configuration file wrong or corrupted
) = 38
exit_group(-9) = ?
+++ exited with 247 +++
root@XXX:~# fdisk -l
Disk /dev/mmcblk2: 7456 MB, 7818182656 bytes, 15269888 sectors
119296 cylinders, 4 heads, 32 sectors/track
Units: sectors of 1 * 512 = 512 bytes
Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/mmcblk2p1 * 128,0,1 1023,3,32 16384 186775 170392 83.1M c Win95 FAT32 (LBA)
/dev/mmcblk2p2 1023,3,32 1023,3,32 196608 1596821 1400214 683M 83 Linux
/dev/mmcblk2p3 1023,3,32 1023,3,32 1605632 2968779 1363148 665M c Win95 FAT32 (LBA)
Disk /dev/mmcblk2boot0: 4 MB, 4194304 bytes, 8192 sectors
128 cylinders, 4 heads, 16 sectors/track
Units: sectors of 1 * 512 = 512 bytes
Disk /dev/mmcblk2boot0 doesn't contain a valid partition table
Disk /dev/mmcblk2boot1: 4 MB, 4194304 bytes, 8192 sectors
128 cylinders, 4 heads, 16 sectors/track
Units: sectors of 1 * 512 = 512 bytes
Disk /dev/mmcblk2boot1 doesn't contain a valid partition table
解決済! 解決策の投稿を見る。
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
This problem is solved.
1. The following is set in the config of u-boot.
CONFIG_SYS_MMC_ENV_DEV=2
CONFIG_SYS_MMC_ENV_PART=2
CONFIG_ENV_OFFSET=0x0
2. The following is set in /etc/fw_env.config
/dev/mmcblk2boot1 0x0 0x4000
N.B.
- CONFIG_SYS_MMC_ENV_DEV=2 means that there are u-boot-env in the mmcblk2.
- CONFIG_SYS_MMC_ENV_PART=2 means that there are u-boot-env in the mmcblk2boot1.
- CONFIG_ENV_OFFSET=0x0 means that u-boot-env is putted on no offset of the mmcblk2boot1.
- 0x4000 is default value of CONFIG_ENV_SIZE in imx8mm-evk.
- However, you cannot use fw_printenv/fw_setenv unless you run saveenv once in uboot or write u-boot-imx-initial-env-sd to mmcblk2boot1, because nothing is set in mmcblk2boot1.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
This problem is solved.
1. The following is set in the config of u-boot.
CONFIG_SYS_MMC_ENV_DEV=2
CONFIG_SYS_MMC_ENV_PART=2
CONFIG_ENV_OFFSET=0x0
2. The following is set in /etc/fw_env.config
/dev/mmcblk2boot1 0x0 0x4000
N.B.
- CONFIG_SYS_MMC_ENV_DEV=2 means that there are u-boot-env in the mmcblk2.
- CONFIG_SYS_MMC_ENV_PART=2 means that there are u-boot-env in the mmcblk2boot1.
- CONFIG_ENV_OFFSET=0x0 means that u-boot-env is putted on no offset of the mmcblk2boot1.
- 0x4000 is default value of CONFIG_ENV_SIZE in imx8mm-evk.
- However, you cannot use fw_printenv/fw_setenv unless you run saveenv once in uboot or write u-boot-imx-initial-env-sd to mmcblk2boot1, because nothing is set in mmcblk2boot1.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
You will face big problem saving env to eMMC boot partition than in user partition.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hi, tavim.
Thanks for reply.
What kind of problem will be occurred?


- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
You can refer to this Linux fw_printenv fw_setenv to access U-Boot's environment variables - NXP Community
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
I'm not sure where the address of uboot env is set...
