Forum Discussion

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

How to create filesystem for linux4 with nios2

I get kernel panic likely because I don't have a filesystem. I don't know how I should enable it. I see in menuconfig there are option for the RAM filesystem and I tried setting that both to explicit files and the directory of the buildroot images. Nothing worked. Can you help me?

Code:

Linux version 4.9.0-00104-g84d4f8a-dirty (developer@1604) (gcc version 6.2.0 (Sourcery CodeBench Lite 2016.11-32) ) #48 Fri Apr 7 22:39:28 CEST 2017

bootconsole [early0] enabled

early_console initialized at 0xe8001440

On node 0 totalpages: 32768

free_area_init_node: node 0, pgdat c084e52c, node_mem_map c0883b80

Normal zone: 256 pages used for memmap

Normal zone: 0 pages reserved

Normal zone: 32768 pages, LIFO batch:7

��pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768

pcpu-alloc: [0] 0

Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512

Kernel command line: debug console=ttyAL0,115200

PID hash table entries: 512 (order: -1, 2048 bytes)

Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)

Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)

Sorting __ex_table...

Memory: 121196K/131072K available (2233K kernel code, 66K rwdata, 352K rodata, 5852K init, 197K bss, 9876K reserved, 0K cma-reserved)

SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1

NR_IRQS:64 nr_irqs:64 0

clocksource: nios2-clksrc: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 38225208935 ns

Console: colour dummy device 80x25

Calibrating delay loop (skipped), value calculated using timer frequency.. 100.00 BogoMIPS (lpj=50000)

pid_max: default: 32768 minimum: 301

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

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

cpu cpu0: Error -2 creating of_node link

clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275000 ns

random: fast init done

clocksource: Switched to clocksource nios2-clksrc

random: crng init done

futex hash table entries: 256 (order: -1, 3072 bytes)

workingset: timestamp_bits=30 max_order=15 bucket_order=0

Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)

io scheduler noop registered

io scheduler deadline registered

io scheduler cfq registered (default)

8001440.serial: ttyJ0 at MMIO 0x8001440 (irq = 2, base_baud = 0) is a Altera JTAG UART

mousedev: PS/2 mouse device common for all mice

Warning: unable to open an initial console.

Failed to create /dev/root: -2

VFS: Cannot open root device "(null)" or unknown-block(0,0): error -2

Please append a correct "root=" boot option; here are the available partitions:

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

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

3 Replies

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

    Could you please help me get unstuck? I'm stuck where Linux boots. I built latest version of Linux from Altera for my Altera DE2-115 FPGA. It won't boot properly because of something with the file system. Maybe you know what I should do? I suppose it is some option in make menuconfig but I don't know what do to.

    Linux version 4.9.0-00104-g84d4f8a-dirty (developer@1604) (gcc version 6.2.0 (Sourcery CodeBench Lite 2016.11-32) )# 28 Wed Apr 5 04:23:07 CEST 2017
    bootconsole  enabled
    early_console initialized at 0xe8001440
    On node 0 totalpages: 32768
    free_area_init_node: node 0, pgdat c022166c, node_mem_map c0254b80
      Normal zone: 256 pages used for memmap
      Normal zone: 0 pages reserved
      Normal zone: 32768 pages, LIFO batch:7
    pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
    pcpu-alloc:  0 
    Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
    Kernel command line: debug console=ttyAL0,115200
    PID hash table entries: 512 (order: -1, 2048 bytes)
    Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
    Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
    Sorting __ex_table...
    Memory: 127528K/131072K available (1750K kernel code, 66K rwdata, 284K rodata, 76K init, 191K bss, 3544K reserved, 0K cma-reserved)
    SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    NR_IRQS:64 nr_irqs:64 0
    clocksource: nios2-clksrc: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 38225208935 ns
    Console: colour dummy device 80x25
    Calibrating delay loop (skipped), value calculated using timer frequency.. 100.00 BogoMIPS (lpj=50000)
    pid_max: default: 32768 minimum: 301
    Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
    Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
    cpu cpu0: Error -2 creating of_node link
    clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275000 ns
    random: fast init done
    clocksource: Switched to clocksource nios2-clksrc
    futex hash table entries: 256 (order: -1, 3072 bytes)
    workingset: timestamp_bits=30 max_order=15 bucket_order=0
    Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
    io scheduler noop registered
    io scheduler deadline registered
    io scheduler cfq registered (default)
    8001440.serial: ttyJ0 at MMIO 0x8001440 (irq = 2, base_baud = 0) is a Altera JTAG UART
    mousedev: PS/2 mouse device common for all mice
    Warning: unable to open an initial console.
    List of all partitions:
    No filesystem could mount root, tried: 
    Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
    ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
    random: crng init done

    https://www.alteraforum.com/forum/attachment.php?attachmentid=13503 https://www.alteraforum.com/forum/attachment.php?attachmentid=13504
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    After deselecting Nios II DIV and configuring some more options, I get the login prompt and a shell via JTAG UART.

    But why do I get junk on the screen? It looks like this
    
    Welcome to Nios II
    nios2 login: root
    ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
    ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
    login: root login on 'ttyJ0'
    #  

    The whole boot sequence is the following

    
    Welcome to Nios IILinux version 4.9.0-00104-g84d4f8a-dirty (developer@1604) (gcc version 6.2.0 (Sourcery CodeBench Lite 2016.11-32) )# 64 Mon Apr 10 22:33:34 CEST 2017
    bootconsole  enabled
    early_console initialized at 0xe8001440
    Warning: icache size configuration mismatch (0x8000 vs 0x1000) of CONFIG_NIOS2_ICACHE_SIZE vs device tree icache-size
    Warning: dcache size configuration mismatch (0x8000 vs 0x800) of CONFIG_NIOS2_DCACHE_SIZE vs device tree dcache-size
    On node 0 totalpages: 32768
    ��free_area_init_node: node 0, pgdat c042824c, node_mem_map c043fb80
      Normal zone: 256 pages used for memmap
      Normal zone: 0 pages reserved
      Normal zone: 32768 pages, LIFO batch:7
    pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
    pcpu-alloc:  0 
    Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
    Kernel command line: 
    PID hash table entries: 512 (order: -1, 2048 bytes)
    Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
    Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
    Sorting __ex_table...
    ��Memory: 125564K/131072K available (1878K kernel code, 57K rwdata, 440K rodata, 1876K init, 79K bss, 5508K reserved, 0K cma-reserved)
    NR_IRQS:64 nr_irqs:64 0
    clocksource: nios2-clksrc: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 38225208935 ns
    Calibrating delay loop (skipped), value calculated using timer frequency.. 100.00 BogoMIPS (lpj=50000)
    pid_max: default: 32768 minimum: 301
    Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
    Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
    devtmpfs: initialized
    cpu cpu0: Error -2 creating of_node link
    clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275000 ns
    random: fast init done
    clocksource: Switched to clocksource nios2-clksrc
    futex hash table entries: 256 (order: -1, 3072 bytes)
    workingset: timestamp_bits=30 max_order=15 bucket_order=0
    jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
    Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
    io scheduler noop registered
    io scheduler deadline registered
    io scheduler cfq registered (default)
    8001400.serial: ttyAL0 at MMIO 0x8001400 (irq = 3, base_baud = 3125000) is a Altera UART
    8001440.serial: ttyJ0 at MMIO 0x8001440 (irq = 2, base_baud = 0) is a Altera JTAG UART
    console  enabled
    console  enabled
    bootconsole  disabled
    bootconsole  disabled
    loop: module loaded
    mousedev: PS/2 mouse device common for all mice
    Freeing unused kernel memory: 1876K (c01d7000 - c03ac000)
    This architecture does not have kernel memory protection.
    ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@random: crng init done
    ���������...��^@^@^@...^@^@^@^@^@^@^@OK
    Initializing random number generator... ���...�����������������������������������������������������������������^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@done.
    ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^��...���������������@...@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@Starting network: ip: socket: Function not implemented
    ip: socket: Function not implemented
    FAIL
    Welcome to Nios II
    nios2 login: root
    ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
    ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
    login: root login on 'ttyJ0'
    #  
    

    https://www.alteraforum.com/forum/attachment.php?attachmentid=13509 https://www.alteraforum.com/forum/attachment.php?attachmentid=13510 https://www.alteraforum.com/forum/attachment.php?attachmentid=13511 https://www.alteraforum.com/forum/attachment.php?attachmentid=13512
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    First way:

    Run portmap before mount command:

    portmap &

    mkdir /mnt/nfs

    mount -t nfs -n -o nolock,rsize=1024,wsize=1024 192.168.1.2:/home/nios2 /mnt/nfs ( eg, server ip 192.168.1.2)

    Second way:

    add fstab in [/nios2-linux]/uClinux-dist/vendors/Altera/nios2/ and edit the Makefile to have a copy in /etc in kernel image.

    Content of fstab:

    # /etc/fstab: static file system information.

    #

    # <file system> <mount point> <type> <options> <dump> <pass>

    192.168.1.2:/home/nios2 /mnt/nfs nfs rsize=1024,wsize=1024,noauto,nolock 0 0

    Now you can access the mount point with:

    portmap &

    mkdir /mnt/nfs

    mount /mnt/nfs

    Or you could add these lines in [/nios2-linux]/uClinux-dist/vendors/Altera/nios2/rc to mount it automatically at startup

    Then Nios II client can access files on /home/nios2 of server through /mnt/nfs mount point.

    The mount command in sash does not support nfs mount.

    You may use the busybox "mount", and enable the "nfs support" in busybox "mount". You may enable "cp" in busybox, which can support recursive copy. You need to clean up busybox, with "make -C user/busybox clean" , "make" "make romfs" and "make linux image" to rebuild kernel image.

    pes university bangalore fee structure (http://www.admissionpro.in/pes-university-bangalore-fee-structure-nri-direct-management-quota.html)

    reva institute of technology and management bangalore management quota (http://www.admissionpro.in/reva-institute-of-technology-and-management-bangalore-fee-structure-nri-direct-management-quota.html)