[U-Boot] uboot env in mmc partition

Peter A. Bigot pab at pabigot.com
Wed Sep 3 15:52:57 CEST 2014


On 09/03/2014 07:54 AM, Naitik Amin wrote:
> Hi Hannes,
>
> So I did as you had indicated and made some progress, so now, my #defines
> look as below.
> #define CONFIG_SYS_MMC_ENV_DEV          0       /* device 0 */
> #define CONFIG_ENV_OFFSET               0x21900000
>
> I calculated the env offset from the block number it was on based on the
> first block number of the partition.
>
> Doing this on uboot startup, I dont get the warning saying, using default
> environment. Neither it complained abt crc error. So it liked it seems.
> But what it did is it trashed the partition which had my dtb and zImage.
> Its a completely different partition. So after that, the bootup gets
> halted. Any ideas ? What may have trashed the partition ?

Look at: http://www.mail-archive.com/u-boot@lists.denx.de/msg146396.html

and see if that's relevant, specifically the second patch which restores 
the mmc device offset calculations to the values that correspond to the 
partition number that's represented in the device structure.

Peter

>
>
>
> From:   Hannes Petermaier <Hannes.Petermaier at br-automation.com>
> To:     "Naitik Amin" <Naitik.Amin at ametek.com>,
> Cc:     u-boot at lists.denx.de, u-boot-bounces at lists.denx.de
> Date:   09/03/2014 01:13 AM
> Subject:        Re: [U-Boot] uboot env in mmc partition
>
>
>
>> Hi Hannes,
> Hi,
>
>> Yes, its an eMMC. If I read your response correctly,
>> #define CONFIG_SYS_MMC_ENV_PART
>> Can only have 2 values, 1 & 2 is that correct ?
> yes - i think so.
> please have a look to env_mmc.c, lines 65 to 120 may be the most
> interesting for you.
> There are only low-level operations performed, nobody doesn't care about
> any filesystem or "filesystems-partitiontable" at this time.
>
>> Pls also keep in mind that from linux, it works fine, with
>> fw_env.config set to
>> /dev/mmcblk0p4 0 0x10000
> i think this environment is its own instance and has no interaction with
> u-boot`s one, is that so?
> In fact this environment is within "User-Area" of eMMC and at the place
> were part #4 starts.
>
> best regards,
> hannes
>
>> From:   Hannes Petermaier <Hannes.Petermaier at br-automation.com>
>> To:     "Naitik Amin" <Naitik.Amin at ametek.com>,
>> Cc:     u-boot at lists.denx.de, u-boot-bounces at lists.denx.de
>> Date:   09/01/2014 12:54 AM
>> Subject:        Re: [U-Boot] uboot env in mmc partition
>>
>>
>>
>>> HI there,
>> Hi Naitik,
>>
>>> I recently made changes to my system, where I created a new partition
> on
>>
>>> my mmc. (mmcblk0p4)
>> do you use MMC or eMMC ?
>> I guess eMMC.
>>
>>> 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 understand this #defines as following:
>>
>> CONFIG_SYS_MMC_ENV_DEV says: use mmc-device #0
>> CONFIG_SYS_MMC_ENV_PART says: use partition #4
>> i know that u-boot is using the boot-partitions to store the
> environment,
>> an emmc only has 2 partitions.
>> So #4 is a an illegal paramater
>>
>> CONFIG_ENV_OFFSET is an absolute address within the device/partition so
> it
>> is not "just after the MBR", instead the environment is "instead the
> MBR"
>> best regards,
>> Hannes
>
>
>
>
>
>
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot



More information about the U-Boot mailing list