2009-02-27 10:00:22     how can i use yaffs2 image in 2008r1.5?

Document created by Aaronwu Employee on Aug 14, 2013
Version 1Show Document
  • View in full screen mode

2009-02-27 10:00:22     how can i use yaffs2 image in 2008r1.5?

Nicole Otsuka (CHINA)

Message: 70099   

 

hi~

 

i used mtd to create three partitions--"Kernel","systemfile","user space".

 

"Kernel" & "systemfilewere" formatted in Jffs2 and they worked well.

 

But there was a problem when i used yaffs2 format for the "user space"....

 

 

 

my steps are as follows:

 

1,"make" the dist to get uImage,rootfs.jffs2,vmImage&rootfs.yaffs2

 

2,download uImage to the board and bootm

 

3,"eraseall /dev/mtd1;eraseall /dev/mtd2"

 

4,use tftp to download rootfs.jffs2 & rootfs.yaffs2 to the board

 

5,"cp rootfs.jffs2 /dev/mtd1;cp rootfs.yaffs2 /dev/mtd2"

 

AND then "mount -t jffs2 /dev/mtdblock1 /mnt;ls"  ,all the directories and files in the filesystem were listed

 

BUT when i used "mount -t yaffs2 /dev/mtdblock2 /mnt;ls" ,it showed nothing but "lost+found".

 

i'm sure that there're some directories in it.but why couldn't i get them?

 

 

 

after that,i erased the mtd2 and remounted it.i wrote some files into it.and after i reboot the system,those file existed and worked well.

 

it seams that the yaffs2 can work after i mount it and write some file into it.

 

but i mean it's not convenient....because the "user space" may include lots of files...i can't download them to the filesystem everytime.....

 

So,my question is how can i use the yaffs2 image?is there any quick resolution like the usage of jffs2 above...

 

 

 

thank you~

 

Nicole

QuoteReplyEditDelete

 

 

2009-02-27 11:12:03     Re: how can i use yaffs2 image in 2008r1.5?

Phil Wilshire (UNITED STATES)

Message: 70102   

 

Hi,

 

Just a quick idea.

 

In the

 

    vendors/AnalogDevices/<target>/Makefile

 

change the line

 

    $(MKFS_YAFFS2) $(ROMFSDIR) $(ROMFSIMG).yaffs2 > /dev/null

 

to

 

    $(MKFS_YAFFS2) $(ROMFSDIR) $(ROMFSIMG).yaffs2 > $(ROOTDIR)/yaffs2.log

 

then look at yaffs2.log to make sure you are getting the file system populated.

 

Phil Wilshire

 

 

QuoteReplyEditDelete

 

 

2009-02-27 23:55:07     Re: how can i use yaffs2 image in 2008r1.5?

Nicole Otsuka (CHINA)

Message: 70129   

 

@Phil

 

yeap~thank you for your replay~~i tried it. and got the log:

 

mkyaffs2image: image building tool for YAFFS2 built Feb 27 2009

Processing directory /root/adi/uClinux-dist-2008R1.5-RC3/romfs2 into image file /root/adi/uClinux-dist-2008R1.5-RC3/images/rootfs.yaffs2

Object 257, /root/adi/uClinux-dist-2008R1.5-RC3/romfs2/mailr is a directory

Object 258, /root/adi/uClinux-dist-2008R1.5-RC3/romfs2/rss is a directory

Object 259, /root/adi/uClinux-dist-2008R1.5-RC3/romfs2/rss/rss_tmp is a directory

Object 260, /root/adi/uClinux-dist-2008R1.5-RC3/romfs2/musics is a directory

Object 261, /root/adi/uClinux-dist-2008R1.5-RC3/romfs2/musics/planetarium.mp3 is a file, 1377 data chunks written

Object 262, /root/adi/uClinux-dist-2008R1.5-RC3/romfs2/setting is a directory

Object 263, /root/adi/uClinux-dist-2008R1.5-RC3/romfs2/setting/setting_35.xml is a file, 1 data chunks written

Object 264, /root/adi/uClinux-dist-2008R1.5-RC3/romfs2/setting/weather_city.xml is a file, 1 data chunks written

Object 265, /root/adi/uClinux-dist-2008R1.5-RC3/romfs2/setting/flickr.xml is a file, 1 data chunks written

Object 266, /root/adi/uClinux-dist-2008R1.5-RC3/romfs2/flickr is a directory

Operation complete.

10 objects in 7 directories

1391 NAND pages

 

 

 

there is no doubt that the files is written into the image....but i can't get them after i copy to the mtd2....

 

can you give me another idea?thank you~

QuoteReplyEditDelete

 

 

2009-02-28 07:46:47     Re: how can i use yaffs2 image in 2008r1.5?

Phil Wilshire (UNITED STATES)

Message: 70153   

 

We have to go fishing here now...

 

Can you show me  the results of

 

   cat /proc/mtd

 

   cat /proc/partitions

 

and also the part of the kernel start up that finds the flash devices .

 

You can also use hexdump ( after enabling it in busybox ) to take a look

 

at the raw data in the device.

 

Example to get the first 4K

 

dd if=/dev/mtd2 of=/var/mtd2 bs=1024 count=4

 

hexdump /var/mtd2 > /var/mtd2.hex

 

Then look at /var/mtd2.hex to see what was written.

 

regards

 

  Phil Wilshire

 

 

QuoteReplyEditDelete

 

 

2009-03-02 04:19:44     Re: how can i use yaffs2 image in 2008r1.5?

Nicole Otsuka (CHINA)

Message: 70205   

 

thank you~i did it

 

and the info you need:

 

BF5xx on-chip NAND FLash Controller Driver, Version 1.2 (c) 2007 Analog Devices, Inc.

bf5xx-nand bf5xx-nand.0: page_size=512, data_width=8, wr_dly=3, rd_dly=3

NAND device: Manufacturer ID: 0xec, Chip ID: 0xf1 (Samsung NAND 128MiB 3,3V 8-bit)

Creating 3 MTD partitions on "NAND 128MiB 3,3V 8-bit":

0x00000000-0x00a00000 : "Linux Kernel"

0x00a00000-0x01e00000 : "File System"

0x01e00000-0x08000000 : "iicore space"

 

-----------------------------------------------------------------------------------------

 

root:/> cat /proc/partitions

major minor  #blocks  name

 

  31     0      10240 mtdblock0

  31     1      20480 mtdblock1

  31     2     100352 mtdblock2

root:/> cat /proc/mtd

dev:    size   erasesize  name

mtd0: 00a00000 00020000 "Linux Kernel"

mtd1: 01400000 00020000 "File System"

mtd2: 06200000 00020000 "iicore space"

root:/>

-----------------------------------------------------------------------------------------

 

and..i also tried hexhump but meet some problem:

 

root:/> dd if=/dev/mtd2 of=/var/mtd2 bs=1024 count=4

4+0 records in

4+0 records out

root:/> hexdump /var/mtd2 > /var/mtd2.hex

hexdump: applet not found

 

 

i enabled the "hexdump" in the menuconfig and these was a link named "hexdump" in the /bin of the filesystem....

 

 

 

thank you for your reply~

 

Nicole

QuoteReplyEditDelete

 

 

2009-03-02 04:57:00     Re: how can i use yaffs2 image in 2008r1.5?

Nicole Otsuka (CHINA)

Message: 70209   

 

oh~ I CLEAN the busybox and recomplied it...it worked:

 

root:/> eraseall /dev/mtd2

Erased 100352 Kibyte @ 0 -- 100% complete.     

root:/> tftp -gr rootfs.yaffs2 172.20.106.19

root:/> cp rootfs.yaffs2 /dev/mtd2

root:/> dd if=/dev/mtd2 of=/var/mtd2 bs=1024 count=4

4+0 records in

4+0 records out

root:/> hexdump /var/mtd2 > /var/mtd2.hex

root:/> cat /var/mtd2.hex

0000000 0003 0000 0001 0000 ffff 0000 0000 0000

0000010 0000 0000 0000 0000 0000 0000 0000 0000

*

0000100 0000 0000 0000 0000 ff00 ffff 41ed 0000

0000110 0000 0000 0000 0000 96dd 49ab 8fa8 49a7

0000120 8fa8 49a7 ffff ffff ffff ffff ffff ffff

0000130 ffff ffff ffff ffff ffff ffff ffff ffff

*

00001c0 ffff ffff ffff ffff ffff ffff 0000 0000

00001d0 ffff ffff ffff ffff ffff ffff ffff ffff

*

0000800 1000 0000 0001 0000 0000 0000 ffff 0000

0000810 3a30 bff1 0005 0000 0005 0000 3ab0 bff1

0000820 327c bff1 0003 0000 3a88 bff1 917a 0804

0000830 ffff 0000 9ec5 0804 00ff 0000 0000 0000

0000840 0003 0000 0001 0000 ffff 616d 6c69 0072

0000850 0000 0000 0000 0000 0000 0000 0000 0000

*

0000940 0000 0000 0000 0000 ff00 ffff 41ed 0000

0000950 0000 0000 0000 0000 96dd 49ab 8fa8 49a7

0000960 8fa8 49a7 ffff ffff ffff ffff ffff ffff

0000970 ffff ffff ffff ffff ffff ffff ffff ffff

*

0000a00 ffff ffff ffff ffff ffff ffff 0000 0000

0000a10 ffff ffff ffff ffff ffff ffff ffff ffff

*

0001000

root:/>

 

 

 

does it mean that the files have been written into the mtd2?

 

QuoteReplyEditDelete

 

 

2009-03-04 23:07:52     Re: how can i use yaffs2 image in 2008r1.5?

Yi Li (CHINA)

Message: 70397   

 

Nicole,

 

I don't think "cp rootfs.yaffs2 /dev/mtd2" would work for Nand flash. Please use "nandwrite" to write the image - "cp" or "dd" cannot handle bad blocks.

 

-Yi

QuoteReplyEditDelete

 

 

2009-03-04 23:34:37     Re: how can i use yaffs2 image in 2008r1.5?

Nicole Otsuka (CHINA)

Message: 70398   

 

thank you for your replay

 

i tried it...but....i failed...

 

i used "nandwirte /dev/mtd2 rootfs.yaffs2 0x0" and finnally made some bad blocks at the beginning of the partition....

 

i searched "nandwrite" on google.it seams to have more parameters....like -y (support for yaffs2)...

 

but mine is only show something like this:

 

root:/> nandwrite --help

usage: nandwrite <mtdname> <input file> <start address>

 

does it mean that i cant use nandwrite in this version of the mtd-utils?

QuoteReplyEditDelete

 

 

2009-03-04 23:42:58     Re: how can i use yaffs2 image in 2008r1.5?

Mike Frysinger (UNITED STATES)

Message: 70399   

 

you can grab updated mtd-utils from svn trunk.  it supports the -y option.

QuoteReplyEditDelete

 

 

2009-03-05 00:33:12     Re: how can i use yaffs2 image in 2008r1.5?

Nicole Otsuka (CHINA)

Message: 70403   

 

i got it  and i will try it

 

thank you very much

 

 

 

Nicole

QuoteReplyEditDelete

 

 

2009-03-05 03:13:38     Re: how can i use yaffs2 image in 2008r1.5?

Nicole Otsuka (CHINA)

Message: 70415   

 

hi~

 

i used the mtd-utils in the trunk version:

 

root:/> flash_eraseall /dev/mtd3

Erasing 128 Kibyte @ 5f00000 -- 100 % complete.

root:/> tftp -gr rootfs.yaffs2 172.20.106.19

root:/> nandwrite --help

Usage: nandwrite [OPTION] MTD_DEVICE [INPUTFILE|-]

Writes to the specified MTD device.

 

  -a, --autoplace         Use auto oob layout

  -j, --jffs2             Force jffs2 oob layout (legacy support)

  -y, --yaffs             Force yaffs oob layout (legacy support)

  -f, --forcelegacy       Force legacy support on autoplacement-enabled mtd

                          device

  -m, --markbad           Mark blocks bad if write fails

  -n, --noecc             Write without ecc

  -o, --oob               Image contains oob data

  -s addr, --start=addr   Set start address (default is 0)

  -p, --pad               Pad to page size

  -b, --blockalign=1|2|4  Set multiple of eraseblocks to align to

  -q, --quiet             Don't display progress messages

      --help              Display this help and exit

      --version           Output version information and exit

root:/> nandwrite -yfp /dev/mtd3 rootfs.yaffs2

MEMSETOOBSEL: Inappropriate ioctl for device

root:/>

 

 

how to solve this problem?

 

thank you.

 

 

 

Nicole

QuoteReplyEditDelete

 

 

2009-03-05 21:44:00     Re: how can i use yaffs2 image in 2008r1.5?

Yi Li (CHINA)

Message: 70483   

 

Nicole,

 

I will have a try on svn trunk.

 

-Yi

QuoteReplyEditDelete

 

 

2009-03-06 04:55:49     Re: how can i use yaffs2 image in 2008r1.5?

Yi Li (CHINA)

Message: 70530   

 

Nicole,

 

This problem also exists in SVN trunk. It looks a common issue for yaffs2.  I've opened a bug tracker for it at:

 

blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_id=141&tracker_item_id=4967

 

For now, you can copy files one by one (not a while yaffs2 image) to the partition mounted as yaffs2, to make a rootfs.

 

-Yi

Attachments

    Outcomes