From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.nokia.com ([192.100.122.230] helo=mgw-mx03.nokia.com) by bombadil.infradead.org with esmtps (Exim 4.68 #1 (Red Hat Linux)) id 1JwHKg-0002yc-Jd for linux-mtd@lists.infradead.org; Wed, 14 May 2008 13:47:51 +0000 Subject: Re: ubifs image file confusion! From: Artem Bityutskiy To: Nancy In-Reply-To: References: <1210243730.3645.66.camel@sauron> <1210672125.5708.9.camel@sauron> Content-Type: text/plain; charset=utf-8 Date: Wed, 14 May 2008 16:45:44 +0300 Message-Id: <1210772744.5708.77.camel@sauron> Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: linux-mtd Reply-To: dedekind@infradead.org List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Tue, 2008-05-13 at 20:52 +0800, Nancy wrote: > > dd if=3D/dev/mtd5 of=3Dfile > > or > > dd if=3D/dev/ubi0_0 of=3Dfile > dd have to specify the count, blk...... I mean read size, It is > difficult to get the size. > And the output file is large. We need a small output file (only > contain neccessary data). > Cause those files will be offered online. suppose, the /dev/mtd5 is > 1G, or /dev/ubi0_0 is 500M > but the neccessary data only 10 or 100MiB. That waist too many space > and our bandwidth which is unacceptable. I see. But it is not a good reason for an additional ioctl anyway. In Linux we try to keep the amount of ioctl's as low as possible. What you can do instead, is to read the volume LEB by LEB, then check the data against 0xFFs, and if it contains all 0xFFs - drop this data. > I mean will you please make the ubifs.img(generated by mkfs.ubifs) > contains all mapped LEBs? Well... An UBIFS image file generated by mkfs.ubifs does contain some LEBs which have only 0xFFs in it. And when you write this image file using ubiupdate vol - these LEBs will be detected and UBI will leave them unmapped. > fill all ubifs.img's unmapped LEBs with > 0x00. Is that possible? No, it is not. I think I got it what is the problem you have hit. You drop unmapped LEBs when you dump the volume, then you flash this dumped data back and UBIFS cannot work anymore. Right? Of course. UBIFS has the index which refers LEB numbers. And when you drop unmapped LEBs the numbers change! For example, you have mapped LEB3, unmapped LEB4, mapped LEB5. The UBIFS index refers LEB3 and LEB5. You dump the volume and drop LEB4. Then you flash the dumped image and LEB5 becomes LEB4! So the index now refers incorrect LEB. Basically speaking, you cannot do stuff like this. At least it is not easy. What you can do is to save the numbers of dropped LEBs in a file. And when you write the dumped image, you feed 0xFFs instead of the LEB which were dropped. For example, you may improve ubiupdatevol and teach it to accept a --unmapped=3Dfile option which would contain a list of unmapped LEB numbers. --=20 Best regards, Artem Bityutskiy (=D0=91=D0=B8=D1=82=D1=8E=D1=86=D0=BA=D0=B8=D0=B9 =D0=90= =D1=80=D1=82=D1=91=D0=BC)