JFFS2 softlinks problem - repost from email

MikeW mw_phil at yahoo.co.uk
Wed May 23 08:45:07 EDT 2007


Jakub Bednar <bednar <at> hnilux.racom.cz> writes:

>MikeW <mw_phil <at> yahoo.co.uk> writes:
> 
> What do you mean by,
> "I fill the NAND JFFS2 partition with data several times ..." ?
> 
> I presume the links you refer to are symbolic links (ln -s ...)
> 
> You should describe the procedure you use (including setting up the links,
> and "filling the partition with data several times") and the problems you
> observe, What exactly "stops working" - apart from access to files on the
> affected partition(s) ?
> 
> Regards,
> MikeW
> 

Jakub Bednar <bednar <at> hnilux.racom.cz> writes:

Sorry, I'll try to be more clear.

I have a board based on AMD DBAu1550 boards.
I'm using buildroot from November 2006 with
Linux 2.6.16.20.

The cramfs initrd image is created with mkcramfs and
concatenated with the kernel. At boottime, kernel
finds CRAMFS_MAGIC and creates a mtd partition containing
this image and boots it as first rootfs.

JFFS2 partition is created from desired tree.
In the tree there are soft links e.g. ln -sf /var/log /tmp/log;
The tree is then compressed
build machine: tar -zcf pkg.tgz tree/*
build machine: cat pkg.tgz | ssh target_machine "cat - > /tmp/pkg.tgz"
(tmpfs) 
target machine: flash_erase mtd0 0x00 48;
target machine: mount -t jffs2 /dev/mtd0 /mnt;
target machine: tar -ztf /tmp/pkg.tgz; #cheks the tarbal ...
target machine: tar -zxf /tmp/pkg.tgz -C /mnt/

There are other checks (sync, remount mtd0 ro ...)
target machine: pivot_root /mnt /mnt/rom

Now the jffs2 become rootfs and /sbin and /bin are soft
links to /rom/sbin and /rom/bin (the initrd). 
The system now works OK. It's using some staff from 
one of NAND partitions as well without any problems.

Now the test on the NAND flash
target machine: flash_eraseall -j /dev/mtd6
target machine: mount -t jffs2 mtd6 /mnt2
and runing script as follows:
	while [ 1 ]; do 
		cat /dev/urandom > /mnt2/file; # fills up the fs
		rm /mnt2/file; #frees it again
	done;
(The script using dd with 512kB files causes the same error but it
takes more time) The error sometimes occur in the first loop of
this script after reboot, sometimes later.

After a while many things goes wrong and each time goes wrong something
else.

1. cd /root/.ssh (which is in jffs2 NOR flash) 
   return Input/Output Error
2. disappears /var/log (which is a soft link in jffs2 NOR flash 
   created with ln -s into /tmp - tmpfs ) 
3. disappear all links from /usr/sbin (cramfs initrd image) 
   to /usr/sbin/busybox

The JFFS2 erase block size is set correctly and its using priority 
compression. I know I'm not using the newest JFFS2 and I'm ready
to work on Linux 2.6.20 to put it into buildroot and hopefully it
will solve my trouble. But If You know what causes this problem and
how to fix it. Or if You know that in 2.6.20 it will do the same.
It will be really helpful to me.

Thank You very mych.

Regards,

Jakub





More information about the linux-mtd mailing list