From mboxrd@z Thu Jan 1 00:00:00 1970 From: Martin Egholm Nielsen Date: Thu, 16 Dec 2004 16:17:27 +0100 Subject: [U-Boot-Users] Re: Reading or writing jffs2 - how? In-Reply-To: <87hdmnuvpi.fsf@deepthought.outer.space.org> References: <87hdmnuvpi.fsf@deepthought.outer.space.org> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Detlev, >> I have tried to create a jffs2-image of the linux-filesystem I wish >> to use, and then write it to my flash using "nand write.jffs2 >> 100000 0 $(filesize)". But with no luck... Then I began to >> investigate the fundamental "ls" and "nand erase" commands, but >> neither there did I have any success. Below is a trace of what I've >> tried in order to get something working. > Are you really sure, your NAND gets accessed correctly both under > U-Boot and Linux? Can you erase / write / readback some data under > U-Boot by hand? I'm sure it works under Linux - there I can both write and read - boot and use the flash-data again. No problems. Under u-boot I've just tried the following: =============== 8< 8< 8< 8< =============== => md.b 100000 00100000: 7f a3 eb 78 38 a0 00 00 4b ff fa b1 7c 7f 1b 78 ...x8...K...|..x 00100010: 3d 40 c0 18 39 2a 14 60 81 69 00 08 39 6b ff ff =@..9*.`.i..9k.. 00100020: 91 69 00 08 2c 0b 00 00 40 82 00 10 80 0a 14 60 .i..,... at ......` 00100030: 2c 00 00 00 40 82 00 0c 7f e3 fb 78 4b ff fe a0 ,... at ......xK... => nand write 100000 0 40 NAND write: device 0 offset 0, size 64 ... Warning block writes should be at lea st 512 bytes and start on a 512 byte boundry 64 bytes written: OK => nand read 200000 0 40 NAND read: device 0 offset 0, size 64 ... Warning block writes should be at leas t 512 bytes and start on a 512 byte boundry 64 bytes read: OK => md.b 200000 00200000: 7f a3 eb 78 38 a0 00 00 4b ff fa b1 7c 7f 1b 78 ...x8...K...|..x 00200010: 3d 40 c0 18 39 2a 14 60 81 69 00 08 39 6b ff ff =@..9*.`.i..9k.. 00200020: 91 69 00 08 2c 0b 00 00 40 82 00 10 80 0a 14 60 .i..,... at ......` 00200030: 2c 00 00 00 40 82 00 0c 7f e3 fb 78 4b ff fe a0 ,... at ......xK... => =============== 8< 8< 8< 8< =============== In short: the giberish-data present at memory 0x100000 is written to flash, and reread again to memory at 0x200000. The flash does still contain the data after reboot. Next, I tried reading the data from my Linux: # dd if=/dev/mtd0 of=/ftp/dump bs=8 count=8 === /ftp/dump contains: === 00000000: 7fa3 eb78 38a0 0000 4bff fab1 7c7f 1b78 ...x8...K...|..x 00000010: 3d40 c018 392a 1460 8169 0008 396b ffff =@..9*.`.i..9k.. 00000020: 9169 0008 2c0b 0000 4082 0010 800a 1460 .i..,... at ......` 00000030: 2c00 0000 4082 000c 7fe3 fb78 4bff fea0 ,... at ......xK... Hence, the same data is available from Linux at the beginning at the device. That made me wonder... Aaaaand, then I tried mounting the flash-root-filesystem under Linux after what I thought would have corrupted it (the above writing of giberish to the system). And the root-filesystem still worked! Hence, I tried dumping the entire flash to a file. And I discovered that the filesystem-data was positioned@the "end" of the flash... That may be the reason that "ls" in u-boot does not work with the image in flash - or what? Best regards, Martin Egholm