Forum Discussion

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

Problems with installing Nios2 Linux

I am attempting to install the Nios2 Linux development tools on a Centos 6.3 based system.

I am somewhat confused by the instructions (on alteras wiki: Install_Nios_II_Linux). They indicate that the test-nios2 branch is the current branch of the kernel, but the nios2-linux-20100621.tar doesn't come automatically configured for this branch. The instructions also indicate that the current kernel uses the Devicetree approach to configuring the kernel for hardware, though, if I build with the test-nios2 branch, I have to use the vendor_hwselect mechanism

Can someone tell me what the current branch is (test-nios2 or nios2mmu under linux-2.6 and test-nios2 or trunk under uClinux-dist) and what the current hardware customization mechanism is (vendor_hwselect, devicetree or sopc generated header)?

Also, assuming that the current hardware customization is something other than vendor_hwselect, how do I configure things to get it?

Thanks in advance. I'm trying to get ready to use this in a college class that starts at the end of September.

D.W. Lynn

For reference, Here is what I did, working from the Install_Nios_II_Linux instructions on the wiki, specifically using nios2-linux-20100621.tar.

The tool-chain build step first complained:

/home/lynnd/nios2-linux/toolchain-build/u-boot.mk:11: Board not defined! Using EP1S10 as default.

and later fails with the following:

...

home/lynnd/nios2-linux/uClibc'

make[2]: `conf' is up to date.

CC libpthread/linuxthreads.old/cancel.o

In file included from ./include/sys/syscall.h:34,

from libpthread/linuxthreads.old/restart.h:16,

from libpthread/linuxthreads.old/cancel.c:23:

./include/bits/syscalls.h:10:23: asm/traps.h: No such file or directory

make[1]: *** [libpthread/linuxthreads.old/cancel.o] Error 1

make[1]: Leaving directory `/home/lynnd/nios2-linux/uClibc'

make: *** [/home/lynnd/nios2-linux/toolchain-build/../uClibc/lib/libc.a] Error 2

So, I switched to the prebuild binary toolchain, which worked. Then I attempted to make the kernel per the instructions using the make menuconfig process. There were lots of undefaulted options. On the final kernel make, I had to do "make CROSS-COMPILE=nios2-linux- since the default CROSS_COMPILE was nios2-linux-gnu-

and that's not how the binary toolchain installed and I couldn't find the CROSS_COMPILE option in make menuconfig kernel customization.

However, I still got the following error:

/home/lynnd/nios2-linux/linux-2.6/arch/nios2/kernel/entry.S: Assembler messages:

/home/lynnd/nios2-linux/linux-2.6/arch/nios2/kernel/entry.S:542: Error: expecting control register

/home/lynnd/nios2-linux/linux-2.6/arch/nios2/kernel/entry.S:542: Error: unknown register r6

make[3]: *** [arch/nios2/kernel/entry.o] Error 1

Following some hints elsewhere in the forum, I removed the nios2-linux/ directory completely and untarred nios2-linux-20100621.tar again (to start fresh). Then,

before doing the ./checkout step, I did "git checkout test-nios2 -f" in both the uClinux and the linux-2.6 directories.

Now the kernel make process succeeds even though it uses the vendor_hwselect mechanism. Note that the documentation for Devicetree (linux-2.6/Documentation/devicetree) does not exist in the test-nios2 branch and make menuconfig in this branch does not give options for using the Device tree approach (that I could find).

32 Replies

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

    --- Quote Start ---

    Hi,

    The files which are indicated by the tag ETC_FILES-y

    #
    ETC_FILES-y = 
        filesystems group issue mdev.conf mime.types modprobe.conf motd 
        passwd profile rc TZ nsswitch.conf syslog.conf sc.cfg
    

    are copied from your /nios2-linux/uClinux-dist/vendors/Altera/common directory ro /etc.

    #
        for f in $(ETC_FILES-y) ; do 
            $(ROMFSINST) ../common/$$f /etc/$$f ; 
        done ; 
    

    So you must create the 'syslog.conf' file (which is used for rsyslogd) and 'sc.cfg' (I don't know what's this).

    And you have 4 errors which are caused by your 'rc' script file.

    1) ifconfig: SIOCSIFADDR: No such device

    ifconfig: SIOCSIFADDR: No such device

    are caused by the lines 86 and 87.

    #  Set up eth1 IP address
    ifconfig eth0 192.168.11.4 up
    ifconfig eth1 192.168.1.4 up
    

    2) cp: can't stat '/etc/sc.cfg': No such file or directory

    is caused by the line 93.

    #  Move SoftClock config file to where it is accessed by application, location is hardcoded in application
    cp /etc/sc.cfg /var/log
    

    3) insmod: can't insert '/usr/sbin/fpga.ko': No such file or directory

    Usage: mknod [-m MODE] NAME TYPE MAJOR MINOR

    are caused by the lines 96 and 101.

    # Set up device driver, insert kernel module
    insmod /usr/sbin/fpga.ko#  create device node using major number /proc/devices table
    CURRWD=`pwd`
    cd /dev
    MAJOR_NUM=$(awk 'BEGIN {FS=" "}; {if ($2 == "fpgasymm") print $1;}' /proc/devices)
    mknod -m=777 fpgasymm c $MAJOR_NUM 0
    cd $CURRWD

    4) sh: can't execute 'rsyslogd': No such file or directory

    is caused by the line 105.

    #  start rsyslogd daemon
    rsyslogd -n -m0 -f /etc/syslog.conf &
    

    If you don't require these, please delete or comment out those lines and recompile the kernel.

    Kazu

    --- Quote End ---

    Now I understsand better. I updated my design in Qsys and added a second timer. Picture https://i.stack.imgur.com/2jywn.png

    If I try and use that design I get this error msg

    
    Linux version 3.5.0-rc4-01329-ga227997-dirty (developer@1604) (gcLinux version 3.5.0-rc4-01329-ga227997-dirty (developer@1604) (gcc version 4.1.2)# 810 Sat Apr 1 14:23:20 CEST 2017
    bootconsole  enabled
    early_console initialized at 0xe8001440
    ERROR: Nios II MUL different for kernel and DTS
    Unable to handle kernel NULL pointer dereference at virtual address 00000000
    ea = c0238094, ra = c0238078, cause = 15
    Kernel panic - not syncing: Oops
    

    What does it mean?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    --- Quote Start ---

    Now I understsand better. I updated my design in Qsys and added a second timer. Picture https://i.stack.imgur.com/2jywn.png

    If I try and use that design I get this error msg

    
    Linux version 3.5.0-rc4-01329-ga227997-dirty (developer@1604) (gcLinux version 3.5.0-rc4-01329-ga227997-dirty (developer@1604) (gcc version 4.1.2)# 810 Sat Apr 1 14:23:20 CEST 2017
    bootconsole  enabled
    early_console initialized at 0xe8001440
    ERROR: Nios II MUL different for kernel and DTS
    Unable to handle kernel NULL pointer dereference at virtual address 00000000
    ea = c0238094, ra = c0238078, cause = 15
    Kernel panic - not syncing: Oops
    

    What does it mean?

    --- Quote End ---

    Maybe, you have the file '/arch/nios2/hernel/cpuinfo.c'.

    http://lxr.free-electrons.com/source/arch/nios2/kernel/cpuinfo.c

    
      32# define err_cpu(x) 
      33         pr_err("ERROR: Nios II " x " different for kernel and DTS\n")
    .......
      75         if (IS_ENABLED(CONFIG_NIOS2_HW_MUL_SUPPORT) && !cpuinfo.has_mul)  
      76                 err_cpu("MUL");  
    

    Did you setup 'CONFIG_NIOS2_HW_MUL_SUPPORT'? And also please check the contents of your dst file.

    Kazu