linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* simple ubi reader
@ 2010-11-28  9:27 Vladimir Khmelnitsky
  2010-11-28 10:29 ` Marek Skuczynski
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Vladimir Khmelnitsky @ 2010-11-28  9:27 UTC (permalink / raw)
  To: linux-mtd

Hi,

I need to write bootloader which should read its second stage binary
from ubi volume.
I wonder if there is some simple open source code I can use to implement
ubi volume reader?

Thanks in advance,
Vladimir

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

* Re: simple ubi reader
  2010-11-28  9:27 simple ubi reader Vladimir Khmelnitsky
@ 2010-11-28 10:29 ` Marek Skuczynski
  2010-11-28 12:37   ` Vladimir Khmelnitsky
  2010-11-28 18:13 ` Artem Bityutskiy
  2010-11-29  9:54 ` Peter Korsgaard
  2 siblings, 1 reply; 7+ messages in thread
From: Marek Skuczynski @ 2010-11-28 10:29 UTC (permalink / raw)
  To: Vladimir Khmelnitsky; +Cc: linux-mtd

Hi Vladimir,
> I need to write bootloader which should read its second stage binary
> from ubi volume.
> I wonder if there is some simple open source code I can use to implement
> ubi volume reader?
I can take a look at these places:
- U-boot <http://git.denx.de/?p=u-boot.git>
- Barebox aka U-boot2 <http://git.pengutronix.de/?p=barebox.git>

Regards,
 Marek

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

* RE: simple ubi reader
  2010-11-28 10:29 ` Marek Skuczynski
@ 2010-11-28 12:37   ` Vladimir Khmelnitsky
  2010-11-28 13:33     ` Marek Skuczynski
  0 siblings, 1 reply; 7+ messages in thread
From: Vladimir Khmelnitsky @ 2010-11-28 12:37 UTC (permalink / raw)
  To: Marek Skuczynski; +Cc: linux-mtd

Hi Marek,

Thanks for your reply.
But may be you know some simpler code performing ubi read. It looks to
me rather complicated to cut out from u-boot, and even from barebox -
code responsible only for ubi read dropping mtd staff.

Regards,
Vladimir

-----Original Message-----
From: Marek Skuczynski [mailto:mareksk7@gmail.com] 
Sent: Sunday, November 28, 2010 12:29 PM
To: Vladimir Khmelnitsky
Cc: linux-mtd@lists.infradead.org
Subject: Re: simple ubi reader

Hi Vladimir,
> I need to write bootloader which should read its second stage binary
> from ubi volume.
> I wonder if there is some simple open source code I can use to
implement
> ubi volume reader?
I can take a look at these places:
- U-boot <http://git.denx.de/?p=u-boot.git>
- Barebox aka U-boot2 <http://git.pengutronix.de/?p=barebox.git>

Regards,
 Marek

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

* Re: simple ubi reader
  2010-11-28 12:37   ` Vladimir Khmelnitsky
@ 2010-11-28 13:33     ` Marek Skuczynski
  0 siblings, 0 replies; 7+ messages in thread
From: Marek Skuczynski @ 2010-11-28 13:33 UTC (permalink / raw)
  To: Vladimir Khmelnitsky; +Cc: linux-mtd

Vladimir,
> But may be you know some simpler code performing ubi read. It looks to
> me rather complicated to cut out from u-boot, and even from barebox -
> code responsible only for ubi read dropping mtd staff.

Unfortunately, I don't know any simpler implementation of UBI driver.
However, I know that reading of an UBI volume content is not so
difficult to implement.
This should take about 2 days, which may be faster than adapting any
existing implementation.

Good luck,
  Marek

> Regards,
> Vladimir
>
> -----Original Message-----
> From: Marek Skuczynski [mailto:mareksk7@gmail.com] 
> Sent: Sunday, November 28, 2010 12:29 PM
> To: Vladimir Khmelnitsky
> Cc: linux-mtd@lists.infradead.org
> Subject: Re: simple ubi reader
>
> Hi Vladimir,
>> I need to write bootloader which should read its second stage binary
>> from ubi volume.
>> I wonder if there is some simple open source code I can use to
> implement
>> ubi volume reader?
> I can take a look at these places:
> - U-boot <http://git.denx.de/?p=u-boot.git>
> - Barebox aka U-boot2 <http://git.pengutronix.de/?p=barebox.git>
>
> Regards,
>  Marek
>
>

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

* Re: simple ubi reader
  2010-11-28  9:27 simple ubi reader Vladimir Khmelnitsky
  2010-11-28 10:29 ` Marek Skuczynski
@ 2010-11-28 18:13 ` Artem Bityutskiy
  2010-11-29 12:53   ` Matthieu CASTET
  2010-11-29  9:54 ` Peter Korsgaard
  2 siblings, 1 reply; 7+ messages in thread
From: Artem Bityutskiy @ 2010-11-28 18:13 UTC (permalink / raw)
  To: Vladimir Khmelnitsky; +Cc: linux-mtd

On Sun, 2010-11-28 at 11:27 +0200, Vladimir Khmelnitsky wrote:
> Hi,
> 
> I need to write bootloader which should read its second stage binary
> from ubi volume.
> I wonder if there is some simple open source code I can use to implement
> ubi volume reader?

I know people doing small bootloader code (closed source) with 4KiB
constraint for whole code, and it supported UBI R/O. That was clever
code made by clever people though. But here are some points:

1. You do not have to read EC headers when scanning
2. You do not really need to read the volume table
3. If you can assume you need only one volume, say, with vol ID 0, this
simplifies things further.

Also, AFAIR, some people found that placing VID header at the very end
of the NAND page made ECC calculations easier and faster. This is
actually why UBI has 'vid_hdr_offs' option which is not widely used,
though.

Anyway, this is the original old design document, which may contain some
hints, but I'm not sure:

http://linux-mtd.infradead.org/doc/ubidesign/ubidesign.pdf

The doc is not up-to-date, but all the design principles are valid.

-- 
Best Regards,
Artem Bityutskiy (Битюцкий Артём)

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

* Re: simple ubi reader
  2010-11-28  9:27 simple ubi reader Vladimir Khmelnitsky
  2010-11-28 10:29 ` Marek Skuczynski
  2010-11-28 18:13 ` Artem Bityutskiy
@ 2010-11-29  9:54 ` Peter Korsgaard
  2 siblings, 0 replies; 7+ messages in thread
From: Peter Korsgaard @ 2010-11-29  9:54 UTC (permalink / raw)
  To: Vladimir Khmelnitsky; +Cc: linux-mtd

>>>>> "Vladimir" == Vladimir Khmelnitsky <vladimir@broadlight.com> writes:

 Vladimir> Hi,

 Vladimir> I need to write bootloader which should read its second stage
 Vladimir> binary from ubi volume.  I wonder if there is some simple
 Vladimir> open source code I can use to implement ubi volume reader?

John Ogness from Linuxtronic did a short presentation about a small
bootloader doing this at ELCE:

http://www.elinux.org/images/4/45/Ipl_and_ubi.pdf

I don't know if his code is available online, but you could try mailing
him.

-- 
Bye, Peter Korsgaard

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

* Re: simple ubi reader
  2010-11-28 18:13 ` Artem Bityutskiy
@ 2010-11-29 12:53   ` Matthieu CASTET
  0 siblings, 0 replies; 7+ messages in thread
From: Matthieu CASTET @ 2010-11-29 12:53 UTC (permalink / raw)
  To: dedekind1@gmail.com; +Cc: Vladimir Khmelnitsky, linux-mtd@lists.infradead.org

Hi,

Artem Bityutskiy a écrit :
> On Sun, 2010-11-28 at 11:27 +0200, Vladimir Khmelnitsky wrote:
>> Hi,
>>
>> I need to write bootloader which should read its second stage binary
>> from ubi volume.
>> I wonder if there is some simple open source code I can use to implement
>> ubi volume reader?
> 
> I know people doing small bootloader code (closed source) with 4KiB
> constraint for whole code, and it supported UBI R/O. That was clever
> code made by clever people though. But here are some points:
> 
> 1. You do not have to read EC headers when scanning
> 2. You do not really need to read the volume table
> 3. If you can assume you need only one volume, say, with vol ID 0, this
> simplifies things further.
> 
> Also, AFAIR, some people found that placing VID header at the very end
> of the NAND page made ECC calculations easier and faster. This is
> actually why UBI has 'vid_hdr_offs' option which is not widely used,
> though.
> 
> Anyway, this is the original old design document, which may contain some
> hints, but I'm not sure:
> 
> http://linux-mtd.infradead.org/doc/ubidesign/ubidesign.pdf
> 
> The doc is not up-to-date, but all the design principles are valid.
> 
We also develop one ubi reader (only static volumes), but it is not open 
source at the moment.
We mainly used drivers/mtd/ubi/ubi-media.h as documentation.

It is quite easy to write one, but there are tricky stuff to handle like 
selecting the correct peb for a logical block (copy flags, sqnum, ...).

EC header can be useful to parse if the size of the ubi partition can 
change (use of image_seq to determine the end of boot partition).

Matthieu

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

end of thread, other threads:[~2010-11-29 12:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-28  9:27 simple ubi reader Vladimir Khmelnitsky
2010-11-28 10:29 ` Marek Skuczynski
2010-11-28 12:37   ` Vladimir Khmelnitsky
2010-11-28 13:33     ` Marek Skuczynski
2010-11-28 18:13 ` Artem Bityutskiy
2010-11-29 12:53   ` Matthieu CASTET
2010-11-29  9:54 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).