Forum Discussion
Altera_Forum
Honored Contributor
21 years agoR/W Filesystem?
I'm currently running the stock FS, built following the instructions in the Getting Started manual.
Is there any quick way to make this FS read/write? Changing the kernel command line string to 'root=/dev/mtdblock0 rw' didn't work. If this is possible, great -- my second problem is then how to 'save' FS changes back to flash (i.e. surviving a reboot/power cycle). If not, what do I need to do this? All I'd really like to do is be able to update config files and my userland apps via FTP instead of the oftentimes tedious (not to mention expensive) procedure of needing a ($$)Blaster cable and flashing the new FS image everytime I change a line of code. Thanks, Ryan Quantapoint23 Replies
- Altera_Forum
Honored Contributor
Hi Ryan,
> All I'd really like to do is be able to update config files and my userland apps via FTP .... Use jffs2 -- you can keep all of your "system stuff" as is ... and add a r/w jffs2 partition for your config files & apps. You can mount the r/w partition under your ramfs during sysinit ... or add an entry in fstab. Regards, --Scott - Altera_Forum
Honored Contributor
Hi Scott,
Thanks for your reply. I'm still confused as to how exactly to go about setting up a jffs2 partition in my flash. The instructions in the Microtronix Reference Guide assume an external flash card and IDE support. I have on-board flash and (currently) no IDE support in the kernel. I've included some (possibly) relevant information below. Any tips on how to get started? Thanks in advance, Ryanls /dev button console cua0 cua1 cua2 cua3 cua4 cua5 cua6 cua7 cua8 cua9 fb0 fb1 hda hda1 hda2 hda3 hda4 hda5 hda6 hda7 hda8 hdb hdb1 hdb2 hdb3 hdb4 hdb5 hdb6 hdb7 hdb8 i2c-0 i2c-1 input kmem mem null ptyp0 ptyp1 ptyp2 ptyp3 ptyp4 ptyp5 ptyp6 ptyp7 ptyp8 ptyp9 ptypa ptypb ptypc ptypd ptype ptypf ram0 ram1 ram2 ram3 spi tty tty0 tty1 tty2 tty3 tty4 tty5 tty6 tty7 tty8 tty9 ttyJ0 ttyS0 ttyS1 ttyS2 ttyS3 ttyS4 ttyS5 ttyS6 ttyS7 ttyS8 ttyS9 ttyp0 ttyp1 ttyp2 ttyp3 ttyp4 ttyp5 ttyp6 ttyp7 ttyp8 ttyp9 ttypa ttypb ttypc ttypd ttype ttypf zero
Finally, my boot messages in case they help:# cat /proc/mounts rootfs / rootfs rw 0 0 /dev/root / romfs ro 0 0 /dev/ram0 /var ext2 rw 0 0 /dev/ram1 /tmp ext2 rw 0 0 proc /proc proc rw,nodiratime 0 0 sysfs /sys sysfs rw 0 0setup_arch: No persistant network settings signature at 43FF0000 start_mem is 0x4017a000 virtual_end is 0x41000000 Built 1 zonelists Kernel command line: root=/dev/mtdblock0 rw PID hash table entries: 128 (order: 7, 2048 bytes) Dentry cache hash table entries: 4096 (order: 2, 16384 bytes) Inode-cache hash table entries: 2048 (order: 1, 8192 bytes) Mem_init: start=4017a000, end=41000000 Memory available: 14680k/16384k RAM, 0k/0k ROM (1227k kernel code, 280k data) Mount-cache hash table entries: 512 (order: 0, 4096 bytes) NET: Registered protocol family 16 Serial: JTAG UART driver $Revision: 1.3 $ ttyJ0 at MMIO 0xc4000808 (irq = 0) is a jtag_uart RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize smc_probe: 75000 Khz Nios SMSC LAN91C111 Driver (v2.1), (Linux Kernel 2.6) eth0: SMC91C11xFD(rev:1) at 0x4400a000 IRQ:2 MEMSIZE:8192b NOWAIT:0 ADDR: 00:07 ed:00:00:00 smc_probe: 75000 Khz Nios Using anticipatory io scheduler Microtronix map: Found 1 x16 devices at 0x0 in 16-bit bank Amd/Fujitsu Extended Query Table at 0x0040 Microtronix map: CFI does not contain boot bank location. Assuming top. 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 Microtronix development partition definition Creating 2 MTD partitions on "Microtronix map": 0x00200000-0x00800000 : "romfs" 0x00000000-0x00200000 : "loader/kernel" NET: Registered protocol family 2 IP: routing cache hash table of 512 buckets, 4Kbytes TCP: Hash tables configured (established 1024 bind 2048) NET: Registered protocol family 1 NET: Registered protocol family 17 VFS: Mounted root (romfs filesystem) readonly. Freeing unused kernel memory: 48k freed (0x40160000 - 0x4016b000) expand: from=/ramfs.img to=/dev/ram0 expand: from=/ramfs.img to=/dev/ram1 - Altera_Forum
Honored Contributor
Hi Ryan,
Take a look at the code in drivers/mtd/maps ... I don't have the source available right now, but I believe the file you want to look at is microtronix.c.
I'm not sure which board you're using ... but you can add your own partition (if space allows). For testing purposes, a small partition is all you'll need ... you might be able to grab a meg from the "romfs" partition ;-) Enable JFFS2 in the kernel config. You can boot as you are already doing ... then mount your partition. You might want to add /mnt/flash (or something like that) to your filesystem to use as a mount point ... and you'll need a block device inode with the appropriate major/minor numbers as well. It would also be handy if you erase the appropriate sectors prior to first use ;-) Once the partition is mounted you can write whatever you want. Regards, --ScottUsing Microtronix development partition definition Creating 2 MTD partitions on "Microtronix map": 0x00200000-0x00800000 : "romfs" 0x00000000-0x00200000 : "loader/kernel" - Altera_Forum
Honored Contributor
Thanks Scott,
OK, I got all that -- now I'm assuming there's something along the lines of e2fsprogs for jffs? I get a multitude of errors when I try to mount the partition as jffs2 (not surprising). I guess I need to do some kind of formatting? Ryan - Altera_Forum
Honored Contributor
Hi Ryan,
CONFIG_MTD_BLOCK should be defined. > I guess I need to do some kind of formatting? You should be able to mount a "blank: (erased) partition without any problems.
What device is on your board? And where is your partition located? If you don't actually have a top boot device and your partition is at the top of the device you'll see erase/program errors at the offsets that are assumed to be boot sectors. Regards, --ScottAmd/Fujitsu Extended Query Table at 0x0040 Microtronix map: CFI does not contain boot bank location. Assuming top. - Altera_Forum
Honored Contributor
Hello Scott,
I want to use jffs2 too, so I modified my "altera.c" in the drivers/mtd/maps since I use an Altera Eval Kit (Cyclone). I modified my mapping to add my partition. When I boot I get this messages, taht seems ok.
My problem is that when I want to mount it, I don't see the partition in /dev or else... What is the argument I must use with mount ? Is this something like : mount -t jffs2 ??? /temp/flash_mount Thanks a lot Pierre-OlivierAltera NDK flash (AMD): Found 1 x8 devices at 0x0 in 8-bit bank Amd/Fujitsu Extended Query Table at 0x0040 Altera NDK flash (AMD): CFI does not contain boot bank location. Assuming top. 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 5 MTD partitions on "Altera NDK flash (AMD)": 0x00200000-0x00500000 : "romfs/jffs2" 0x00500000-0x00600000 : "brolbrol" 0x00000000-0x00200000 : "loader/kernel" 0x00600000-0x00700000 : "User configuration" 0x00700000-0x00800000 : "safe configuration" - Altera_Forum
Honored Contributor
mount -t jffs2 /dev/mtdblock0 /temp/flashmount -n
should be fine. That partition shall be erased first, otherwise you may get a long train of messages. - Altera_Forum
Honored Contributor
Thank you for your answer, but my problem is that I dont have any device like mtdblock in /dev :
How can I have it appear ? Thanks Pierre-Olivierbutton console cua0 cua1 cua2 cua3 cua4 cua5 cua6 cua7 cua8 cua9 fb0 fb1 hda hda1 hda2 hda3 hda4 hda5 hda6 hda7 hda8 hdb hdb1 hdb2 hdb3 hdb4 hdb5 hdb6 hdb7 hdb8 i2c-0 i2c-1 input kmem mem null ptyp0 ptyp1 ptyp2 ptyp3 ptyp4 ptyp5 ptyp6 ptyp7 ptyp8 ptyp9 ptypa ptypb ptypc ptypd ptype ptypf ram0 ram1 ram2 ram3 spi tty tty0 tty1 tty2 tty3 tty4 tty5 tty6 tty7 tty8 tty9 ttyJ0 ttyS0 ttyS1 ttyS2 ttyS3 ttyS4 ttyS5 ttyS6 ttyS7 ttyS8 ttyS9 ttyp0 ttyp1 ttyp2 ttyp3 ttyp4 ttyp5 ttyp6 ttyp7 ttyp8 ttyp9 ttypa ttypb ttypc ttypd ttype ttypf zero - Altera_Forum
Honored Contributor
<div class='quotetop'>QUOTE </div>
--- Quote Start --- How can I have it appear ?[/b] --- Quote End --- I did this by adding a node to the filesystem in the IDE. Node names look like "@<name>,<type>,<major#>,<minor#>. You can get minor/major# s via
for example, mine is:cat /proc/partitions
then mount as you mentioned previously (mount -n -t /dev/mtdblock0 /mnt/whatever) Ryan# cat /proc/partitions major minor # blocks name 31 0 6144 mtdblock0 31 1 2048 mtdblock1 31 2 2048 mtdblock2 - Altera_Forum
Honored Contributor
You mean I just have to create a file named "@mtdblock0,???,major,minor" in the target/dev of my Filesystem project directory ?
What does the type mean, I only see c or b, what do I have to set ? Thanks Pierre-Olivier