mail archive of the rauc mailing list
 help / color / mirror / Atom feed
* [RAUC] U-Boot Offset for RAW Image on Slot Update
@ 2019-04-16 12:53 Steffen Kothe
  2019-04-16 13:51 ` Ulrich Ölmann
  0 siblings, 1 reply; 6+ messages in thread
From: Steffen Kothe @ 2019-04-16 12:53 UTC (permalink / raw)
  To: rauc

I try to update the U-Boot Loader on two different partitions.

/dev/mmcblk3boot0
/dev/mmcblk3boot1

A restriction on our i.Mx6 platform is location of the u-boot entry on
the partition.

Offset: 1024 Byte Address: 0x400

So a raw copy would start at address 0x00, but we have to start 0x400
for the entry point.

Does rauc provides any options to customize the startaddress for a raw
copy/install of a binary file (u-boot binary)?

I have took a look into the source code, but found out, that there is
no option to customize the default offset address for a write on a
partition.


Could you provide some help in this case? 



 

_______________________________________________
RAUC mailing list

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

* Re: [RAUC] U-Boot Offset for RAW Image on Slot Update
  2019-04-16 12:53 [RAUC] U-Boot Offset for RAW Image on Slot Update Steffen Kothe
@ 2019-04-16 13:51 ` Ulrich Ölmann
  2019-04-16 14:10   ` Ulrich Ölmann
  0 siblings, 1 reply; 6+ messages in thread
From: Ulrich Ölmann @ 2019-04-16 13:51 UTC (permalink / raw)
  To: rauc

Hi Steffen,

On Tue, Apr 16 2019 at 14:53 +0200, Steffen Kothe <steffen.kothe.gc1993@googlemail.com> wrote:
> I try to update the U-Boot Loader on two different partitions.
>
> /dev/mmcblk3boot0
> /dev/mmcblk3boot1
>
> A restriction on our i.Mx6 platform is location of the u-boot entry on
> the partition.
>
> Offset: 1024 Byte Address: 0x400
>
> So a raw copy would start at address 0x00, but we have to start 0x400
> for the entry point.
>
> Does rauc provides any options to customize the startaddress for a raw
> copy/install of a binary file (u-boot binary)?
>
> I have took a look into the source code, but found out, that there is
> no option to customize the default offset address for a write on a
> partition.
>
>
> Could you provide some help in this case?

take a look at hooks, especially the subsubsection "Install Hook":
https://rauc.readthedocs.io/en/latest/using.html#slot-hooks .

Best regards
Ulrich
-- 
Pengutronix e.K.                           | Ulrich Ölmann               |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
RAUC mailing list

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

* Re: [RAUC] U-Boot Offset for RAW Image on Slot Update
  2019-04-16 13:51 ` Ulrich Ölmann
@ 2019-04-16 14:10   ` Ulrich Ölmann
  2019-04-16 19:22     ` Enrico Jörns
  0 siblings, 1 reply; 6+ messages in thread
From: Ulrich Ölmann @ 2019-04-16 14:10 UTC (permalink / raw)
  To: rauc

On Tue, Apr 16 2019 at 15:51 +0200, Ulrich Ölmann <u.oelmann@pengutronix.de> wrote:
> Hi Steffen,
>
> On Tue, Apr 16 2019 at 14:53 +0200, Steffen Kothe <steffen.kothe.gc1993@googlemail.com> wrote:
>> I try to update the U-Boot Loader on two different partitions.
>>
>> /dev/mmcblk3boot0
>> /dev/mmcblk3boot1
>>
>> A restriction on our i.Mx6 platform is location of the u-boot entry on
>> the partition.
>>
>> Offset: 1024 Byte Address: 0x400
>>
>> So a raw copy would start at address 0x00, but we have to start 0x400
>> for the entry point.
>>
>> Does rauc provides any options to customize the startaddress for a raw
>> copy/install of a binary file (u-boot binary)?
>>
>> I have took a look into the source code, but found out, that there is
>> no option to customize the default offset address for a write on a
>> partition.
>>
>>
>> Could you provide some help in this case?
>
> take a look at hooks, especially the subsubsection "Install Hook":
> https://rauc.readthedocs.io/en/latest/using.html#slot-hooks .

... and use your own logic for updating the bootloader (forgot to
mention that): write a script that switches the eMMC's bootloader
partition from read-only to read-write and use the mmc-utils (see [1] &
[2]) to atomically switch the eMMC's partition once it was written.

Best regards
Ulrich


[1] git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git
[2] https://github.com/torvalds/linux/blob/master/Documentation/mmc/mmc-tools.txt
-- 
Pengutronix e.K.                           | Ulrich Ölmann               |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
RAUC mailing list

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

* Re: [RAUC] U-Boot Offset for RAW Image on Slot Update
  2019-04-16 14:10   ` Ulrich Ölmann
@ 2019-04-16 19:22     ` Enrico Jörns
  2019-04-23  7:38       ` Steffen Kothe
  0 siblings, 1 reply; 6+ messages in thread
From: Enrico Jörns @ 2019-04-16 19:22 UTC (permalink / raw)
  To: Steffen Kothe; +Cc: Ulrich Ölmann, rauc

Hi Steffen,

Am 16.04.19 um 16:10 schrieb Ulrich Ölmann:
> On Tue, Apr 16 2019 at 15:51 +0200, Ulrich Ölmann <u.oelmann@pengutronix.de> wrote:
>> Hi Steffen,
>>
>> On Tue, Apr 16 2019 at 14:53 +0200, Steffen Kothe <steffen.kothe.gc1993@googlemail.com> wrote:
>>> I try to update the U-Boot Loader on two different partitions.
>>>
>>> /dev/mmcblk3boot0
>>> /dev/mmcblk3boot1
>>>
>>> A restriction on our i.Mx6 platform is location of the u-boot entry on
>>> the partition.
>>>
>>> Offset: 1024 Byte Address: 0x400
>>>
>>> So a raw copy would start at address 0x00, but we have to start 0x400
>>> for the entry point.

which platform (i.mx6 variant) is that exactly? Where does the
restriction come from? I would have expected that all i.mx6 platforms
can handle eMMC boot partitions the same way.

>>> Does rauc provides any options to customize the startaddress for a raw
>>> copy/install of a binary file (u-boot binary)?
>>>
>>> I have took a look into the source code, but found out, that there is
>>> no option to customize the default offset address for a write on a
>>> partition.
>>>
>>>
>>> Could you provide some help in this case?
>>
>> take a look at hooks, especially the subsubsection "Install Hook":
>> https://rauc.readthedocs.io/en/latest/using.html#slot-hooks .
> 
> ... and use your own logic for updating the bootloader (forgot to
> mention that): write a script that switches the eMMC's bootloader
> partition from read-only to read-write and use the mmc-utils (see [1] &
> [2]) to atomically switch the eMMC's partition once it was written.

This is exactly what RAUC provides out-of-the box. Thus I would like to
understand why it is not working in that case. I assume you are doing
eMMC boot partitions update to gain atomicity, right?

Did you notice the eMMC boot partition atomic update feature of RAUC?

https://rauc.readthedocs.io/en/latest/advanced.html#update-emmc-boot-partitions

It basically performs the steps Ulrich described above.

And please consider subscribing to the mailing list, because posts by
non-members are blocked by default (and you won't receive messages that
are replied to the list only... ;) ).

Thanks and best regards

Enrico

-- 
Pengutronix e.K.                           | Enrico Jörns                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-5080 |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
RAUC mailing list

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

* Re: [RAUC] U-Boot Offset for RAW Image on Slot Update
  2019-04-16 19:22     ` Enrico Jörns
@ 2019-04-23  7:38       ` Steffen Kothe
  2019-04-23  7:53         ` Jan Lübbe
  0 siblings, 1 reply; 6+ messages in thread
From: Steffen Kothe @ 2019-04-23  7:38 UTC (permalink / raw)
  To: Enrico Jörns; +Cc: Ulrich Ölmann, rauc

Am Dienstag, den 16.04.2019, 21:22 +0200 schrieb Enrico Jörns:
> Hi Steffen,
> 
> Am 16.04.19 um 16:10 schrieb Ulrich Ölmann:
> > 
> > On Tue, Apr 16 2019 at 15:51 +0200, Ulrich Ölmann <u.oelmann@pengut
> > ronix.de> wrote:
> > > 
> > > Hi Steffen,
> > > 
> > > On Tue, Apr 16 2019 at 14:53 +0200, Steffen Kothe <steffen.kothe.
> > > gc1993@googlemail.com> wrote:
> > > > 
> > > > I try to update the U-Boot Loader on two different partitions.
> > > > 
> > > > /dev/mmcblk3boot0
> > > > /dev/mmcblk3boot1
> > > > 
> > > > A restriction on our i.Mx6 platform is location of the u-boot
> > > > entry on
> > > > the partition.
> > > > 
> > > > Offset: 1024 Byte Address: 0x400
> > > > 
> > > > So a raw copy would start at address 0x00, but we have to start
> > > > 0x400
> > > > for the entry point.
> which platform (i.mx6 variant) is that exactly? Where does the
> restriction come from? I would have expected that all i.mx6 platforms
> can handle eMMC boot partitions the same way.

Platform is the i.Mx6 Dual Light. 
The restriction came from the datasheet, that in case of use the eMMC
on an i.Mx6, the offset position for the u-boot on the boot partition
(eMMC) has to be 1KByte ( 0x400). This restriction depends on the used
memory technology. 
Other offsets are possible for different memory technologys! Refer for
more information to NXP i.MX6 Reference Manual
"Section 8.6.1 Image Vector Table and Boot Data"

RAUC handles the eMMC correctly, so I think, I just have to modify the 
offset address properly. If I do the update manually with "dd" ,
following command line is used

dd if=u-boot.imx of=/dev/mmcblk3boot0 bs=512 seek=2

If you would transform this command line to the RAUC behaviour, the
"dd" command would looks like this.

dd if=u-boot.imx of=/dev/mmcblk3boot0 bs=512 seek=0 

> > 
> > > 
> > > > 
> > > > Does rauc provides any options to customize the startaddress
> > > > for a raw
> > > > copy/install of a binary file (u-boot binary)?
> > > > 
> > > > I have took a look into the source code, but found out, that
> > > > there is
> > > > no option to customize the default offset address for a write
> > > > on a
> > > > partition.
> > > > 
> > > > 
> > > > Could you provide some help in this case?
> > > take a look at hooks, especially the subsubsection "Install
> > > Hook":
> > > https://rauc.readthedocs.io/en/latest/using.html#slot-hooks .
> > ... and use your own logic for updating the bootloader (forgot to
> > mention that): write a script that switches the eMMC's bootloader
> > partition from read-only to read-write and use the mmc-utils (see
> > [1] &
> > [2]) to atomically switch the eMMC's partition once it was written.
> This is exactly what RAUC provides out-of-the box. Thus I would like
> to
> understand why it is not working in that case. I assume you are doing
> eMMC boot partitions update to gain atomicity, right?
> 
> Did you notice the eMMC boot partition atomic update feature of RAUC?
> 
> https://rauc.readthedocs.io/en/latest/advanced.html#update-emmc-boot-
> partitions
> 
> It basically performs the steps Ulrich described above.
> 
> And please consider subscribing to the mailing list, because posts by
> non-members are blocked by default (and you won't receive messages
> that
> are replied to the list only... ;) ).
> 
> Thanks and best regards
> 
> Enrico

RAUC provides the uboot update out-of-the-box. I already use this
functions and found out, that the binary image, created by an yocto
recipe is included correctly but is not written to the correct position
on the eMMC itself.

I want to gain atomicity, true.

The code  does not provide  any option, to manual adjust the offset
write address for the binary uboot blob to the eMMC. 

Also the switching of boot paritions works correctly after the kernel
patch is applied. 

There is no BUG or something in the code,  its just a very specific
customization.

My ideas:

- Patch the code and extend the code for an offset option
- Use hooks for a post-install process, which copy the raw u-boot
binary from 0x0000 to 0x400 address after the raw install on the block
device (mmcblk3boot0 / mmcblk3boot1)


I would like to support you in this case with a code contribution. 
The code seems to be easy and well adjustable for this use case. 



_______________________________________________
RAUC mailing list

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

* Re: [RAUC] U-Boot Offset for RAW Image on Slot Update
  2019-04-23  7:38       ` Steffen Kothe
@ 2019-04-23  7:53         ` Jan Lübbe
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Lübbe @ 2019-04-23  7:53 UTC (permalink / raw)
  To: Steffen Kothe, Enrico Jörns; +Cc: Ulrich Ölmann, rauc

On Tue, 2019-04-23 at 09:38 +0200, Steffen Kothe wrote:
> RAUC handles the eMMC correctly, so I think, I just have to modify
> the 
> offset address properly. If I do the update manually with "dd" ,
> following command line is used
> 
> dd if=u-boot.imx of=/dev/mmcblk3boot0 bs=512 seek=2
> 
> If you would transform this command line to the RAUC behaviour, the
> "dd" command would looks like this.
> 
> dd if=u-boot.imx of=/dev/mmcblk3boot0 bs=512 seek=0 

The intention for RAUC is to install (complete) partition images into
partitions. So I'd suggest to use "dd if=u-boot.imx of=u-boot.emmc.img
bs=512 seek=2" to create the partition image for the RAUC bundle.

Regards,
Jan
-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
RAUC mailing list

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

end of thread, other threads:[~2019-04-23  7:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-16 12:53 [RAUC] U-Boot Offset for RAW Image on Slot Update Steffen Kothe
2019-04-16 13:51 ` Ulrich Ölmann
2019-04-16 14:10   ` Ulrich Ölmann
2019-04-16 19:22     ` Enrico Jörns
2019-04-23  7:38       ` Steffen Kothe
2019-04-23  7:53         ` Jan Lübbe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox