public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Peter A. Bigot <pab@pabigot.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] uboot env in mmc partition
Date: Wed, 03 Sep 2014 08:52:57 -0500	[thread overview]
Message-ID: <54071D39.1030202@pabigot.com> (raw)
In-Reply-To: <OF0D57B79F.BE280F8F-ON85257D48.004699B3-85257D48.0046F199@LocalDomain>

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 at 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@br-automation.com>
> To:     "Naitik Amin" <Naitik.Amin@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@br-automation.com>
>> To:     "Naitik Amin" <Naitik.Amin@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

  parent reply	other threads:[~2014-09-03 13:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <OF169DD9B8.4FDAA4B7-ON85257D43.005ECECD-85257D43.005F598D@LocalDomain>
2014-08-29 19:06 ` [U-Boot] uboot env in mmc partition Naitik Amin
2014-09-01  4:54   ` Hannes Petermaier
2014-09-02 12:21     ` Naitik Amin
2014-09-03  5:13       ` Hannes Petermaier
2014-09-03 12:54         ` Naitik Amin
2014-09-03 13:06           ` Hannes Petermaier
2014-09-03 13:52           ` Peter A. Bigot [this message]
2014-09-03 14:14             ` Hannes Petermaier
2014-09-03 14:23               ` Peter A. Bigot
2014-09-03 14:38                 ` Naitik Amin
2014-09-03 15:54                   ` Sachin Verma
2014-09-03 16:03                     ` Naitik Amin
2014-09-03 19:17               ` Naitik Amin
2014-08-29 17:21 Naitik Amin
2014-09-03 15:53 ` Stephen Warren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54071D39.1030202@pabigot.com \
    --to=pab@pabigot.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox