From: Lars Michael Date: Thu, 29 Sep 2011 20:33:33 -0700 (PDT) Subject: [U-Boot] U-Boot: using nand write to flash an ubi image, ubi part fails In-Reply-To: <201109281911.43123.Aaron.Williams@cavium.com> Message-ID: <1317353613.60659.YahooMailClassic@web160608.mail.bf1.yahoo.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de --- On Thu, 29/9/11, Aaron Williams wrote: > From: Aaron Williams > Subject: Re: [U-Boot] U-Boot: using nand write to flash an ubi image, ubi part fails > To: u-boot at lists.denx.de > Cc: "Lars Michael" > Date: Thursday, 29 September, 2011, 4:11 > 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 Hi Aaron, Good question, I am not able to write a ubi image (created by ubinize) and then attatch to it from U-Boot. I found that I need the free space fixup patch. My U-Boot is rather old (2009.08) and I can not easily apply that patch due to too many other changes. So for now, I must write the image from Linux, do the fixup and then U-Boot is able to attach. Regards, - Lars > 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 >