How to make a yaffs filesystem

Miklós Márton
Hello all,

I have been generated a filesystem with buildroot for my Micro2440 board.
I have run mkyaffs2Image-128M on my buildroots's output/target directory.
I have uploaded the image with usbpush. The factory default kernel boots
up, but it cannot load the busybox:


yaffs_read_super: isCheckpointed 0
VFS: Mounted root (yaffs filesystem) on device 31:2.
Freeing init memory: 128K

and nothing happends. 

Any  help would be appericated.

davef
Have you checked you have the libraries included for BusyBox if you set it
up for dynamic linking?

I had problems on my 64M system until I linked it statically.  Now, that I
have a working system I must go back and try dynamic linking.

Good luck!

gene.sally
Try adding this parameter to the kernel command line

init=/bin/sh

This will cause the kernel to load a shell right away and skip the regular
init process.  If this works, look at the /etc/inittab file and work
through that line at a time to find the culprit.

Failure here means that the system in question:

1- Does not have a /bin/sh symlink
2- Cannot load busybox

You can look at your file system image to determine #1, but #2 will require
you get a running board first.  If you're creating a new root file system,
try to mount it via NFS before creating a JFFS2 image, because it's
easier/faster to make changes to the RFS. Visiting the University of Google
will turn-up lots of articles about using NFS to remotely mount a root file
system via NFS.

Regards,
gene

sam
I had the same problem when I compiled busybox the the Coudesourcery
toolchain. I changed to buildroot - that generates it's own toolchan - and
the problem went away :-)

Miklós Márton
Thank you very much for the answers. 


davef: I have built the busybox to be linked dynamically. (This is the
buildroot's default option.) 


gene.sally: I have modified the init kernel parameter to /bin/sh, and now I
got:

yaffs_read_super: isCheckpointed 0
VFS: Mounted root (yaffs filesystem) on device 31:2.
Freeing init memory: 128K
Kernel panic - not syncing: Attempted to kill init!

I have checked there is bin/sh symlink to bin/busybox on my target
directory. The default linuxrc is the symlink  too to  same file:
bin/busybox. I do not understand why the result is different if both files
point to the same file. 

sam: I have been used the buildroot's toolchain.

gene.sally
>> Kernel panic - not syncing: Attempted to kill init!

This is a good hint. What is the kernel command-line?  What parameters were
used to build the file system?  What version of yaffs was used?  How was
this file system written into flash -- did you use uboot or something else?
 Can you mount this same file system over the network (with a running file
system) to ensure that this file system works?  You need to isolate this as
a yaffs, busybox or library problem so attention can be concentrated in the
right area.

You can turn-on debugging by changing some flags in the yaffs source?

>>point to the same file

Busybox inspects argc[0] to figure out what "applet" to run. 

Regards,
gene

Miklós Márton
I am using a stock micro2440 board with the default supervivi. 
The kernel parameters are:
noinitrd root=/dev/mtdblock2 init=/bin/bash console=ttySAC0

I have made my image with the mkyaffs2image-128M tool, what I have
downloaded from this site. 

mkyaffs2image: image building tool for YAFFS2 built Jul  9 2009

I have configured, and built the buildroot, and I have run 
mkyaffs2image-128M /opt/buildroot-2009.11/output/target/
/home/mm/rootfs.bin

I will try out the NFS filesystem as rootfs.

sam
@Miklós Márton:

> I have run mkyaffs2Image-128M on my buildroots's output/target
> directory.

Oh, that I overlooked. Make "ls -l output/target/dev". You'll see, all
major/minor are 0. The correct major/minor are created when buildroot
creates the actual image, but not the target directory (at least with the
latest stable buildroot).

The way to this correct is:
- create a *.ext2 rootimage
- mount it
- run mkyaffs giving the mountpoint.

Make ext2, 'cause you'll probably want to modify the contents befor
building the yaffs image.

You might want to remove all devices except /dev/console from the rootimage
if you intend to use busybox mdev (which I found to be a great advantage)

Miklós Márton
I have created the ext2 image mounted with:
sudo mount -t ext2 -o loop -o rw output/images/rootfs.arm.ext2 /tmp/fs/

I have run mkyaffs2image-128M /tmp/fs/ /home/mm/out.bin

I have uploaded it, and now it reboots without any messages after the
bootup. 

I have removed all the /dev/ files expect the console. (I have compiled the
busybox with mdev.) The result is the same.

I have tried bot /linuxrc and /bin/sh as kernel parameter. 

Currently I'm using the factory default 2.6.29 kernel. I have built the
buildroot with 2.6.29 too, but I could not upload the generated zImage,
because it is too large.

sam
can you copy&paste the output from the console?

Miklós Márton
Attachment: micro2440out.txt (8.92 KB)
Output attached.

sam
And decompressing the kernel hangs for ever?

I'd suggest you recompile your kernel. Kick out anything you do not need
for the first steps - you can add stuff later - do not make loadable
modules and keep it small. Then try again.

Miklós Márton
No. IMHO the kernel loads, and boots up fine, but when it starts the
busybox it hangs. I will try to compile and load a smaller kernel.

davef
In your micro2440out.txt it looks like you are trying to uncompress the
kernel twice. Haven't seen that one yet!

Miklós Márton
Yes you are right. If it would rebooted itself it should start with
supervivi.

gene.sally
I noticed this about the output

1- kernel command line is missing
rootfstype=yaffs2

2- Problems with the flash 
mtd: partition "root" extends beyond the end of device "NAND 128MiB 3,3V
8-bit" -- size truncated to 0x7da0000
0x000000000000-0x000040000000 : "nand"
mtd: partition "nand" extends beyond the end of device "NAND 128MiB 3,3V
8-bit" -- size truncated to 0x8000000

This should match your flash device.

Not sure if this made any difference with the result.  I thought that the
rootfstype was required nowadays.  Also, when programming the nand memory,
are you doing an "erase" first, or does the bootloader do an erase
automatically? 

So it seems like we still don't know if the kernel RFS has mounted, but it
could be in limbo somewhere before init ever runs (this is what I
suspect...); there are a few ways to debug this.

1- Write a simple "hello world" program, statically link it, run that for
init
That will eliminate issues with the file system itself.  This program
should be linked with -static so it has no dependencies.

2- Up the YAFFS debugging 
You can do this at compile time by or-ing some things to debugMask (the
default tracemask is in yaffs_fs.c and is set to YAFFS_TRACE_BAD_BLOCKS |
YAFFS_TRACE_ALWAYS, I think the rest are in yportenv.h.

3- Create an NFS file system, boot into that, then inspect file system 
This will take a while, but you can mount the file system you created and
mount that remotely.  Once you're running, you can then mount the YAFFS
file system and see what happens in a more forgiving environment than
system boot-up. When you build your root file system, include "strace",
this lets you see the system calls a program invokes, which is very handy
for debugging.

In all, this is a fairly difficult thing to debug...

Regards,
gene

sam
I've placed my kernel here:
http://www.friendlyarm.net/forum/topic/434?lang=en#1934
You could give it a try, maybe it'll work.

Miklós Márton
Hmm. I have placed back the default qtopia image. 
I have copyed to the sd card the /usr/bin/ts_* binaries from my root fs,
 and I have tried to run them, and I got:

[root@FriendlyARM /sdcard]# ./ts_print
-/bin/sh: ./ts_print: not found

Is it normal? If these binaries have dependencies it should be reported. 
Now I am not sure about, that I am using the right buildroot config:

I have selected: 
Target architecture:  arm
'' variant: arm920t
target ABI: EABI

sam
The binaries are not exchangeable between uClibc buildroots (that's stated
somewhere on the buldroot bomepage).

PJvG
Davef, 
quick question; could you explain how you linked BusyBox statically with
Buildroot?

Thanks,
 PJvG

davef
Didn't use Buildroot, just built it as part of making my own root fs.

PJvG
Thanks anyway,
I was able to do it now with Buildroot. ;)
Hopefully my rootfs image will load now since I was having problems with
that..

venkatganesh
I am new to the mini6410 ,i have problem install in linux below this error
ll come




usbcore: registered new interface driver iuu_phoenix
iuu_phoenix: v0.12:Infinity USB Unlimited Phoenix driver
USB Serial support registered for Keyspan - (without firmware)
USB Serial support registered for Keyspan 1 port adapter
USB Serial support registered for Keyspan 2 port adapter
USB Serial support registered for Keyspan 4 port adapter
usbcore: registered new interface driver keyspan
keyspan: v1.1.5:Keyspan USB to Serial Converter Driver
USB Serial support registered for Keyspan PDA
usb 1-1: new full speed USB device using s3c2410-ohci and address 2
USB Serial support registered for Keyspan PDA - (prerenumeration)
USB Serial support registered for Xircom / Entregra PGS - (prerenumeration)
usbcore: registered new interface driver keyspan_pda
keyspan_pda: v1.1:USB Keyspan PDA Converter driver
USB Serial support registered for KL5KUSB105D / PalmConnect
usbcore: registered new interface driver kl5kusb105d
kl5kusb105: v0.4:KLSI KL5KUSB105 chipset USB->Serial Converter driver
USB Serial support registered for KOBIL USB smart card terminal
usbcore: registered new interface driver kobil
kobil_sct: 21/05/2004:KOBIL USB Smart Card Terminal Driver (experimental)
USB Serial support registered for MCT U232
usbcore: registered new interface driver mct_u232
mct_u232: z2.1:Magic Control Technology USB-RS232 converter driver
USB Serial support registered for Moschip 2 port adapter
mos7720: 2.1:Moschip USB Serial Driver
usbcore: registered new interface driver moschip7720
USB Serial support registered for Moschip 7840/7820 USB Serial Driver
mos7840: 1.3.2:Moschip 7840/7820 USB Serial Driver
usbcore: registered new interface driver mos7840
USB Serial support registered for moto-modem
usbcore: registered new interface driver moto-modem
USB Serial support registered for navman
usbcore: registered new interface driver navman
USB Serial support registered for ZyXEL - omni.net lcd plus usb
usbcore: registered new interface driver omninet
omninet: v1.1:USB ZyXEL omni.net LCD PLUS Driver
USB Serial support registered for opticon
usbcore: registered new interface driver opticon
USB Serial support registered for GSM modem (1-port)
usbcore: registered new interface driver option
option: v0.7.2:USB Driver for GSM modems
USB Serial support registered for oti6858
usbcore: registered new interface driver oti6858
USB Serial support registered for pl2303
usbcore: registered new interface driver pl2303
pl2303: Prolific PL2303 USB to serial adaptor driver
USB Serial support registered for qcaux
usbcore: registered new interface driver qcaux
USB Serial support registered for Qualcomm USB modem
usbcore: registered new interface driver qcserial
safe_serial: v0.1:USB Safe Encapsulated Serial
USB Serial support registered for safe_serial
usb 1-1: New USB device found, idVendor=05e3, idProduct=0606
usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usbcore: registered new interface driver safe_serial
USB Serial support registered for sam-ba
usb 1-1: Product: USB Hub 2.0
usbcore: registered new interface driver sam-ba
sam_ba: v1.0: Atmel SAM Boot Assistant (SAM-BA) driver
hub 1-1:1.0: USB hub found
hub 1-1:1.0: 4 ports detected
USB Serial support registered for siemens_mpi
usbcore: registered new interface driver siemens_mpi
Driver for Siemens USB/MPI adapter
Version 0.1 09/26/2005 Thomas Hergenhahn@web.de http://libnodave.sf.net
USB Serial support registered for Sierra USB modem
usbcore: registered new interface driver sierra
sierra: v.1.7.16:USB Driver for Sierra Wireless USB modems
USB Serial support registered for SPCP8x5
usbcore: registered new interface driver spcp8x5
spcp8x5: v0.10:SPCP8x5 USB to serial adaptor driver
USB Serial support registered for Quatech SSU-100 USB to Serial Driver
usbcore: registered new interface driver ssu100
ssu100: v0.1:Quatech SSU-100 USB to Serial Driver
USB Serial support registered for symbol
usbcore: registered new interface driver symbol
USB Serial support registered for TI USB 3410 1 port adapter
USB Serial support registered for TI USB 5052 2 port adapter
usbcore: registered new interface driver ti_usb_3410_5052
ti_usb_3410_5052: v0.10:TI USB 3410/5052 Serial Driver
USB Serial support registered for Handspring Visor / Palm OS
USB Serial support registered for Sony Clie 3.5
USB Serial support registered for Sony Clie 5.0
usbcore: registered new interface driver visor
visor: USB HandSpring Visor / Palm OS driver
USB Serial support registered for Connect Tech - WhiteHEAT -
(prerenumeration)
USB Serial support registered for Connect Tech - WhiteHEAT
usbcore: registered new interface driver whiteheat
whiteheat: v2.0:USB ConnectTech WhiteHEAT driver
USB Serial support registered for vivopay-serial
usbcore: registered new interface driver vivopay-serial
vivopay_serial: v1.0:ViVOpay USB Serial Driver
USB Serial support registered for zio
usbcore: registered new interface driver zio
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
s3c-hsotg s3c-hsotg: regs c8840000, irq 90
s3c-hsotg s3c-hsotg: s3c_hsotg_corereset: reset failed, GRSTCTL=80000001
s3c-hsotg s3c-hsotg: GRXFSIZ=0x00001800, GNPTXFSIZ=0x18001800
s3c-hsotg s3c-hsotg: shared fifos
s3c-hsotg s3c-hsotg: cannot create debug root
s3c-hsotg s3c-hsotg: DCFG=0x00200000, DCTL=0x00000002, DIEPMSK=0000000f
s3c-hsotg s3c-hsotg: GAHBCFG=0x00000000, 0x44=0x00000000
s3c-hsotg s3c-hsotg: GRXFSIZ=0x00000800, GNPTXFSIZ=0x04000800
s3c-hsotg s3c-hsotg: DPTx[1] FSize=768, StAddr=0x00000f00
s3c-hsotg s3c-hsotg: DPTx[2] FSize=768, StAddr=0x00001200
s3c-hsotg s3c-hsotg: DPTx[3] FSize=768, StAddr=0x00001500
s3c-hsotg s3c-hsotg: DPTx[4] FSize=768, StAddr=0x00001800
s3c-hsotg s3c-hsotg: DPTx[5] FSize=768, StAddr=0x00001b00
s3c-hsotg s3c-hsotg: DPTx[6] FSize=768, StAddr=0x00001e00
s3c-hsotg s3c-hsotg: DPTx[7] FSize=768, StAddr=0x00002100
s3c-hsotg s3c-hsotg: DPTx[8] FSize=768, StAddr=0x00002400
s3c-hsotg s3c-hsotg: DPTx[9] FSize=768, StAddr=0x00002700
s3c-hsotg s3c-hsotg: DPTx[10] FSize=768, StAddr=0x00002a00
s3c-hsotg s3c-hsotg: DPTx[11] FSize=768, StAddr=0x00002d00
s3c-hsotg s3c-hsotg: DPTx[12] FSize=768, StAddr=0x00003000
s3c-hsotg s3c-hsotg: DPTx[13] FSize=768, StAddr=0x00003300
s3c-hsotg s3c-hsotg: DPTx[14] FSize=768, StAddr=0x00003600
s3c-hsotg s3c-hsotg: DPTx[15] FSize=768, StAddr=0x00003900
s3c-hsotg s3c-hsotg: ep0-in: EPCTL=0x00008000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep0-out: EPCTL=0x00008000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep1-in: EPCTL=0x00000000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep1-out: EPCTL=0x00000000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep2-in: EPCTL=0x00000000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep2-out: EPCTL=0x00000000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep3-in: EPCTL=0x00000000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep3-out: EPCTL=0x00000000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep4-in: EPCTL=0x00000000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep4-out: EPCTL=0x00000000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep5-in: EPCTL=0x00000000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep5-out: EPCTL=0x00000000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep6-in: EPCTL=0x00000000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep6-out: EPCTL=0x00000000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep7-in: EPCTL=0x00000000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep7-out: EPCTL=0x00000000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep8-in: EPCTL=0x00000000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep8-out: EPCTL=0x00000000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep9-in: EPCTL=0x00000000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep9-out: EPCTL=0x00000000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep10-in: EPCTL=0x00000000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep10-out: EPCTL=0x00000000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep11-in: EPCTL=0x00000000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep11-out: EPCTL=0x00000000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep12-in: EPCTL=0x00000000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep12-out: EPCTL=0x00000000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep13-in: EPCTL=0x00000000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep13-out: EPCTL=0x00000000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep14-in: EPCTL=0x00000000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: ep14-out: EPCTL=0x00000000, SIZ=0x00000000,
DMA=0x00000000
s3c-hsotg s3c-hsotg: DVBUSDIS=0x000017d7, DVBUSPULSE=000005b8
mousedev: PS/2 mouse device common for all mice
S3C Touchscreen driver, (c) 2010 FriendlyARM
touchscreen got loaded successfully : 12 bits
touchscreen-1wire  initialized
backlight-1wire  initialized
input: TouchScreen Pipe as /devices/virtual/input/input0
ts-if  initialized
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c-rtc s3c64xx-rtc: rtc disabled, re-enabling
one_wire_status: 4
s3c-rtc s3c64xx-rtc: rtc core: registered s3c as rtc0
i2c /dev entries driver
Linux video capture interface: v2.00
i2c-core: driver [tuner] using legacy suspend method
i2c-core: driver [tuner] using legacy resume method
i2c-core: driver [msp3400] using legacy suspend method
i2c-core: driver [msp3400] using legacy resume method
usbcore: registered new interface driver usbvision
USBVision USB Video Device Driver for Linux : 0.9.10
one_wire_status: 5
usbcore: registered new interface driver pvrusb2
pvrusb2: V4L in-tree version:Hauppauge WinTV-P...stripped-down