public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Richard Titmuss <richard_titmuss@logitech.com>
To: linux-mtd@lists.infradead.org
Subject: Bootloader support for UBI images
Date: Tue, 01 Jul 2008 12:43:07 +0100	[thread overview]
Message-ID: <486A184B.3080708@logitech.com> (raw)

Hi,

The system I am developing keeps two kernel and root filesystem images 
to allow easy recovery from any errors. I would like to use UBI to store 
both the kernel and filesystem, to take advantage of the error recovery, 
wear leveling, etc. I see searching the list adding support for UBI into 
a bootloader has been discussed before, but no patches are available so 
far.

I have now ported a limited read-only version of UBI to redboot, to 
allow loading static volumes. This is at a stage where I can now boot 
the system after loading the kernel from the UBI volume. It should be 
easy to also extend this to work with u-boot (but I have no immediate 
need for this myself). I will be adding erase and writing for UBI 
images, but not updating volumes as this is significantly more complex. 
If people are interested I can post the redboot package.

Before I proceed any further I have some questions. To upgrade the 
system I would like to do something like:

# Remove backup volumes
ubirmvol /dev/ubi0 -N kernel.old
ubirmvol /dev/ubi0 -N rootfs.old
# Create new volumes
ubimkvol /dev/ubi0 -N kernel.new -s ...
ubimkvol /dev/ubi0 -N rootfs.old -s ...
# Write new volume contents
ubiupdatevol /dev/ubi0 -N kernel.new zImage
ubiupdatevol /dev/ubi0 -N rootfs.new rootfs
# Atomically rename volumes, switch to the new images
ubirenamevol /dev/ubi0 kernel kernel.old kernel.new kernel rootfs 
rootfs.old rootfs.new rootfs

This would require adding support for -N to ubiupdatevol to allow the 
volume name to be used (just syntactic sugar) . Also I need support for 
renaming multiple volumes atomically when switching images after the 
upgrade. If these sound sensible and useful changes I can look at 
creating patches to add these features.

The initial scanning of the flash in the bootloader seems to be taking a 
long time (longer than mounting the volume from linux). I need to look 
at why this is taking longer, but it would be great to avoid doing two 
full table scans. Passing the scan information from the bootloader to 
the kernel seems tricky, especially as the kernel builds multiple trees 
and lists during the scan. Bootloader support for UBI imagesA possible 
alternative approach would be to include an LER to PER index table for 
static volumes only. This table would only need updating when the static 
volume was rewritten or a PER moved due to a bit error or wear leveling. 
If the index table and the volume table were always located near the 
start or end of the flash then a full volume scan could be avoided in 
the bootloader. Does this sound like a reasonable optimization, or is 
another solution preferred?

Richard

             reply	other threads:[~2008-07-01 11:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-01 11:43 Richard Titmuss [this message]
2008-07-01 12:26 ` Bootloader support for UBI images Artem Bityutskiy
2008-07-01 12:34   ` Artem Bityutskiy
2008-07-02  7:57   ` Richard Titmuss
2008-07-02  9:02     ` Artem Bityutskiy

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=486A184B.3080708@logitech.com \
    --to=richard_titmuss@logitech.com \
    --cc=linux-mtd@lists.infradead.org \
    /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