Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

How to use jffs2 in flash ?

Altera_Forum
Honored Contributor II
1,567 Views

hi hippo 

 

I can cp -a some dirs to /mnt on uclinux with using initramfs. 

In other word, i have build rootfs in my flash(mtdblock0)that can mount it to /mnt dir, and i can see some dirs in /mnt dir. 

 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

BusyBox v1.1.1-pre0 (2006.04.20-12:52+0000) Built-in shell (msh) 

Enter &#39;help&#39; for a list of built-in commands. 

# mount -t jffs2 /dev/mtdblock0 /mnt# cd /mnt# ls -l# mkdir proc sys var tmp mnt# cp -a /init /etc /dev /bin /sbin /usr /root /home /opt .# ls -l 

drwxr-xr-x    2 root     root            0 Nov 29 17:00 bin 

drwxr-xr-x    6 root     root            0 Nov 29 17:00 dev 

drwxr-xr-x    4 root     root            0 Nov 29 17:00 etc 

drwxr-xr-x    3 root     root            0 Nov 29 17:00 home 

lrwxrwxrwx    1 root     root           10 Nov 29 17:03 init -> /sbin/init 

drwxr-xr-x    2 root     root            0 Nov 29 17:01 mnt 

drwxr-xr-x    2 root     root            0 Nov 29 17:00 opt 

drwxr-xr-x    2 root     root            0 Nov 29 17:01 proc 

drwxr-xr-x    2 root     root            0 Nov 29 17:00 root 

drwxr-xr-x    2 root     root            0 Nov 29 17:00 sbin 

drwxr-xr-x    2 root     root            0 Nov 29 17:01 sys 

drwxr-xr-x    2 root     root            0 Nov 29 17:01 tmp 

drwxr-xr-x    5 root     root            0 Nov 29 17:00 usr 

drwxr-xr-x    2 root     root            0 Nov 29 17:01 var# cd /# umount /mnt# ls 

bin   etc   init  mnt   proc  sbin  tmp   var 

dev   home  lib   opt   root  sys   usr# [/b] 

--- Quote End ---  

 

 

Check rootfs in mnt dir. 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

BusyBox v1.1.1-pre0 (2006.04.20-12:52+0000) Built-in shell (msh) 

Enter &#39;help&#39; for a list of built-in commands. 

# mount -t jffs2 /dev/mtdblock0 /mnt# cd /mnt# ls -l 

drwxr-xr-x    2 root  root            0 Nov 29 17:00 bin 

drwxr-xr-x    6 root  root            0 Nov 29 17:00 dev 

drwxr-xr-x    4 root  root            0 Nov 29 17:00 etc 

drwxr-xr-x    3 root  root            0 Nov 29 17:00 home 

lrwxrwxrwx    1 root  root        10 Nov 29 17:03 init -> /sbin/init 

drwxr-xr-x    2 root  root            0 Nov 29 17:01 mnt 

drwxr-xr-x    2 root  root            0 Nov 29 17:00 opt 

drwxr-xr-x    2 root  root            0 Nov 29 17:01 proc 

drwxr-xr-x    2 root  root            0 Nov 29 17:00 root 

drwxr-xr-x    2 root  root            0 Nov 29 17:00 sbin 

drwxr-xr-x    2 root  root            0 Nov 29 17:01 sys 

drwxr-xr-x    2 root  root            0 Nov 29 17:01 tmp 

drwxr-xr-x    5 root  root            0 Nov 29 17:00 usr 

drwxr-xr-x    2 root  root            0 Nov 29 17:01 var# cd /# umount /mnt# [/b] 

--- Quote End ---  

Q1: How to do that next step ? 

 

Q2: If i want to store some files in flash with using jffs2. 

How to do it ?  

Can I use "nios2-flash-programmer" command to store files to flash in sdk shell ? or i need to change specific format for programming flash. 

 

Thx !
0 Kudos
11 Replies
Altera_Forum
Honored Contributor II
569 Views

A1. You can try root jffs2 now with kernel command string. 

 

A2. You need to use mkfs.jffs2. You may read Jdhar&#39;s EPCS guide.
0 Kudos
Altera_Forum
Honored Contributor II
569 Views

 

--- Quote Start ---  

originally posted by hippo@Jun 3 2006, 08:14 AM 

a1. you can try root jffs2 now with kernel command string. 

 

a2. you need to use mkfs.jffs2. you may read jdhar&#39;s epcs guide. 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=15827) 

--- quote end ---  

 

--- Quote End ---  

 

 

hi hippo 

 

I meet the same problem again. 

 

This is my processing setps as follows: 

 

1. I don&#39;t use initramfs and add "root=/dev/mtdblock0 rw rootfs=jffs2" string in kernel command line. 

 

2. Rebuild kernel to generate new zImage. 

 

3. Download zImage in sdk shell 

 

4. Use "nios2-terminal" command to input uclinux OS.  

 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

uClinux/Nios II 

Altera Nios II support © 2004 Microtronix Datacom Ltd. 

Built 1 zonelists 

Kernel command line: root=/dev/mtdblock0 rw rootfs=jffs2 

PID hash table entries: 64 (order: 6, 1024 bytes) 

Dentry cache hash table entries: 2048 (order: 1, 8192 bytes) 

Inode-cache hash table entries: 1024 (order: 0, 4096 bytes) 

Memory available: 6768k/8192k RAM, 0k/0k ROM (1185k kernel code, 144k data) 

Mount-cache hash table entries: 512 

SCSI subsystem initialized 

usbcore: registered new driver usbfs 

usbcore: registered new driver hub 

JFFS2 version 2.2. (NAND) © 2001-2003 Red Hat, Inc. 

io scheduler noop registered 

io scheduler deadline registered (default) 

Serial: JTAG UART driver $Revision: 1.4 $ 

ttyJ0 at MMIO 0x80481120 (irq = 1) is a jtag_uart 

Altera NDK flash (AMD): Found 1 x16 devices at 0x0 in 8-bit bank 

Amd/Fujitsu Extended Query Table at 0x0040 

number of CFI chips: 1 

cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness. 

cmdlinepart partition parsing not available 

RedBoot partition parsing not available 

Using Altera NDK partition definition 

Creating 1 MTD partitions on "Altera NDK flash (AMD)": 

0x00000000-0x00400000 : "jffs2" 

usbmon: debugfs is not available 

driver isp1362-hcd, 2005-04-04 

isp1362-hcd isp1362-hcd: ISP1362 Host Controller 

isp1362_hc_reset: 

isp1362-hcd isp1362-hcd: new USB bus registered, assigned bus number 1 

isp1362-hcd isp1362-hcd: irq 4, io mem 0x804810d0 

isp1362_hc_start: 

isp1362-hcd isp1362-hcd: ISP1362 Memory usage: 

isp1362-hcd isp1362-hcd: ISTL:    2 *  256:      512 @ $0000:$0100 

isp1362-hcd isp1362-hcd: INTL: 16 * ( 64+8):  1152 @ $0200 

isp1362-hcd isp1362-hcd: ATL : 32 * ( 64+8):  2304 @ $0680 

isp1362-hcd isp1362-hcd: USED/FREE: 3968    128 

usb usb1: configuration# 1 chosen from 1 choice 

hub 1-0:1.0: USB hub found 

hub 1-0:1.0: 2 ports detected 

ISP1362 Host Controller, irq 4 

Initializing USB Mass Storage driver... 

usbcore: registered new driver usb-storage 

USB Mass Storage support registered. 

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,0)[/b] 

--- Quote End ---  

 

 

How to solve it ? 

 

Thx !
0 Kudos
Altera_Forum
Honored Contributor II
569 Views

Please enable mtd debug level 2 or 3 in kernel config.

0 Kudos
Altera_Forum
Honored Contributor II
569 Views

 

--- Quote Start ---  

originally posted by hippo@Jun 3 2006, 09:26 AM 

please enable mtd debug level 2 or 3 in kernel config. 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=15837) 

--- quote end ---  

 

--- Quote End ---  

 

 

hi hippo 

 

I already enable mtd degug level is 2 in kernel config. 

 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

uClinux/Nios II 

Altera Nios II support © 2004 Microtronix Datacom Ltd. 

Built 1 zonelists 

Kernel command line: root=/dev/mtdblock0 rw rootfs=jffs2 

PID hash table entries: 64 (order: 6, 1024 bytes) 

Dentry cache hash table entries: 2048 (order: 1, 8192 bytes) 

Inode-cache hash table entries: 1024 (order: 0, 4096 bytes) 

Memory available: 6768k/8192k RAM, 0k/0k ROM (1186k kernel code, 143k data) 

Mount-cache hash table entries: 512 

SCSI subsystem initialized 

usbcore: registered new driver usbfs 

usbcore: registered new driver hub 

JFFS2 version 2.2. (NAND) © 2001-2003 Red Hat, Inc. 

io scheduler noop registered 

io scheduler deadline registered (default) 

Serial: JTAG UART driver $Revision: 1.4 $ 

ttyJ0 at MMIO 0x80481120 (irq = 1) is a jtag_uart 

Altera NDK flash (AMD): Found 1 x16 devices at 0x0 in 8-bit bank 

Amd/Fujitsu Extended Query Table at 0x0040 

number of CFI chips: 1 

cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness. 

cmdlinepart partition parsing not available 

RedBoot partition parsing not available 

Using Altera NDK partition definition 

Creating 1 MTD partitions on "Altera NDK flash (AMD)": 

0x00000000-0x00400000 : "jffs2" 

mtd: Giving out device 0 to jffs2 

usbmon: debugfs is not available 

driver isp1362-hcd, 2005-04-04 

isp1362-hcd isp1362-hcd: ISP1362 Host Controller 

isp1362_hc_reset: 

isp1362-hcd isp1362-hcd: new USB bus registered, assigned bus number 1 

isp1362-hcd isp1362-hcd: irq 4, io mem 0x804810d0 

isp1362_hc_start: 

isp1362-hcd isp1362-hcd: ISP1362 Memory usage: 

isp1362-hcd isp1362-hcd: ISTL:    2 *  256:      512 @ $0000:$0100 

isp1362-hcd isp1362-hcd: INTL: 16 * ( 64+8):  1152 @ $0200 

isp1362-hcd isp1362-hcd: ATL : 32 * ( 64+8):  2304 @ $0680 

isp1362-hcd isp1362-hcd: USED/FREE: 3968    128 

usb usb1: configuration# 1 chosen from 1 choice 

hub 1-0:1.0: USB hub found 

hub 1-0:1.0: 2 ports detected 

ISP1362 Host Controller, irq 4 

Initializing USB Mass Storage driver... 

usbcore: registered new driver usb-storage 

USB Mass Storage support registered. 

mtdblock_open 

ok 

mtdblock: read on "jffs2" at 0x0, size 0x200 

mtdblock_release 

ok 

mtdblock_open 

ok 

mtdblock: read on "jffs2" at 0x0, size 0x200 

mtdblock_release 

ok 

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,0)[/b] 

--- Quote End ---  

 

 

Thx !
0 Kudos
Altera_Forum
Honored Contributor II
569 Views

It tried to read mtd sector 00 twice. but failed to mount? 

Please try mtd debug level 3. 

 

And try to trace into kernel source init/main.c and do_mount .
0 Kudos
Altera_Forum
Honored Contributor II
569 Views

 

--- Quote Start ---  

originally posted by hippo@Jun 3 2006, 10:02 AM 

it tried to read mtd sector 00 twice. but failed to mount? 

please try mtd debug level 3. 

 

and try to trace into kernel source init/main.c and do_mount . 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=15839) 

--- quote end ---  

 

--- Quote End ---  

 

 

hi hippo 

 

I have set mtd debug level is 3 that got the same result again. http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif  

 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

USB Mass Storage support registered. 

mtdblock_open 

ok 

mtdblock: read on "jffs2" at 0x0, size 0x200 

mtdblock_release 

ok 

mtdblock_open 

ok 

mtdblock: read on "jffs2" at 0x0, size 0x200 

mtdblock_release 

ok 

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,0)[/b] 

--- Quote End ---  

 

 

How to do that is croectlly ? 

 

Thx !
0 Kudos
Altera_Forum
Honored Contributor II
569 Views

I will trace this problem later when I have spare time. 

For now, you can boot with initramfs, and put your user apps and data on jffs2 drive. You can copy them from usb disk to jffs2. Or try mkfs.jffs2. 

 

Root on jffs2 will save only around 300 kB.
0 Kudos
Altera_Forum
Honored Contributor II
569 Views

 

--- Quote Start ---  

originally posted by hippo@Jun 3 2006, 09:31 PM 

i will trace this problem later when i have spare time. 

for now, you can boot with initramfs, and put your user apps and data on jffs2 drive. you can copy them from usb disk to jffs2. or try mkfs.jffs2. 

 

root on jffs2 will save only around 300 kb. 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=15851) 

--- quote end ---  

 

--- Quote End ---  

 

 

hi hippo 

 

Thank you very much ! 

I have not try to copy files from usb disk to jffs2 drive yet. 

but i think that is OK.
0 Kudos
Altera_Forum
Honored Contributor II
569 Views

hi hippo 

 

I can copy files from usb compact flash to jffs2 drive(flash) in mnt dir, as following: 

 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

BusyBox v1.1.1-pre0 (2006.04.20-12:52+0000) Built-in shell (msh) 

Enter &#39;help&#39; for a list of built-in commands. 

# usb 1-2: new full speed USB device using isp1362-hcd and address 2 

usb 1-2: configuration# 1 chosen from 1 choice 

scsi0 : SCSI emulation for USB Mass Storage devices 

  Vendor: eUSB      Model: Compact Flash  Rev: 5.07 

  Type: Direct-Access                      ANSI SCSI revision: 02 

SCSI device sda: 250880 512-byte hdwr sectors (128 MB) 

sda: Write Protect is off 

sda: assuming drive cache: write through 

SCSI device sda: 250880 512-byte hdwr sectors (128 MB) 

sda: Write Protect is off 

sda: assuming drive cache: write through 

sda: sda1 

sd 0:0:0:0: Attached scsi removable disk sda 

# cd /mnt# mkdir usb flash# ls 

flash  usb# cd /mnt# ls -l 

drwxr-xr-x    2 root  root            0 Nov 29 17:00 flash 

drwxr-xr-x    2 root  root            0 Nov 29 17:00 usb# mount -t vfat /dev/sda1 /mnt/usb# mount -t jffs2 /dev/mtdblock0 /mnt/flash# cd /mnt# cd /mnt/usb# ls 

Baby.wav    Baby1.wav readme.txt# cp readme.txt /mnt/flash# cd /mnt/flash# ls 

bin      home        opt      root        tmp 

dev      init        proc        sbin        usr 

etc      mnt      readme.txt  sys      var# rm readme.txt# ls 

bin etc init  opt root  sys usr 

dev home  mnt proc  sbin  tmp var# [/b] 

--- Quote End ---  

0 Kudos
Altera_Forum
Honored Contributor II
569 Views

Good. You don&#39;t need the dirs for rootfs in jffs2 now. You can use jffs2 mount all for user data.

0 Kudos
Altera_Forum
Honored Contributor II
569 Views

 

--- Quote Start ---  

originally posted by hippo@Jun 4 2006, 06:13 AM 

good. you don&#39;t need the dirs for rootfs in jffs2 now. you can use jffs2 mount all for user data. 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=15866) 

--- quote end ---  

 

--- Quote End ---  

 

 

hi hippo  

 

Thank u ! 

 

OK ... 

I will erase all dirs and save user data in jffs2 dirve. 

 

 

jay
0 Kudos
Reply