JFFS2, CF, PCMCIA adapter, ATA
Hi there,
I've been trying to create a jffs2 image on a 16MB compact flash card today. I've got a pcmcia-to-cf adapter that works well for treating the CF like a small disk. The unit I'm plugging the flash into is GCT Allwell set-top box with a CF clot in the back. The CF hard shows up as the frist IDE hard disk. Using lilo and ext2, I can boot a kernel with it. I would rather use jffs2, for a variety of reasons.
How do I create a "loopback" jffs2 filesystem? How do I create a jffs2 filesystem on the CF card using the PCMCIA adapter (so that the CF filesystem can be booted and mounted on the GCT-Allwell)? The mkfs.jffs2 utility creates a file of the filesystem tree I've created (kernel, busybox, etc.). ... what next?
I'm using 2.4.13, with mtd and jffs2 compiled in. No devfs.
If there's documentation I should be reading, please point me at it. I've spent a good part of the day with google and the cvs sources for 'mtd'.
Thanks,
Michael
Quoted 3 lines · Michael Rothwell
I've been trying to create a jffs2 image on a 16MB compact flash card today. I've got a pcmcia-to-cf adapter that works well for treating the CF like a small disk.
The CF _is_ a small disk. You may think it has flash inside - we couldn't possibly comment. As far as you're concerned, it's just alien technology which allows them to stick a real IDE hard drive inside that package and stops you from hearing the whirring sounds.
There is a driver which uses a real hard drive as backing store for a faked MTD device - see the 'blkmtd' driver. I haven't used it - others can perhaps give you more helpful advice.
Quoted 1 line
How do I create a "loopback" jffs2 filesystem?
# insmod mtdram total_size=16386 erase_size=64 # dd if=jffs2-image of=/dev/mtdblock0 # mount -t jffs2 /dev/mtdblock0 /mnt/jffs2
Quoted 1 line
How do I create a jffs2 filesystem on the CF card using the PCMCIA adapter
# dd if=jffs2-image of=/dev/hda (or hda1, hda2, etc.) # insmod blkmtd device=/dev/hda # mount -t jffs2 /dev/mtdblock0 /mnt/jffs2
You may want partitioning if you want to boot from this too, not just use it as filesystem.
Quoted 1 line
I'm using 2.4.13, with mtd and jffs2 compiled in. No devfs.
There have been some blkmtd updates since then. I'm hoping the maintainer will send those to Linus if appropriate.
Signature · 1 line
dwmw2
Quoted 1 line · David Woodhouse
As far as you're concerned, it's just alien technology
Okey-dokey, then.
Quoted 3 lines
# dd if=jffs2-image of=/dev/hda (or hda1, hda2, etc.) # insmod blkmtd device=/dev/hda # mount -t jffs2 /dev/mtdblock0 /mnt/jffs2
... followed by a litany of "argh, block not erased" type messages in the syslog. Mount then returns. Then, I try to copy some files into the mounted jffs2 filesystem ... "cp" causes an oops and the interrupt handler gets killed.
Quoted 2 lines
You may want partitioning if you want to boot from this too, not just use it as filesystem.
Am I correct in assuming that I can make partitions with fdisk, then
# dd if=flash.jffs2 of=/dev/hde1 # modprobe blkmtd device=/dev/hde1 # mount -t jffs2 /dev/mtdblock0 /mnt/flash
...?
What would this look like in lilo and /etc/fstab on the device that will hopefully be booting from the jffs2 image?
Quoted 3 lines
There have been some blkmtd updates since then. I'm hoping the maintainer
will send those to Linus if appropriate.
Maybe the updates won't oops... :)
Do you use mtdram to create jffs2 filesystems? Or some other method?
Thanks,
Michael
Quoted 7 lines · Michael Rothwell
Quoted 3 lines · David Woodhouse
# dd if=jffs2-image of=/dev/hda (or hda1, hda2, etc.) # insmod blkmtd device=/dev/hda # mount -t jffs2 /dev/mtdblock0 /mnt/jffs2... followed by a litany of "argh, block not erased" type messages in the syslog. Mount then returns.
That bit's expected.
Quoted 2 lines
Then, I try to copy some files into the mounted jffs2 filesystem ...
"cp" causes an oops and the interrupt handler gets killed.
That bit isn't. Backtrace etc. please.
Quoted 11 lines
Quoted 2 lines
You may want partitioning if you want to boot from this too, not just use it as filesystem.
Am I correct in assuming that I can make partitions with fdisk, then
# dd if=flash.jffs2 of=/dev/hde1 # modprobe blkmtd device=/dev/hde1 # mount -t jffs2 /dev/mtdblock0 /mnt/flashWhat would this look like in lilo and
/etc/fstabon the device that will hopefully be booting from the jffs2 image?
LILO isn't going to boot a kernel on a JFFS2 file system. You'll need to make a separate partition to hold your kernel.
The above mount command translates to /etc/fstab just as you'd expect. You have to load the module first though. I think the new version of blkmtd allows you to specify the device to use on the kernel command line.
Quoted 1 line
Maybe the updates won't oops... :)
Maybe :)
Quoted 1 line
Do you use mtdram to create jffs2 filesystems? Or some other method?
No, I use mkfs.jffs2. It produces a more compact image.
Signature · 1 line
dwmw2
Sorry it took so long; I had to copy the oops output from the console screen... here it is, by way of ksymoops:
invalid operand: 0000 CPU: 0 EIP: 0010:[<c015d8af>] Not tainted
Using defaults from ksymoops -t elf32-i386 -a i386
EFLAGS: 00010296
eax: 0000003e ebx: c32f8078 ecx: c5374000 edx: 00000001
esi: 00000003 edi: c31a9ecc ebp: c0d763d0 esp: c1d43eb4
ds: 0018 es: 0018 ss: 0018
Process cp (pid: 1335, stackpage=c1d43000)
Stack: c02166a0 00020908 000208dc 00000000 00007fb9 00000000 c1d46100
c2ca8658
00000202 c3226884 c3226a18 c3226af8 c3226ae0 c015c782
c31a9ecc c0d763d0
0003b0c1 c3226ae0 c24b37b0 c2d5f190 c1d46100 c015b192
c31a9ecc c3226ae0
Call Trace: [<c015c782>] [<c015b192>] [<c0139b77>] [<c0139c26>]
[<c0106de3>]
Code: 0f 0b 83 c4 0c 3b 5f 78 74 2a 3b 5f 7c 74 25 8b 45 0c 39 43Quoted 1 line
Quoted 1 line
EIP;
c015d8af<jffs2_mark_node_obsolete+143/290> <=====
Trace; c015c782 <jffs2_add_fd_to_list+5e/ac> Trace; c015b192 <jffs2_symlink+3ba/3e0> Trace; c0139b77 <vfs_symlink+63/94>
Trace; c0139c26 <sys_symlink+7e/cc>
Trace; c0106de3 <system_call+33/38>
Code; c015d8af <jffs2_mark_node_obsolete+143/290> 00000000 <_EIP>:
Code; c015d8af <jffs2_mark_node_obsolete+143/290> <=====
0: 0f 0b ud2a <=====
Code; c015d8b1 <jffs2_mark_node_obsolete+145/290>
2: 83 c4 0c add $0xc,%esp
Code; c015d8b4 <jffs2_mark_node_obsolete+148/290>
5: 3b 5f 78 cmp 0x78(%edi),%ebx
Code; c015d8b7 <jffs2_mark_node_obsolete+14b/290>
8: 74 2a je 34 <_EIP+0x34> c015d8e3
<jffs2_mark_node_obsolete+177/290>
Code; c015d8b9 <jffs2_mark_node_obsolete+14d/290>
a: 3b 5f 7c cmp 0x7c(%edi),%ebx
Code; c015d8bc <jffs2_mark_node_obsolete+150/290>
d: 74 25 je 34 <_EIP+0x34> c015d8e3
<jffs2_mark_node_obsolete+177/290>
Code; c015d8be <jffs2_mark_node_obsolete+152/290>
f: 8b 45 0c mov 0xc(%ebp),%eax
Code; c015d8c1 <jffs2_mark_node_obsolete+155/290>
12: 39 43 00 cmp %eax,0x0(%ebx)
<0>Kernel Panic: Aiee, killing interrupt handler!
Quoted 47 lines · David Woodhouse
Quoted 7 lines · Michael Rothwell
Quoted 3 lines · David Woodhouse
# dd if=jffs2-image of=/dev/hda (or hda1, hda2, etc.) # insmod blkmtd device=/dev/hda # mount -t jffs2 /dev/mtdblock0 /mnt/jffs2... followed by a litany of "argh, block not erased" type messages in the syslog. Mount then returns.
That bit's expected.
Quoted 2 lines
Then, I try to copy some files into the mounted jffs2 filesystem ...
"cp" causes an oops and the interrupt handler gets killed.That bit isn't. Backtrace etc. please.
Quoted 11 lines
Quoted 2 lines
You may want partitioning if you want to boot from this too, not just use it as filesystem.
Am I correct in assuming that I can make partitions with fdisk, then
# dd if=flash.jffs2 of=/dev/hde1 # modprobe blkmtd device=/dev/hde1 # mount -t jffs2 /dev/mtdblock0 /mnt/flashWhat would this look like in lilo and
/etc/fstabon the device that will hopefully be booting from the jffs2 image?LILO isn't going to boot a kernel on a JFFS2 file system. You'll need to make a separate partition to hold your kernel.
The above mount command translates to
/etc/fstabjust as you'd expect. You have to load the module first though. I think the new version of blkmtd allows you to specify the device to use on the kernel command line.Quoted 1 line
Maybe the updates won't oops... :)
Maybe :)
Quoted 1 line
Do you use mtdram to create jffs2 filesystems? Or some other method?
No, I use mkfs.jffs2. It produces a more compact image.
Signature · 1 line
dwmw2
Quoted 2 lines · Michael Rothwell
Sorry it took so long; I had to copy the oops output from the console screen... here it is, by way of ksymoops:
That's a BUG(). And it's probably the one in ACCT_PARANOIA_CHECK():
#define ACCT_PARANOIA_CHECK(jeb) do { \
__u32 my_used_size = 0; \
struct jffs2_raw_node_ref *ref2 = jeb->first_node; \
while (ref2) { \
if (!(ref2->flash_offset & 1)) \
my_used_size += ref2->totlen; \
ref2 = ref2->next_phys; \
} \
if (my_used_size != jeb->used_size) { \
printk(KERN_NOTICE "Calculated used size %08x !=
stored used size %08x\n", my_used_size, jeb->used_size); \
BUG(); \
} \
} while(0)I haven't seen those trigger for months - please could you set CONFIG_JFFS2_FS_DEBUG=1 and capture _all_ (inc. KERN_DEBUG) messages from mounting a clean filesystem to the time it oopses? A serial console may be useful.
How did you build your JFFS2 image? What arguments did you give to mkfs.jffs2 if you used it?
Signature · 1 line
dwmw2