Message ID | 1345822171.2848.325.camel@sauron.fi.intel.com |
---|---|
State | Accepted |
Commit | abb3e01103eb4e2ea5c15e6fedbc74e08bd4cc2b |
Headers | show |
On Friday 24 August 2012 18:29:31 Artem Bityutskiy wrote: > On Sat, 2012-08-18 at 14:11 +0200, Pali Rohár wrote: > > I'm sending small patch which skip autoresizing ubi in > > readonly mode. I think it is really not good idea to try > > resize in ro mode. > > Hi, I've just pushed a similar patch to linux-ubi.git, is this > fine with you? I've also CCed -stable. > Hi, patch is OK. I tested it and working for me fine. > > BTW, is there userspace tool for unpacking data from ubifs > > image without need to simulate nand device in kernel? > > Unfortunately no. Ok. I have patch for block2mtd.ko which allows me to mount ubifs image in way: losetup --> block2mtd --> ubiattach --> mount without nandsim. I needed to patch block2mtd, because ubi code needs correct erase size, write size nand subpage shift and full image size. So I added params for these properties in block2mtd code - and it working. But I do not know if this is correct way, but I can send my patch.
On Fri, 2012-08-24 at 17:48 +0200, Pali Rohár wrote: > > > BTW, is there userspace tool for unpacking data from ubifs > > > image without need to simulate nand device in kernel? > > > > Unfortunately no. > > Ok. I have patch for block2mtd.ko which allows me to mount ubifs > image in way: losetup --> block2mtd --> ubiattach --> mount > without nandsim. I needed to patch block2mtd, because ubi code > needs correct erase size, write size nand subpage shift and full > image size. So I added params for these properties in block2mtd > code - and it working. But I do not know if this is correct way, > but I can send my patch. Why do you need to use block2mtd? If you have an image for NOR flash, use mtdram, if it is for NAND - use nandsim. What prevents you from using mtdram or nandsim?
On Friday 24 August 2012 18:57:01 Artem Bityutskiy wrote: > On Fri, 2012-08-24 at 17:48 +0200, Pali Rohár wrote: > > > > BTW, is there userspace tool for unpacking data from > > > > ubifs > > > > image without need to simulate nand device in kernel? > > > > > > Unfortunately no. > > > > Ok. I have patch for block2mtd.ko which allows me to mount > > ubifs image in way: losetup --> block2mtd --> ubiattach --> > > mount without nandsim. I needed to patch block2mtd, because > > ubi code needs correct erase size, write size nand subpage > > shift and full image size. So I added params for these > > properties in block2mtd code - and it working. But I do not > > know if this is correct way, but I can send my patch. > > Why do you need to use block2mtd? If you have an image for NOR > flash, use mtdram, if it is for NAND - use nandsim. What > prevents you from using mtdram or nandsim? I do not know why, but copying 256 MB image to nandsim takes more time than losetup & block2mtd & mount...
On Fri, 2012-08-24 at 17:59 +0200, Pali Rohár wrote: > > Why do you need to use block2mtd? If you have an image for NOR > > flash, use mtdram, if it is for NAND - use nandsim. What > > prevents you from using mtdram or nandsim? > > I do not know why, but copying 256 MB image to nandsim takes more > time than losetup & block2mtd & mount... May be, how much more? Is that a show-stopper for you? If you copy with 'dd', try 'bs=2048' if you are simulating a device with a 2048 bytes NAND page size. But I guess you can patch block2mtd, I do not have objections (although it'll report about itself as NOR flash?), but I never used it and I am not sure how many bugs there are.
On Friday 24 August 2012 18:09:16 Artem Bityutskiy wrote: > On Fri, 2012-08-24 at 17:59 +0200, Pali Rohár wrote: > > > Why do you need to use block2mtd? If you have an image for NOR > > > flash, use mtdram, if it is for NAND - use nandsim. What > > > prevents you from using mtdram or nandsim? > > > > I do not know why, but copying 256 MB image to nandsim takes more > > time than losetup & block2mtd & mount... > > May be, how much more? Is that a show-stopper for you? If you copy > with 'dd', try 'bs=2048' if you are simulating a device with a 2048 > bytes NAND page size. > > But I guess you can patch block2mtd, I do not have objections > (although it'll report about itself as NOR flash?), but I never used > it and I am not sure how many bugs there are. Hi! Years ago I wrote patches for block2mtd to allow specify write size and nand subpage shift. But I forgot to send them. I think they could be useful for other people, so rebased them on mainline kernel I will send them in few minutes.
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 355756b..8966088 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c @@ -799,6 +799,11 @@ static int autoresize(struct ubi_device *ubi, int vol_id) struct ubi_volume *vol = ubi->volumes[vol_id]; int err, old_reserved_pebs = vol->reserved_pebs; + if (ubi->ro_mode) { + ubi_warn("skip auto-resize because of R/O mode"); + return 0; + } + /* * Clear the auto-resize flag in the volume in-memory copy of the * volume table, and 'ubi_resize_volume()' will propagate this change