Author Topic: JFFS2 tools HOWTO  (Read 7912 times)

DrWowe

  • Hero Member
  • *****
  • Posts: 696
    • View Profile
    • http://
JFFS2 tools HOWTO
« on: May 09, 2004, 04:52:16 pm »
Well, I finally got around to setting up a cross compiler, instead of doing more important things.  

Anyway, I\'ve uploaded a package called mtdtools.tar.gz that contains some nifty things, among them the blkmtd.o kernel driver and various mtd and jffs2 utilities.

WARNING:  I used the 6000 kernel sources as a base for the module, and only tested on SL-6000L.  YMMV.  No warentees or guarentees, and I\'m not responsible if you brick your machine.  

If you want to format a block device to use jffs2, here\'s a quick HOWTO.  Run these commands from the command line, as root.

First run a little script I whipped up to create additional MTD entries in /dev:
$ sh MakeMoreMTDDevs.sh

Next, load the kernel module, which attaches an MTD device to the specified block device.  

$ insmod blkmtd.o device=/dev/mydevice  

Since mtd0-3 are used by the internal flash, the device should appear as mtd4.  Use dmesg to confirm this.  If you do more than one, then you\'ll get mtd5, mtd6, ...

$ dmesg

Now, format your device for jffs2:

$ flash_eraseall -j /dev/mtd4   (be careful here, if you type the wrong number you could hose your internal flash!)

It\'s ready.  Now you can mount it:

$ mount /dev/mtdblock4 /mnt/mymountpoint -t jffs2

Ethereal

  • Full Member
  • ***
  • Posts: 236
    • View Profile
    • http://
JFFS2 tools HOWTO
« Reply #1 on: May 09, 2004, 07:00:13 pm »
Very cool!  How is the performance of JFFS2 formatted SD cards vs ETX2?
SL-6000L, Sharp ROM 1.12;
Socket Rev 2.5 CF Bluetooth::SE T608;
Sandisk 512MB SD, formatted ext2;
Pocketop IR Keyboard

DrWowe

  • Hero Member
  • *****
  • Posts: 696
    • View Profile
    • http://
JFFS2 tools HOWTO
« Reply #2 on: May 09, 2004, 08:35:31 pm »
I plan to do some benchmarking sometime next week.  While I\'m at it, I\'m going to compare an MMC with an SD card and see if I can resolve that question.  When I get the tools and methodology figured out, I\'ll upload everything so others can post numbers too.

Quote
Coming soon: SL-6000


Heh heh heh...

Ethereal

  • Full Member
  • ***
  • Posts: 236
    • View Profile
    • http://
JFFS2 tools HOWTO
« Reply #3 on: May 09, 2004, 08:47:11 pm »
Quote
Quote
Coming soon: SL-6000


Heh heh heh...


Yeah, well, as more and more rough spots get smoothed over, it\'s getting harder to resist...
SL-6000L, Sharp ROM 1.12;
Socket Rev 2.5 CF Bluetooth::SE T608;
Sandisk 512MB SD, formatted ext2;
Pocketop IR Keyboard

DrWowe

  • Hero Member
  • *****
  • Posts: 696
    • View Profile
    • http://
JFFS2 tools HOWTO
« Reply #4 on: May 10, 2004, 10:05:49 pm »
BTW, just wondering, what\'s the typical turnaround time for a submission to the DL area?  I submitted this yesterday and it still hasn\'t shown up.

DrWowe

  • Hero Member
  • *****
  • Posts: 696
    • View Profile
    • http://
JFFS2 tools HOWTO
« Reply #5 on: May 14, 2004, 09:38:53 am »
There it is:

http://www.zaurususergroup.com/modules.php...date=1084368817

Enjoy.  

BTW, if anyone decides to try this on another machine (besides 6000) please post if it works or not.  It\'s been my experience that the kernels between various models are pretty much compatible so I can\'t think of any particular reason why it shouldn\'t...  but please make backups just to be safe.   I think a little caution is prudent when you\'re running tools named \"flash_eraseall\"  

tz

  • Full Member
  • ***
  • Posts: 102
    • View Profile
    • http://
JFFS2 tools HOWTO
« Reply #6 on: May 14, 2004, 05:40:58 pm »
Which utility functions as an fsck?  There are a few deleted or erased blocks appearing in my dmesg that I would like to get rid of.  (apparently the current jffs2 will scan, but not clear things out unless they happen to be overwritten)

DrWowe

  • Hero Member
  • *****
  • Posts: 696
    • View Profile
    • http://
JFFS2 tools HOWTO
« Reply #7 on: May 14, 2004, 06:34:22 pm »
Quote
Which utility functions as an fsck?  There are a few deleted or erased blocks appearing in my dmesg that I would like to get rid of.  (apparently the current jffs2 will scan, but not clear things out unless they happen to be overwritten)


Don\'t know if such thing exists - sorry.

DrWowe

  • Hero Member
  • *****
  • Posts: 696
    • View Profile
    • http://
JFFS2 tools HOWTO
« Reply #8 on: May 14, 2004, 06:42:37 pm »
Actually, you could probably take care of it by filling your partition with a gibberish and then deleting it.   Run df to see how much free space you have, then do:

$ dd if=/dev/urandom of=gibberish bs=1024 count=(free space in KB)
followed by:
$ rm gibberish

rgrep

  • Full Member
  • ***
  • Posts: 149
    • View Profile
JFFS2 tools HOWTO
« Reply #9 on: May 15, 2004, 03:09:23 am »
Quote
Actually, you could probably take care of it by filling your partition with a gibberish and then deleting it.   Run df to see how much free space you have, then do:

$ dd if=/dev/urandom of=gibberish bs=1024 count=(free space in KB)
followed by:
$ rm gibberish


Another slightly faster and easier way of doing this is:

Code: [Select]
cp /dev/zero gibberish

rm gibberish


Good work on the JFFS2 stuff BTW, I\'ve always wanted a JFFS2 FS on my SD card but didn\'t know it was possible until now.

Matt
[img]https://www.oesf.org/forums/style_emoticons/default/smile.gif\" border=\"0\" class=\"linked-sig-image\" /] Has: Dynamism C760 / Linksys WCF12 WiFi / Kingston 512MB SD
[img]https://www.oesf.org/forums/style_emoticons/default/biggrin.gif\" border=\"0\" class=\"linked-sig-image\" /] Loves: pdaXrom / Warwalking
[img]https://www.oesf.org/forums/style_emoticons/default/sad.gif\" border=\"0\" class=\"linked-sig-image\" /] Hates: NetGear MA701 WiFi / SanDisk 256MB SD / C760 Charging Faults

DrWowe

  • Hero Member
  • *****
  • Posts: 696
    • View Profile
    • http://
JFFS2 tools HOWTO
« Reply #10 on: May 15, 2004, 06:03:10 am »
I spefically refrained from using /dev/zero, because jffs2 will compress it down and you will wait a very long time..   Stick to urandom.

Ethereal

  • Full Member
  • ***
  • Posts: 236
    • View Profile
    • http://
JFFS2 tools HOWTO
« Reply #11 on: May 16, 2004, 10:38:48 pm »
Dr. Wowe,

Any speed comparisons for JFFS2 vs EXT2 on CF/SD cards yet?
SL-6000L, Sharp ROM 1.12;
Socket Rev 2.5 CF Bluetooth::SE T608;
Sandisk 512MB SD, formatted ext2;
Pocketop IR Keyboard

lede1

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • http://
JFFS2 tools HOWTO
« Reply #12 on: May 17, 2004, 04:13:03 pm »
Hi folks,

Great job! I always thought that this is impossible or at least totally impractical (performance wise).

I have a SL750 and thought to give it a try following your instructions above. When I try to load the blkmtd.o module, I get the following messages in dmesg:

#  insmod blkmtd.o device=/dev/mmcda
# dmesg
<snip>
blkmtd: mtd3: [/dev/mmcda] erase_size = 128K
Unable to handle kernel paging request at virtual address ffffffff
pgd = c0004000
*pgd = 00000000, *pmd = 00000000
Internal error: Oops: 0
CPU: 0
pc : [<c004a524>]    lr : [<c5ae040c>]    Tainted: P
sp : c151df88  ip : c151df9c  fp : c151df98
r10: c13d6000  r9 : 00039690  r8 : c5ae1f60
r7 : c5ae1f80  r6 : 00000000  r5 : 00000000  r4 : c151c000
r3 : a0000093  r2 : a0000093  r1 : ffffffff  r0 : c151c000
Flags: NzCv  IRQs off  FIQs on  Mode SVC_32  Segment user
Control: 197F  Table: A0BA8000  DAC: 00000015  PID:  0
Process tdd (pid: 13359, stackpage=c151d000)
Stack: (0xc151df78 to 0xc151e000)
df60:                                                       c5ae040c c004a524
df80: a0000093 ffffffff c151c000 c151dff4 c151df9c c5ae040c c004a4f4 00000000
dfa0: 00000000 c151dfb0 c002e8d4 c003e3b8 c151c000 c151dfbc 00000e00 00000000
dfc0: c151c000 00000000 00000000 00000000 c5ae1da0 00000000 c5ae1f80 c5ae1f60
dfe0: 00039690 c13d6000 00000000 c151dff8 c002fc04 c5ae0374 00000000 00000000
Backtrace:
Function entered at [<c004a4e8>] from [<c5ae040c>]
 r4 = C151C000
Function entered at [<c5ae0368>] from [<c002fc04>]
Code: e5843334 e10f2000 e3823080 e121f003 (e5913000)
blkmtd: version 1.9

I tried it with your blkmtd and tried to build one myself, using a crosstool (gcc 2.95.3, glibc 2.2.5) and the
linux-2.4.18-rmk7-pxa3-embedix sources. I get the same error messages with both modules....

Am I missing something here? Did anyone else try this on a 7xx? I am running pdaXrom 1.0.5, btw...

Cheers, Levent

amrein

  • Sr. Member
  • ****
  • Posts: 345
    • View Profile
    • http://
JFFS2 tools HOWTO
« Reply #13 on: May 17, 2004, 04:41:37 pm »
Try with the pdaXrom toolchain. It\'s gcc 3.3.2. And don\'t forget to flash your kernel too.

lede1

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • http://
JFFS2 tools HOWTO
« Reply #14 on: May 18, 2004, 08:39:28 am »
Hi!

@amrein: Thanks for your answer. The reason why I used gcc-2.95.3 is that the kernel included was build with (according to /proc/version). I hoped to build the module without flashing the whole kernel.

Do you know where one can get the source and config file for the kernel used in pdaXrom 1.0.5?

Cheers, Levent