[U-Boot] uboot env in mmc partition

Stephen Warren swarren at wwwdotorg.org
Wed Sep 3 17:53:51 CEST 2014


On 08/29/2014 11:21 AM, Naitik Amin wrote:
> HI there,
>
> I recently made changes to my system, where I created a new partition on
> my mmc. (mmcblk0p4)
>
> Then i dd'd a uboot env image into this partition, updated the
> fw_env.config to point to /dev/mmcblk0p4. At this point, my fw_printenv
> and fw_setenv work good. So as a next step, I am tried to modify uboot to
> make it point to my env image in my new partition.
>
> I made below changes to my config header and rebuilt the uboot. On doing
> printenv from uboot, I dont see the same env that I pushed it from linux,
> infact I see it as its defined in the config header.
>
> Can some one help ?
>
> /* environment setting for MMC */
> #ifdef CONFIG_ENV_IS_IN_MMC
> #define CONFIG_SYS_MMC_ENV_DEV          0       /* device 0 */
> #define CONFIG_SYS_MMC_ENV_PART         4
> #define CONFIG_ENV_OFFSET               0       /* just after the MBR */
> #endif

I think you're confusing eMMC HW-level partitions (0=user data or 
mmcblk0, 1=mmcblk0boot0, 2=mmcblk0boot1) and SW-level (MBR/GPT) 
partitions within the user data area; /dev/mmcblk0p4.

CONFIG_SYS_MMC_ENV_PART applies to eMMC HW-level partitions.

I don't know if there's an environment variable that selects which 
SW-level partition to use. This is the feature you're looking for!

Later in the thread I saw:
#define CONFIG_ENV_OFFSET                0x21900000

That's not a good idea, since if someone repartitions the disk, that 
offset will be incorrect. Better would be to use (or add) SW-level 
partition support in the MMC environment code.


More information about the U-Boot mailing list