Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

R/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

Quantapoint

23 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi!

    If changed the altera.c for my on memory partition in this way:

      {
        .name =   "part1",
        .size =   0x100000,
        .offset = 0x700000,
      },{
        .name =   "romfs/jffs2",
        .size =   0x500000,
        .offset = 0x200000,
      },{
        .name =   "loader/kernel",
        .size =   0x200000,
        .offset = 0,
      }, {
        .name =   "User configuration",
        .size =   0x400000,
        .offset = 0x800000,
      }, {
        .name =   "safe configuration",
        .size =   0x400000,
        .offset = 0xc00000,
        .mask_flags = MTD_WRITEABLE,  /* force read-only */
      }

    Then if have build the kernel again and uploaded it.

    But when I try to start Linux it's stopped with kernel panic error:

    using altera ndk partition definition

    creating 5 mtd partitions on "altera ndk flash (amd)":

    0x00700000-0x00800000 : "part1"

    0x00200000-0x00700000 : "romfs/jffs2"

    0x00000000-0x00200000 : "loader/kernel"

    0x00800000-0x00c00000 : "user configuration"

    0x00c00000-0x01000000 : "safe configuration"

    net: registered protocol family 2

    ip: routing cache hash table of 512 buckets, 4kbytes

    tcp established hash table entries: 1024 (order: 1, 8192 bytes)

    tcp bind hash table entries: 1024 (order: 0, 4096 bytes)

    tcp: hash tables configured (established 1024 bind 1024)

    net: registered protocol family 1

    net: registered protocol family 17

    kernel panic - not syncing: vfs: unable to mount root fs on unknown-block(31,0)

    What's going wrong?

    Bye, Lothar.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi!

    I have changed the order of the partitions in altera.c by putting my own partition at the end of the list:

    #ifdef CONFIG_ALTERA_STRATIX_II
      {
        .name =   "romfs/jffs2",
        .size =   0x500000,
        .offset = 0x200000,
      },{
        .name =   "loader/kernel",
        .size =   0x200000,
        .offset = 0,
      },{
        .name =   "User configuration",
        .size =   0x400000,
        .offset = 0x800000,
      },{
        .name =   "safe configuration",
        .size =   0x400000,
        .offset = 0xc00000,
        .mask_flags = MTD_WRITEABLE,  /* force read-only */
      },{
        .name =   "part1",
        .size =   0x100000,
        .offset = 0x700000,
      }

    and so it works.

    Bye, Lothar.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi friends!

    I've make a new partition as you can see by this start sequence:

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    creating 5 mtd partitions on "altera ndk flash (amd)":

    0x00200000-0x00700000 : "romfs/jffs2"

    0x00000000-0x00200000 : "loader/kernel"

    0x00800000-0x00c00000 : "user configuration"

    0x00c00000-0x01000000 : "safe configuration"

    0x00700000-0x00800000 : "part1"

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    and by the following command output:

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# cat proc/partitions

    major minor # blocks name

    31 0 5120 mtdblock0

    31 1 2048 mtdblock1

    31 2 4096 mtdblock2

    31 3 4096 mtdblock3

    31 4 1024 mtdblock4#

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    For this partition I've generated a block device directly by "@mtdblock4,b,31,4" in the filesystem which I've uploaded.

    When I try to erase the content of partition part1 alias mtdblock4 by the following program the board reboot.

    #include <stdio.h># include "system.h"# include "sys/alt_flash.h"
     
    int main(int argc, char* argv)
    {
      alt_flash_fd* flash;
      int i;
     
      printf("alt_flash_open_dev(&#39;../dev/mtdblock4&#39;)");
      flash=alt_flash_open_dev("../dev/mtdblock4");
      /*
      for (i=0x700000;i<0x800000;i=i+0x10000)
      {
       printf("Erase %08x\n",i);    
       alt_erase_flash_block(flash,i,0x10000);
      }
      */
      return 0;
    }

    Why does the board reboot by this program?

    Bye, Lothar.