All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] accessing eMMC boot partitions from U-Boot
@ 2017-03-13 21:34 Tim Harvey
  2017-03-13 21:40 ` Fabio Estevam
  2017-03-13 21:49 ` Stephen Warren
  0 siblings, 2 replies; 13+ messages in thread
From: Tim Harvey @ 2017-03-13 21:34 UTC (permalink / raw)
  To: u-boot

Greetings,

I'm working with some boards with eMMC FLASH and understand that I can
set the fields of the PARTITION_CONFIG with the 'mmc partconf' command
to specify what partition is used for boot. Once I do that to set the
boot0 partition for example, how can I access that  partition from
within u-boot via mmc read/write? In Linux the kernel provides access
to user/boot0/boot1/rpmb via different devices, but I don't see u-boot
doing that.

Thanks,

Tim

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] accessing eMMC boot partitions from U-Boot
  2017-03-13 21:34 [U-Boot] accessing eMMC boot partitions from U-Boot Tim Harvey
@ 2017-03-13 21:40 ` Fabio Estevam
  2017-03-13 21:49 ` Stephen Warren
  1 sibling, 0 replies; 13+ messages in thread
From: Fabio Estevam @ 2017-03-13 21:40 UTC (permalink / raw)
  To: u-boot

Hi Tim,

On Mon, Mar 13, 2017 at 6:34 PM, Tim Harvey <tharvey@gateworks.com> wrote:
> Greetings,
>
> I'm working with some boards with eMMC FLASH and understand that I can
> set the fields of the PARTITION_CONFIG with the 'mmc partconf' command
> to specify what partition is used for boot. Once I do that to set the
> boot0 partition for example, how can I access that  partition from
> within u-boot via mmc read/write? In Linux the kernel provides access
> to user/boot0/boot1/rpmb via different devices, but I don't see u-boot
> doing that.

Can't you run dfu-util on the host PC to flash u-boot.imx into the eMMC?

See how we do this on warp7: board/warp7/README

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] accessing eMMC boot partitions from U-Boot
  2017-03-13 21:34 [U-Boot] accessing eMMC boot partitions from U-Boot Tim Harvey
  2017-03-13 21:40 ` Fabio Estevam
@ 2017-03-13 21:49 ` Stephen Warren
  2017-03-14  0:54   ` Ziyuan
                     ` (2 more replies)
  1 sibling, 3 replies; 13+ messages in thread
From: Stephen Warren @ 2017-03-13 21:49 UTC (permalink / raw)
  To: u-boot

On 03/13/2017 03:34 PM, Tim Harvey wrote:
> Greetings,
>
> I'm working with some boards with eMMC FLASH and understand that I can
> set the fields of the PARTITION_CONFIG with the 'mmc partconf' command
> to specify what partition is used for boot. Once I do that to set the
> boot0 partition for example, how can I access that  partition from
> within u-boot via mmc read/write? In Linux the kernel provides access
> to user/boot0/boot1/rpmb via different devices, but I don't see u-boot
> doing that.

The "mmc dev" command can be used to select which MMC device to operate 
on. The "typical" command "mmc dev 0" selects the main partition on MMC 
device 0 for later MMC-specific commands such as "mmc read". You can add 
an extra parameter to that command to request a specific HW partition, 
e.g. "mmc dev 0 1" selects boo0 of MMC device 0 and "mmc dev 0 2" 
selects boot1.

A similar naming scheme exists for commands that take a complete device 
specification each time. For example, "part list mmc 0" to list 
partitions in the main partition on MMC device 0, or "part list mmc 0.1" 
to list partitions on boot0 of MMC device 0.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] accessing eMMC boot partitions from U-Boot
  2017-03-13 21:49 ` Stephen Warren
@ 2017-03-14  0:54   ` Ziyuan
  2017-03-14  4:41     ` Stephen Warren
  2017-03-14  1:08   ` Sergey Kubushyn
  2017-03-14 12:55   ` Tim Harvey
  2 siblings, 1 reply; 13+ messages in thread
From: Ziyuan @ 2017-03-14  0:54 UTC (permalink / raw)
  To: u-boot

hi Stephen,

On 03/14/2017 05:49 AM, Stephen Warren wrote:
> On 03/13/2017 03:34 PM, Tim Harvey wrote:
>> Greetings,
>>
>> I'm working with some boards with eMMC FLASH and understand that I can
>> set the fields of the PARTITION_CONFIG with the 'mmc partconf' command
>> to specify what partition is used for boot. Once I do that to set the
>> boot0 partition for example, how can I access that  partition from
>> within u-boot via mmc read/write? In Linux the kernel provides access
>> to user/boot0/boot1/rpmb via different devices, but I don't see u-boot
>> doing that.
>
> The "mmc dev" command can be used to select which MMC device to 
> operate on. The "typical" command "mmc dev 0" selects the main 
> partition on MMC device 0 for later MMC-specific commands such as "mmc 
> read". You can add an extra parameter to that command to request a 
> specific HW partition, e.g. "mmc dev 0 1" selects boo0 of MMC device 0 
> and "mmc dev 0 2" selects boot1.

The 4th of "mmc dev 0 1" is the *software* partition index, not the hw 
partition index. AKA eMMC has four partitions: user 
data/boot0/boot1/rpmb, I think Tim wanna to boot from other partition, 
like boot0, right?

As the eMMC spec v5.1 said that, you can do the following steps:
1, set BOOT_PARTITION_ENABLE bit
2, send cmd0 w/ argument 0xFFFFFFFA
3,After putting a slave into transfer state, master sends CMD6 (SWITCH) 
to set the PARTITION_ACCESS bits in the EXT_CSD register, byte [179]

I don't try to boot from boot partitions, I hope it makes sense to you.
>
> A similar naming scheme exists for commands that take a complete 
> device specification each time. For example, "part list mmc 0" to list 
> partitions in the main partition on MMC device 0, or "part list mmc 
> 0.1" to list partitions on boot0 of MMC device 0.
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] accessing eMMC boot partitions from U-Boot
  2017-03-13 21:49 ` Stephen Warren
  2017-03-14  0:54   ` Ziyuan
@ 2017-03-14  1:08   ` Sergey Kubushyn
  2017-03-14  4:44     ` Stephen Warren
  2017-03-14 13:07     ` Tim Harvey
  2017-03-14 12:55   ` Tim Harvey
  2 siblings, 2 replies; 13+ messages in thread
From: Sergey Kubushyn @ 2017-03-14  1:08 UTC (permalink / raw)
  To: u-boot

On Mon, 13 Mar 2017, Stephen Warren wrote:

> On 03/13/2017 03:34 PM, Tim Harvey wrote:
>>  Greetings,
>>
>>  I'm working with some boards with eMMC FLASH and understand that I can
>>  set the fields of the PARTITION_CONFIG with the 'mmc partconf' command
>>  to specify what partition is used for boot. Once I do that to set the
>>  boot0 partition for example, how can I access that  partition from
>>  within u-boot via mmc read/write? In Linux the kernel provides access
>>  to user/boot0/boot1/rpmb via different devices, but I don't see u-boot
>>  doing that.
>
> The "mmc dev" command can be used to select which MMC device to operate on. 
> The "typical" command "mmc dev 0" selects the main partition on MMC device 0 
> for later MMC-specific commands such as "mmc read". You can add an extra 
> parameter to that command to request a specific HW partition, e.g. "mmc dev 0 
> 1" selects boo0 of MMC device 0 and "mmc dev 0 2" selects boot1.
>
> A similar naming scheme exists for commands that take a complete device 
> specification each time. For example, "part list mmc 0" to list partitions in 
> the main partition on MMC device 0, or "part list mmc 0.1" to list partitions 
> on boot0 of MMC device 0.

Unfortunately this has absolutely nothing to do with eMMC _BOOT_
partitions... There 2 of those on eMMC and they are _NOT_ accessible in
this fashion. Neither they bear any FS on them. eMMC is _SPECIAL_ in that
respect -- although it does look like e.g. SD Card it has 2 additional
_HARDWARE_ boot partitions that none of other MMC devices have. Those are
invisible and they are _NOT_ a part of user partition.

I did try to push a patch that would've allowed to put U-Boot environment
into boot partitions so entire _USER_ partition would be free but
unfortunately it had been met with fierce resistance, as usual, as well as
my patch for writing a bootable U-Boot into boot NAND on iMX6. I will
probably make another attempt tomorrow or later this week as time permitted
against 2017-03 but will give up if this one also failed...

We do use U-Boot with those patches in production devices which we
manufacture many thousands of with no problems at all.

---
******************************************************************
*  KSI at home    KOI8 Net  < >  The impossible we do immediately.  *
*  Las Vegas   NV, USA   < >  Miracles require 24-hour notice.   *
******************************************************************

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] accessing eMMC boot partitions from U-Boot
  2017-03-14  0:54   ` Ziyuan
@ 2017-03-14  4:41     ` Stephen Warren
  2017-03-14 10:14       ` Ziyuan
  0 siblings, 1 reply; 13+ messages in thread
From: Stephen Warren @ 2017-03-14  4:41 UTC (permalink / raw)
  To: u-boot

On 03/13/2017 06:54 PM, Ziyuan wrote:
> hi Stephen,
>
> On 03/14/2017 05:49 AM, Stephen Warren wrote:
>> On 03/13/2017 03:34 PM, Tim Harvey wrote:
>>> Greetings,
>>>
>>> I'm working with some boards with eMMC FLASH and understand that I can
>>> set the fields of the PARTITION_CONFIG with the 'mmc partconf' command
>>> to specify what partition is used for boot. Once I do that to set the
>>> boot0 partition for example, how can I access that  partition from
>>> within u-boot via mmc read/write? In Linux the kernel provides access
>>> to user/boot0/boot1/rpmb via different devices, but I don't see u-boot
>>> doing that.
>>
>> The "mmc dev" command can be used to select which MMC device to
>> operate on. The "typical" command "mmc dev 0" selects the main
>> partition on MMC device 0 for later MMC-specific commands such as "mmc
>> read". You can add an extra parameter to that command to request a
>> specific HW partition, e.g. "mmc dev 0 1" selects boo0 of MMC device 0
>> and "mmc dev 0 2" selects boot1.
>
> The 4th of "mmc dev 0 1" is the *software* partition index, not the hw
> partition index. AKA eMMC has four partitions: user
> data/boot0/boot1/rpmb, I think Tim wanna to boot from other partition,
> like boot0, right?

The fourth parameter is the HW partition number. See how cmd/mmc.c's 
do_mmc_dev() passes this value to blk_select_hwpart_devnum(), then to 
blk_select_hwpart().

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] accessing eMMC boot partitions from U-Boot
  2017-03-14  1:08   ` Sergey Kubushyn
@ 2017-03-14  4:44     ` Stephen Warren
  2017-03-14  5:11       ` Jaehoon Chung
  2017-03-14  6:19       ` Sergey Kubushyn
  2017-03-14 13:07     ` Tim Harvey
  1 sibling, 2 replies; 13+ messages in thread
From: Stephen Warren @ 2017-03-14  4:44 UTC (permalink / raw)
  To: u-boot

On 03/13/2017 07:08 PM, Sergey Kubushyn wrote:
> On Mon, 13 Mar 2017, Stephen Warren wrote:
>
>> On 03/13/2017 03:34 PM, Tim Harvey wrote:
>>>  Greetings,
>>>
>>>  I'm working with some boards with eMMC FLASH and understand that I can
>>>  set the fields of the PARTITION_CONFIG with the 'mmc partconf' command
>>>  to specify what partition is used for boot. Once I do that to set the
>>>  boot0 partition for example, how can I access that  partition from
>>>  within u-boot via mmc read/write? In Linux the kernel provides access
>>>  to user/boot0/boot1/rpmb via different devices, but I don't see u-boot
>>>  doing that.
>>
>> The "mmc dev" command can be used to select which MMC device to
>> operate on. The "typical" command "mmc dev 0" selects the main
>> partition on MMC device 0 for later MMC-specific commands such as "mmc
>> read". You can add an extra parameter to that command to request a
>> specific HW partition, e.g. "mmc dev 0 1" selects boo0 of MMC device 0
>> and "mmc dev 0 2" selects boot1.
>>
>> A similar naming scheme exists for commands that take a complete
>> device specification each time. For example, "part list mmc 0" to list
>> partitions in the main partition on MMC device 0, or "part list mmc
>> 0.1" to list partitions on boot0 of MMC device 0.
>
> Unfortunately this has absolutely nothing to do with eMMC _BOOT_
> partitions...

That's incorrect. See my other reply for details.

> There 2 of those on eMMC and they are _NOT_ accessible in
> this fashion. Neither they bear any FS on them.

The boot HW partitions are block storage just like any other. SW can 
place whatever data structures it wants into these HW partitions; the 
interpretation of any data stored here is up to the SW or HW that reads 
and interprets it, e.g. a SoC boot ROM. While many systems will place 
raw data here, others certainly do place SW partition tables, and 
perhaps even filesystems, in the HW partitions.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] accessing eMMC boot partitions from U-Boot
  2017-03-14  4:44     ` Stephen Warren
@ 2017-03-14  5:11       ` Jaehoon Chung
  2017-03-14  6:19       ` Sergey Kubushyn
  1 sibling, 0 replies; 13+ messages in thread
From: Jaehoon Chung @ 2017-03-14  5:11 UTC (permalink / raw)
  To: u-boot

On 03/14/2017 01:44 PM, Stephen Warren wrote:
> On 03/13/2017 07:08 PM, Sergey Kubushyn wrote:
>> On Mon, 13 Mar 2017, Stephen Warren wrote:
>>
>>> On 03/13/2017 03:34 PM, Tim Harvey wrote:
>>>>  Greetings,
>>>>
>>>>  I'm working with some boards with eMMC FLASH and understand that I can
>>>>  set the fields of the PARTITION_CONFIG with the 'mmc partconf' command
>>>>  to specify what partition is used for boot. Once I do that to set the
>>>>  boot0 partition for example, how can I access that  partition from
>>>>  within u-boot via mmc read/write? In Linux the kernel provides access
>>>>  to user/boot0/boot1/rpmb via different devices, but I don't see u-boot
>>>>  doing that.
>>>
>>> The "mmc dev" command can be used to select which MMC device to
>>> operate on. The "typical" command "mmc dev 0" selects the main
>>> partition on MMC device 0 for later MMC-specific commands such as "mmc
>>> read". You can add an extra parameter to that command to request a
>>> specific HW partition, e.g. "mmc dev 0 1" selects boo0 of MMC device 0
>>> and "mmc dev 0 2" selects boot1.
>>>
>>> A similar naming scheme exists for commands that take a complete
>>> device specification each time. For example, "part list mmc 0" to list
>>> partitions in the main partition on MMC device 0, or "part list mmc
>>> 0.1" to list partitions on boot0 of MMC device 0.
>>
>> Unfortunately this has absolutely nothing to do with eMMC _BOOT_
>> partitions...
> 
> That's incorrect. See my other reply for details.

Yes, Stephen's comment is right.

> 
>> There 2 of those on eMMC and they are _NOT_ accessible in
>> this fashion. Neither they bear any FS on them.
> 
> The boot HW partitions are block storage just like any other. SW can place whatever data structures it wants into these HW partitions; the interpretation of any data stored here is up to the SW or HW that reads and interprets it, e.g. a SoC boot ROM. While many systems will place raw data here, others certainly do place SW partition tables, and perhaps even filesystems, in the HW partitions.

Also, agreed.

> 
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] accessing eMMC boot partitions from U-Boot
  2017-03-14  4:44     ` Stephen Warren
  2017-03-14  5:11       ` Jaehoon Chung
@ 2017-03-14  6:19       ` Sergey Kubushyn
  1 sibling, 0 replies; 13+ messages in thread
From: Sergey Kubushyn @ 2017-03-14  6:19 UTC (permalink / raw)
  To: u-boot

On Mon, 13 Mar 2017, Stephen Warren wrote:

> On 03/13/2017 07:08 PM, Sergey Kubushyn wrote:
>>  On Mon, 13 Mar 2017, Stephen Warren wrote:
>> 
>> >  On 03/13/2017 03:34 PM, Tim Harvey wrote:
>> > >   Greetings,
>> > > 
>> > >   I'm working with some boards with eMMC FLASH and understand that I 
>> > >   can
>> > >   set the fields of the PARTITION_CONFIG with the 'mmc partconf' 
>> > >   command
>> > >   to specify what partition is used for boot. Once I do that to set the
>> > >   boot0 partition for example, how can I access that  partition from
>> > >   within u-boot via mmc read/write? In Linux the kernel provides access
>> > >   to user/boot0/boot1/rpmb via different devices, but I don't see 
>> > >   u-boot
>> > >   doing that.
>> > 
>> >  The "mmc dev" command can be used to select which MMC device to
>> >  operate on. The "typical" command "mmc dev 0" selects the main
>> >  partition on MMC device 0 for later MMC-specific commands such as "mmc
>> >  read". You can add an extra parameter to that command to request a
>> >  specific HW partition, e.g. "mmc dev 0 1" selects boo0 of MMC device 0
>> >  and "mmc dev 0 2" selects boot1.
>> > 
>> >  A similar naming scheme exists for commands that take a complete
>> >  device specification each time. For example, "part list mmc 0" to list
>> >  partitions in the main partition on MMC device 0, or "part list mmc
>> >  0.1" to list partitions on boot0 of MMC device 0.
>>
>>  Unfortunately this has absolutely nothing to do with eMMC _BOOT_
>>  partitions...
>
> That's incorrect. See my other reply for details.
>
>>  There 2 of those on eMMC and they are _NOT_ accessible in
>>  this fashion. Neither they bear any FS on them.
>
> The boot HW partitions are block storage just like any other. SW can place 
> whatever data structures it wants into these HW partitions; the 
> interpretation of any data stored here is up to the SW or HW that reads and 
> interprets it, e.g. a SoC boot ROM. While many systems will place raw data 
> here, others certainly do place SW partition tables, and perhaps even 
> filesystems, in the HW partitions.

That would've meant something has changed since last year. Will check
tomorrow when I'm back at my desk.

---
******************************************************************
*  KSI at home    KOI8 Net  < >  The impossible we do immediately.  *
*  Las Vegas   NV, USA   < >  Miracles require 24-hour notice.   *
******************************************************************

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] accessing eMMC boot partitions from U-Boot
  2017-03-14  4:41     ` Stephen Warren
@ 2017-03-14 10:14       ` Ziyuan
  0 siblings, 0 replies; 13+ messages in thread
From: Ziyuan @ 2017-03-14 10:14 UTC (permalink / raw)
  To: u-boot

hi Stephen,

On 03/14/2017 12:41 PM, Stephen Warren wrote:
> On 03/13/2017 06:54 PM, Ziyuan wrote:
>> hi Stephen,
>>
>> On 03/14/2017 05:49 AM, Stephen Warren wrote:
>>> On 03/13/2017 03:34 PM, Tim Harvey wrote:
>>>> Greetings,
>>>>
>>>> I'm working with some boards with eMMC FLASH and understand that I can
>>>> set the fields of the PARTITION_CONFIG with the 'mmc partconf' command
>>>> to specify what partition is used for boot. Once I do that to set the
>>>> boot0 partition for example, how can I access that partition from
>>>> within u-boot via mmc read/write? In Linux the kernel provides access
>>>> to user/boot0/boot1/rpmb via different devices, but I don't see u-boot
>>>> doing that.
>>>
>>> The "mmc dev" command can be used to select which MMC device to
>>> operate on. The "typical" command "mmc dev 0" selects the main
>>> partition on MMC device 0 for later MMC-specific commands such as "mmc
>>> read". You can add an extra parameter to that command to request a
>>> specific HW partition, e.g. "mmc dev 0 1" selects boo0 of MMC device 0
>>> and "mmc dev 0 2" selects boot1.
>>
>> The 4th of "mmc dev 0 1" is the *software* partition index, not the hw
>> partition index. AKA eMMC has four partitions: user
>> data/boot0/boot1/rpmb, I think Tim wanna to boot from other partition,
>> like boot0, right?
>
> The fourth parameter is the HW partition number. See how cmd/mmc.c's 
> do_mmc_dev() passes this value to blk_select_hwpart_devnum(), then to 
> blk_select_hwpart().

Thanks, it's my fault.

>
>
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] accessing eMMC boot partitions from U-Boot
  2017-03-13 21:49 ` Stephen Warren
  2017-03-14  0:54   ` Ziyuan
  2017-03-14  1:08   ` Sergey Kubushyn
@ 2017-03-14 12:55   ` Tim Harvey
  2 siblings, 0 replies; 13+ messages in thread
From: Tim Harvey @ 2017-03-14 12:55 UTC (permalink / raw)
  To: u-boot

On Mon, Mar 13, 2017 at 2:49 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> On 03/13/2017 03:34 PM, Tim Harvey wrote:
>>
>> Greetings,
>>
>> I'm working with some boards with eMMC FLASH and understand that I can
>> set the fields of the PARTITION_CONFIG with the 'mmc partconf' command
>> to specify what partition is used for boot. Once I do that to set the
>> boot0 partition for example, how can I access that  partition from
>> within u-boot via mmc read/write? In Linux the kernel provides access
>> to user/boot0/boot1/rpmb via different devices, but I don't see u-boot
>> doing that.
>
>
> The "mmc dev" command can be used to select which MMC device to operate on.
> The "typical" command "mmc dev 0" selects the main partition on MMC device 0
> for later MMC-specific commands such as "mmc read". You can add an extra
> parameter to that command to request a specific HW partition, e.g. "mmc dev
> 0 1" selects boo0 of MMC device 0 and "mmc dev 0 2" selects boot1.
>
> A similar naming scheme exists for commands that take a complete device
> specification each time. For example, "part list mmc 0" to list partitions
> in the main partition on MMC device 0, or "part list mmc 0.1" to list
> partitions on boot0 of MMC device 0.

Stephen,

Thanks - I wasn't aware of this usage and this was exactly what I was
looking for.

Tim

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] accessing eMMC boot partitions from U-Boot
  2017-03-14  1:08   ` Sergey Kubushyn
  2017-03-14  4:44     ` Stephen Warren
@ 2017-03-14 13:07     ` Tim Harvey
  2017-03-14 15:44       ` Stephen Warren
  1 sibling, 1 reply; 13+ messages in thread
From: Tim Harvey @ 2017-03-14 13:07 UTC (permalink / raw)
  To: u-boot

On Mon, Mar 13, 2017 at 6:08 PM, Sergey Kubushyn <ksi@koi8.net> wrote:
> On Mon, 13 Mar 2017, Stephen Warren wrote:
>
>> On 03/13/2017 03:34 PM, Tim Harvey wrote:
>>>
>>>  Greetings,
>>>
>>>  I'm working with some boards with eMMC FLASH and understand that I can
>>>  set the fields of the PARTITION_CONFIG with the 'mmc partconf' command
>>>  to specify what partition is used for boot. Once I do that to set the
>>>  boot0 partition for example, how can I access that  partition from
>>>  within u-boot via mmc read/write? In Linux the kernel provides access
>>>  to user/boot0/boot1/rpmb via different devices, but I don't see u-boot
>>>  doing that.
>>
>>
>> The "mmc dev" command can be used to select which MMC device to operate
>> on. The "typical" command "mmc dev 0" selects the main partition on MMC
>> device 0 for later MMC-specific commands such as "mmc read". You can add an
>> extra parameter to that command to request a specific HW partition, e.g.
>> "mmc dev 0 1" selects boo0 of MMC device 0 and "mmc dev 0 2" selects boot1.
>>
>> A similar naming scheme exists for commands that take a complete device
>> specification each time. For example, "part list mmc 0" to list partitions
>> in the main partition on MMC device 0, or "part list mmc 0.1" to list
>> partitions on boot0 of MMC device 0.
>
>
> Unfortunately this has absolutely nothing to do with eMMC _BOOT_
> partitions... There 2 of those on eMMC and they are _NOT_ accessible in
> this fashion. Neither they bear any FS on them. eMMC is _SPECIAL_ in that
> respect -- although it does look like e.g. SD Card it has 2 additional
> _HARDWARE_ boot partitions that none of other MMC devices have. Those are
> invisible and they are _NOT_ a part of user partition.
>
> I did try to push a patch that would've allowed to put U-Boot environment
> into boot partitions so entire _USER_ partition would be free but
> unfortunately it had been met with fierce resistance, as usual, as well as
> my patch for writing a bootable U-Boot into boot NAND on iMX6. I will
> probably make another attempt tomorrow or later this week as time permitted
> against 2017-03 but will give up if this one also failed...
>
> We do use U-Boot with those patches in production devices which we
> manufacture many thousands of with no problems at all.
>

Sergey,

While Stephen's usage does appear to be correct and works for me to
allow access to user/boot0/boot1 I would be interested in seeing your
patches that allow env to be stored in boot0/boot1 and see value in
those.

I'm also interested in what use cases everyone has for boot0/boot1 and
rpmb (rpmb appears to be accessed via 'mmc rpmb'). From my
understanding boot0/boot1 are both ideal places for SPL/U-boot. Is
there any reason why U-Boot env shouldn't go here as well?

It also seems to me that the point of two boot partitions would be to
allow a safe upgrade to ping-pong between the two, however I don't see
how this would work without support from SoC boot rom (and in my case
I don't see evidence that the IMX6 would try one, then the other).
Obviously a user could boot from boot0, then choose to flash a new
bootloader to boot1 and change the bootpart to boot1 but that wouldn't
allow recovery via boot0 if boot1 was invalid/corrupt as the hardware
would always select boot1 on powerup.

Regards,

Tim

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] accessing eMMC boot partitions from U-Boot
  2017-03-14 13:07     ` Tim Harvey
@ 2017-03-14 15:44       ` Stephen Warren
  0 siblings, 0 replies; 13+ messages in thread
From: Stephen Warren @ 2017-03-14 15:44 UTC (permalink / raw)
  To: u-boot

On 03/14/2017 07:07 AM, Tim Harvey wrote:
> On Mon, Mar 13, 2017 at 6:08 PM, Sergey Kubushyn <ksi@koi8.net> wrote:
>> On Mon, 13 Mar 2017, Stephen Warren wrote:
>>
>>> On 03/13/2017 03:34 PM, Tim Harvey wrote:
>>>>
>>>>  Greetings,
>>>>
>>>>  I'm working with some boards with eMMC FLASH and understand that I can
>>>>  set the fields of the PARTITION_CONFIG with the 'mmc partconf' command
>>>>  to specify what partition is used for boot. Once I do that to set the
>>>>  boot0 partition for example, how can I access that  partition from
>>>>  within u-boot via mmc read/write? In Linux the kernel provides access
>>>>  to user/boot0/boot1/rpmb via different devices, but I don't see u-boot
>>>>  doing that.
>>>
>>>
>>> The "mmc dev" command can be used to select which MMC device to operate
>>> on. The "typical" command "mmc dev 0" selects the main partition on MMC
>>> device 0 for later MMC-specific commands such as "mmc read". You can add an
>>> extra parameter to that command to request a specific HW partition, e.g.
>>> "mmc dev 0 1" selects boo0 of MMC device 0 and "mmc dev 0 2" selects boot1.
>>>
>>> A similar naming scheme exists for commands that take a complete device
>>> specification each time. For example, "part list mmc 0" to list partitions
>>> in the main partition on MMC device 0, or "part list mmc 0.1" to list
>>> partitions on boot0 of MMC device 0.
>>
>>
>> Unfortunately this has absolutely nothing to do with eMMC _BOOT_
>> partitions... There 2 of those on eMMC and they are _NOT_ accessible in
>> this fashion. Neither they bear any FS on them. eMMC is _SPECIAL_ in that
>> respect -- although it does look like e.g. SD Card it has 2 additional
>> _HARDWARE_ boot partitions that none of other MMC devices have. Those are
>> invisible and they are _NOT_ a part of user partition.
>>
>> I did try to push a patch that would've allowed to put U-Boot environment
>> into boot partitions so entire _USER_ partition would be free but
>> unfortunately it had been met with fierce resistance, as usual, as well as
>> my patch for writing a bootable U-Boot into boot NAND on iMX6. I will
>> probably make another attempt tomorrow or later this week as time permitted
>> against 2017-03 but will give up if this one also failed...
>>
>> We do use U-Boot with those patches in production devices which we
>> manufacture many thousands of with no problems at all.
>>
>
> Sergey,
>
> While Stephen's usage does appear to be correct and works for me to
> allow access to user/boot0/boot1 I would be interested in seeing your
> patches that allow env to be stored in boot0/boot1 and see value in
> those.

You don't need a patch for this. Here's how the Jetson TK1 board places 
the environment:

/* Environment in eMMC, at the end of 2nd "boot sector" */
#define CONFIG_ENV_IS_IN_MMC
#define CONFIG_ENV_OFFSET               (-CONFIG_ENV_SIZE)
#define CONFIG_SYS_MMC_ENV_DEV          0
#define CONFIG_SYS_MMC_ENV_PART         2

ENV_PART has been in place since mid-late 2012, and negative ENV_OFFSET 
since mid 2013.

> I'm also interested in what use cases everyone has for boot0/boot1 and
> rpmb (rpmb appears to be accessed via 'mmc rpmb'). From my
> understanding boot0/boot1 are both ideal places for SPL/U-boot. Is
> there any reason why U-Boot env shouldn't go here as well?

For example, NVIDIA Tegra stores the BCT ("Boot Configuration Table") 
there, which contains a "pointer" (eMMC boot partition offset) to the 
bootloader SW to load, which in some cases is U-Boot (a combined 
SPL+main binary) and in others is various proprietary bootloaders. 
Tegra's boot redundancy scheme doesn't make use of the separate boot HW 
partitions, in fact, I believe the boot ROM and/or some early boot SW, 
treats boot0+boot1 as effectively a concatenated RAID-0 device!. Rather, 
redundancy relies on replicating the data multiple times back-to-back in 
the boot partitions.

If you're interested, there are a few more details at:
http://http.download.nvidia.com/tegra-public-appnotes/index.html

> It also seems to me that the point of two boot partitions would be to
> allow a safe upgrade to ping-pong between the two, however I don't see
> how this would work without support from SoC boot rom (and in my case
> I don't see evidence that the IMX6 would try one, then the other).
> Obviously a user could boot from boot0, then choose to flash a new
> bootloader to boot1 and change the bootpart to boot1 but that wouldn't
> allow recovery via boot0 if boot1 was invalid/corrupt as the hardware
> would always select boot1 on powerup.

Yes, this seems like it would be a great application for the two 
partititons, and yes I agree it'd require boot ROM support or similar in 
all likelihood.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-03-14 15:44 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-13 21:34 [U-Boot] accessing eMMC boot partitions from U-Boot Tim Harvey
2017-03-13 21:40 ` Fabio Estevam
2017-03-13 21:49 ` Stephen Warren
2017-03-14  0:54   ` Ziyuan
2017-03-14  4:41     ` Stephen Warren
2017-03-14 10:14       ` Ziyuan
2017-03-14  1:08   ` Sergey Kubushyn
2017-03-14  4:44     ` Stephen Warren
2017-03-14  5:11       ` Jaehoon Chung
2017-03-14  6:19       ` Sergey Kubushyn
2017-03-14 13:07     ` Tim Harvey
2017-03-14 15:44       ` Stephen Warren
2017-03-14 12:55   ` Tim Harvey

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.