I’ve got a Verdin-imx8mp board and built an image with Yocto with instructions taken from the Toradex support pages.
I’ve added a recipe that uses a custom wic/wks file to partition the image and updated the fstab file. I’m also updating the boot.cmd.in file so I can manage boot up.
I’ve got this image running on the target, but have “lost” the u-boot env.
fw_printenv
initially fails with “Cannot initialize environment” as
/etc/fw_env.config contains the default entry:
/dev/mmc-boot0 -0x2200 0x2000
where mmc-boot0 doesn’t exist.
if I change to my boot partition, I get an error about “cannot find u-boot env, using default”.
I want to be able to set my own variables.
I’m not exactly sure of the queston to ask, it’s just fw_printenv doesn’t work as expected and any examples are not obvious.
Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!
Did you like my answer?
Hello,
Thank you for reaching out with your question. It sounds like you’re doing some interesting work with your Verdin iMX8MP board and Yocto. Let’s address the issue you’re facing with accessing U-Boot environment variables.
To resolve this, you’ll need to ensure that the configuration file /etc/fw_env.config is correctly set up for your hardware. This file specifies where the U-Boot environment is stored on the flash memory.
For the Verdin iMX8MP, which uses eMMC, the U-Boot environment is typically stored at the end of the first eMMC boot partition. Here’s how you can configure it:
Identify the Correct Block Device: The block device for the first eMMC boot partition is usually something like /dev/mmcblk0boot0. You can verify this by checking the available block devices on your system.
Configure /etc/fw_env.config: Edit the file to include the correct block device, offset, and size. For example:
/dev/mmcblk0boot0 0x22000 0x2000
The offset (0x22000) and size (0x2000) are typical values, but you should confirm these based on your specific setup and U-Boot configuration.
Verify the Configuration: After updating the configuration file, try running fw_printenv again. If the configuration is correct, it should display the current U-Boot environment variables.
Set Environment Variables: Use fw_setenv to set your desired environment variables. Remember that changes will only take effect after a reboot.
Save Changes: If you make changes to the environment using the U-Boot console, use the saveenv command to persist them.
By ensuring that /etc/fw_env.config is correctly configured, you should be able to use fw_printenv and fw_setenv without encountering initialization errors. If issues persist, double-check the block device and offset values, as these are critical for accessing the U-Boot environment correctly.
I hope this helps you get everything working smoothly. If you have any more questions, feel free to ask.
Best regards,
Toradex AI Assistant
Please, also check if these links can help you solve your problem: