public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime.ripard@free-electrons.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] Fastboot behaviour with sparse images
Date: Wed, 4 Nov 2015 18:40:26 -0800	[thread overview]
Message-ID: <20151105024026.GF6114@lukather> (raw)
In-Reply-To: <2f175214-f359-460a-8996-469c6f42c4a4@googlegroups.com>

Hi Colin,

On Tue, Oct 27, 2015 at 02:00:24PM -0700, Colin Cross wrote:
> On Monday, October 12, 2015 at 6:43:37 AM UTC-7, Maxime Ripard wrote:
> >
> > Hi, 
> >
> > I'm currently writing the support in U-Boot for NAND-backed devices 
> > using fastboot [1], and that work derived a bit to supporting the 
> > sparse images. 
> >
> > For "regular" images that are being stored, we expect a pair of 
> > download and flash commands. Simple. 
> >
> > Things start to get a bit more complex with sparse images that have 
> > been split because of a max-download-size lower than the actual image 
> > size. 
> >
> > Here, from what I could gather from various random blog posts, the 
> > fastboot client implementation and dumping a few USB sessions, the 
> > client simply creates several download / flash pairs, always on the 
> > same partition, without any way to distinct that from several 
> > subsequent writes issued by the user. 
> >
> > So, I'm guessing that the expectation is that the bootloader 
> > implementation should store the last offset it wrote to, and simple 
> > resume from there if the partition names in the flash commands are the 
> > same, which would prevent two subsequent write on the same partition 
> > by any client. Am I right? 
> >
> 
> No, each blob passed to the bootloader will begin with a sparse "skip" 
> chunk that will seek to the correct place to resume writing.  The 
> bootloader shouldn't need to store any metadata across commands.  Just read 
> in the blob from the data command, then write it out using a port of the 
> Apache-licensed libsparse during the flash command.

Oh, so that's how it works. Great. I guess however that you still need
to scan out the area you skip for bad blocks to account them in the
offset calculation as well then (when you're using NAND).

> > A related question is when should we erase the NAND partition? Only 
> > when doing fastboot erase, or also when doing fastboot write (which, 
> > combined with the issue raised above, would also mean that we don't 
> > want to do an erase on the whole partition everytime there's a flash 
> > command on it).
> 
> Fastboot should send an erase command before every sequence of writes. 
>  Erase the whole partition on the erase command, and don't erase anything 
> on the flash command.

Ack.

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151104/033d9ae0/attachment.sig>

      reply	other threads:[~2015-11-05  2:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-12 13:43 [U-Boot] Fastboot behaviour with sparse images Maxime Ripard
2015-10-21 14:09 ` Tom Rini
2015-10-22  7:57   ` Maxime Ripard
2015-10-22 11:22     ` Tom Rini
2015-10-22 19:03       ` Maxime Ripard
2015-10-27 21:00 ` Colin Cross
2015-11-05  2:40   ` Maxime Ripard [this message]

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=20151105024026.GF6114@lukather \
    --to=maxime.ripard@free-electrons.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