Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.


  Search this Thread
Old 02-21-2011, 04:45 AM   #1
Registered: Jun 2009
Posts: 36

Rep: Reputation: 5
jffs2 and suggestions

hi all,

i have actually a custom board with Coldfire MCF5307, a 4MB flash and 16MB of sdram.

Actually linux start from a ROMFS located in the flash just after the kernel. So, bootloader load "image.bin" (kernel+romfs) into ram and execute it.

It works fine, but i cannot save anything as non-volatile.

So my idea is to create a jffs2 partition on the last megabyte of the flash, to store some sensible data.

Reading some docs, seems i have to create a jffs2 partition image file from a folder on disk. This is clear. What i don't know is that if i save then this image file on last megabyte of the flash, MTD driver is able to see it automatically at boot.

Is it a right approach ?
Anyone can suggest some links that help on how to do this better ?

Old 02-22-2011, 03:39 PM   #2
Senior Member
Registered: Apr 2009
Posts: 1,838

Rep: Reputation: 160Reputation: 160
If you pass correct MTD information, you can save kernel image at any position.
Old 02-23-2011, 06:24 AM   #3
Registered: Jun 2009
Posts: 36

Original Poster
Rep: Reputation: 5
hi nini09,

many thanks, si specified a partition table in the fw, and i moved forward, now partitions are seen correctly from MTD:

Creating 3 MTD partitions on "physmap-flash":
0x000000000000-0x000000010000 : "Colilo (64K)"
mtd: Giving out device 0 to Colilo (64K)
0x000000010000-0x000000310000 : "Kernel+ROMfs (3072K)"
mtd: Giving out device 1 to Kernel+ROMfs (3072K)
0x000000310000-0x000000400000 : "JFFS2 (960K)"
mtd: Giving out device 2 to JFFS2 (960K)
physmap platform flash device: 00400000 at ffc00000

Then, from here, i created from a pc a jffs2 fs, creating the image file from a folder:

sudo mkfs.jffs2 -r flash -e 64 -o rootfs.jffs2

And written this image in the 960K partition.

But when i try to mount it i get the following error

/ # mount -t jffs2 /dev/mtdblock2 /media
MTDSB: lookup_bdev() returned 0
MTDSB: New superblock for device 2 ("JFFS2 (960K)")
jffs2: Flash size not aligned to erasesize, reducing to 0KiB
jffs2: Too few erase blocks (0)
mount: mounting /dev/mtdblock2 on /media failed: Invalid argument

any help is appreciated.

Old 02-23-2011, 03:24 PM   #4
Senior Member
Registered: Apr 2009
Posts: 1,838

Rep: Reputation: 160Reputation: 160
Different flash chip has different erase block size. Find out a correct value for your chip. The error message complain your erase block size is wrong.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Shifting from Jffs2 to UBIFS sunr2007 Linux - Kernel 3 03-17-2011 08:40 AM
how to mount jffs2 nesta Linux - Kernel 1 08-24-2008 09:39 AM
Problems with CF and jffs2....... webquinty Linux - Embedded & Single-board computer 1 06-13-2008 03:22 AM
NFS and JFFS2 in 2.6.23-rc3 sandyman Linux - Networking 0 09-13-2007 08:35 AM
writing into JFFS2 filesystem Deepak Inbasekaran Programming 0 06-26-2006 04:23 AM > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 01:48 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration