From: Aaron Williams Date: Wed, 28 Sep 2011 19:11:42 -0700 Subject: [U-Boot] U-Boot: using nand write to flash an ubi image, ubi part fails In-Reply-To: <1310981348.24634.YahooMailClassic@web30207.mail.mud.yahoo.com> References: <1310981348.24634.YahooMailClassic@web30207.mail.mud.yahoo.com> Message-ID: <201109281911.43123.Aaron.Williams@cavium.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Lars, Were you ever successful in getting UBI to work in U-Boot? I am in a similar boat. I have UBI working beautifully in Linux (2.6.32.27) but so far I've had no luck in U-Boot. -Aaron On Monday, July 18, 2011 02:29:08 AM Lars Michael wrote: > Hello Ben, > > --- On Wed, 1/6/11, Ben Gardiner wrote: > > > Using mkfs.ubifs and ubinize I have created an image > > > > with 5 volumes. In Linux I could flash it using "ubiformat > > /dev/mtd1 -f /root/ubi.img" and attach it using "ubiattach > > /dev/ubi_ctrl -m 1". It worked. > > > > > In production I would prefer to write the image from > > > > U-Boot. So in U-Boot I used "nand erase" then "nand write" > > to flash the image. Then I want to attach by "ubi part" > > command - but this fails: "UBI error: ubi_init: UBI error: > > cannot initialize UBI, error -17" > > > > > [...] > > > I realize that the U-Boot 'nand erase' does not > > > > preserve the erase counters. So what would be the correct > > way to erase and write in U-Boot? And why is the ubiformat > > not able to correct the problems? > > > > It's true that the ECs are not preserved. But it's also > > true that > > trailing pages of 0xff are not trimmed either. You > > definitely need to > > drop trailing 0xff pages when writing ubinized images > > containing UBIFS > > volumes. To do this you can use either the new 'nand write' > > variant, > > .trimffs [1] which is currently patches that have been > > Acked. Or you > > can use the free-space-fixup feature which is available in > > the > > ubifs-2.6 tree and requires that you use a mkfs.ubifs built > > from the > > the mtd-utils tree. > > Ok, I have updated my mtd-utils and recompiled the mkfs.ubifs to get > support for the free-space-fixup feature. Next I have pulled > all ubi updates from the 2.6.29 backport tree which gave med 154 patches > including the fixup. > > Now I can build the image, ubiformat, ubiattach and mount with success. > After a reboot I can ubiattach and mount with success. > > Next step is to get it to work in U-Boot too. > > Thanks and regards, > - Lars > > _______________________________________________ > U-Boot mailing list > U-Boot at lists.denx.de > http://lists.denx.de/mailman/listinfo/u-boot -- Aaron Williams (408) 943-7198