Wednesday, July 4, 2012

9. Compile and Load Driver

1. Compile : 
cd ~/netfpga
make
Sample Output : Follow the link
If your output is not similar to the one described in the linked page, you should try checking whether the NetFPGA Environment variables were successfully added to the .bashrc file or not, because I found this was the most common error. The error could be like (just the last few lines) :
make[1]: /bin/nf_register_gen.pl: Command not found
make[1]: *** [registers] Error 127
make[1]: Leaving directory `/home/nchc/netfpga/projects/scone/sw'
make: *** [projects/scone/sw] Error 2
So for getting rid of this error, just use the command :
/usr/local/netfpga/lib/scripts/user_account_setup/user_account_setup.pl
This command for some reason doesn't setup the Perl path correctly. For setting up the Perl path, use the command :
export PERL5LIB=$NF_ROOT/lib/Perl5:$PERL5LIB
This should get everything to compile.



2. Load Driver and Tools :

make install
Sample Output : Follow the link



Now reboot the machine. Reboot is required to load the newly compiled driver.
3. After the reboot, log in as root. Verify if the driver is loaded using the command :
lsmod | grep nf2
Sample Correct Output : nf2      23308      0
4. Verify NetFPGA Interfaces
1) Verify that the four nf2c* interfaces have been loaded successfully by using the command :
ifconfig -a | grep nf2
2) Sample Correct Output :
nf2c0 Link encap:Ethernet HWaddr 00:4E:46:32:43:00
nf2c1 Link encap:Ethernet HWaddr 00:4E:46:32:43:01
nf2c2 Link encap:Ethernet HWaddr 00:4E:46:32:43:02
nf2c3 Link encap:Ethernet HWaddr 00:4E:46:32:43:03
3) If you don't get the output as mentioned in the sample output, then you can turn the interfaces up by typing :
ifconfig  nf2c0  up
ifconfig  nf2c1  up
ifconfig  nf2c2  up
ifconfig  nf2c3  up
The other possibility is that you are not logged onto the OS which has the NetFPGA installed on it. So when booting, ensure that you log into the OS with the NetFPGA installed on it.
5. Reprogram the CPCI
1) Run the CPCI Reprogramming Script
/usr/local/sbin/cpci_reprogram.pl --all
2) Sample Output :
Loading the CPCI Reprogrammer on NetFPGA 0
Loading the CPCI on NetFPGA 0
CPCI on NetFPGA 0 has been successfully reprogrammed



3) To have the CPCI reprogrammed when the computer boots, follow the following steps :
a - gedit /etc/rc.local
b- Add the following line to the file :  /usr/local/netfpga/lib/scripts/cpci_reprogram/cpci_reprogram.pl --all and save it.


14 comments:

  1. Hi,

    1. I ran the “cd ~/netfpga and make install” y the out was the same shown up, the proccess was successful, but when I ran the command “lsmod | grep nf2″, not showed anything.
    Try the interface is up, but get an error “nf2c0: unknown interface: No such device”.

    2. I download the netfpga_full_3_0_1.tar.gz, but do not know which directory I can run it and what the installation command.

    Can you hel me ? Please.

    Thanks

    ReplyDelete
    Replies
    1. the make install is not of much significance.. which version were you using till now? i think it doesn’t matter anyway.. first try allocating some memory to the netfpga.. that should make it work..

      Delete
    2. I have a problem with CPCI

      When I run “edit /etc/rc.local” this show:

      /bin/sh
      #
      # This script will be executed *after* all the other init scripts.
      # You can put your own initialization stuff in here if you don’t
      # want to do the full Sys V style init stuff.

      touch /var/lock/subsys/local

      *********when /usr/local/sbin/cpci_reprogram.pl -all
      show

      ./cpci_reprogram.pl
      Error: specified device ID (0) is outside of valid range (0 .. 0)

      NAME
      cpci_reprogram.pl – Dowload the latest CPCI design to the CPCI

      SYNOPSIS
      cpci_reprogram.pl
      [--device ]
      [--bit ]
      [--all]

      cpci_reprogram.pl –help – show detailed help

      Can you help me? Please

      Delete
    3. i dont know if you and I are talking about the same thing but isn't the command supposed to be “gedit /etc/rc.local”?

      also u are running cpci_reprogram.pl.. does that mean your system detects the nf2 interfaces? because if your system doesn’t detect the interfaces you can’t move to cpci…

      Delete
  2. Hi pharic,

    When I run the make command show the following error:

    [root@pc-stud12 netfpga]# make
    echo /root/netfpga/lib/Perl5:/root/netfpga/projects/reference_nic/lib/Perl5:/root/netfpga/lib/Perl5:/root/netfpga/projects/reference_nic/lib/Perl5:/root/netfpga/lib/Perl5:
    /root/netfpga/lib/Perl5:/root/netfpga/projects/reference_nic/lib/Perl5:/root/netfpga/lib/Perl5:/root/netfpga/projects/reference_nic/lib/Perl5:/root/netfpga/lib/Perl5:
    if [ -f "lib/Makefile" ] ; then \
    make -C lib ; \
    fi
    make[1]: Entering directory `/root/netfpga/lib’
    make -C C
    make[2]: Entering directory `/root/netfpga/lib/C’
    make -C kernel
    make[3]: Entering directory `/root/netfpga/lib/C/kernel’
    make -C /lib/modules/2.6.18-348.el5PAE/build M=/root/netfpga/lib/C/kernel LDDINC=/root/netfpga/lib/C/kernel/../include modules
    make: Entering an unknown directory
    make: *** /lib/modules/2.6.18-348.el5PAE/build: No such file or directory. Stop.
    make: Leaving an unknown directory
    make[3]: *** [modules] Error 2
    make[3]: Leaving directory `/root/netfpga/lib/C/kernel’
    make[2]: *** [kernel] Error 2
    make[2]: Leaving directory `/root/netfpga/lib/C’
    make[1]: *** [C] Error 2
    make[1]: Leaving directory `/root/netfpga/lib’
    make: *** [lib] Error 2

    Can you help me?

    ReplyDelete
    Replies
    1. hi monica.. i think either the kernel is not updated or the netfpga is not installed properly.. try all the steps mentioned here : http://pharic.blogspot.in/2012/06/7-install-packages.html … sry fr not bein of much help here..

      Delete
  3. Hi pharic,

    This are the files of the netfpga directory:

    bashrc_addon bin bitfiles CHANGES lib LICENSE Makefile projects README

    Are complete?

    ReplyDelete
  4. Hi pharic,

    I run all the commands of the step 7, all were installed except this:

    [root@pc-stud12 /]# yum -y install perl-Net-RawlP.i386
    Loaded plugins: fastestmirror, security
    Loading mirror speeds from cached hostfile
    * base: ftp-stud.fht-esslingen.de
    * extras: ftp-stud.fht-esslingen.de
    * jpackage-generic: sunsite.informatik.rwth-aachen.de
    * rpmforge: mirror1.hs-esslingen.de
    * updates: mirror.de.leaseweb.net
    Setting up Install Process
    No package perl-Net-RawlP.i386 available.
    Nothing to do

    After that :

    [root@pc-stud12 /]# yum -y install kernel-devel*
    Loaded plugins: fastestmirror, security
    Loading mirror speeds from cached hostfile
    * base: ftp-stud.fht-esslingen.de
    * extras: ftp-stud.fht-esslingen.de
    * jpackage-generic: sunsite.informatik.rwth-aachen.de
    * rpmforge: mirror1.hs-esslingen.de
    * updates: ftp-stud.fht-esslingen.de

    not permit run this command :

    [root@pc-stud12 /]# rpm -qa | grep -i kernel
    netfpga-kernel-3.0.1-full
    kernel-devel-2.6.18-348.el5
    kernel-PAE-2.6.18-348.el5
    kernel-PAE-devel-2.6.18-348.el5
    kernel-headers-2.6.18-348.el5
    [root@pc-stud12 /]# rpm -e kernel-$(uname -r)
    error: package kernel-2.6.18-348.el5PAE is not installed
    [root@pc-stud12 /]#

    Have you any idea that can be?

    ReplyDelete
    Replies
    1. ignore the last error.. try the command ” yum -y update kernel-devel* ”.. unless the kernel is updated u cant proceed further.. so get that right first.. for more help u can actually google the error u r getting.. there r a lot of forums where you will find that people face the same problems..

      Delete
    2. Hi pharic,

      After run step 7 as you indicated me, run make and then make install and it worked, I recognized the four Ethernet interfaces.

      [root@pc-stud12 /]# lsmod | grep nf2
      nf2 23308 0
      [root@pc-stud12 /]# ifconfig -a | grep nf2
      nf2c0 Link encap:Ethernet HWaddr 00:4E:46:32:43:00
      nf2c1 Link encap:Ethernet HWaddr 00:4E:46:32:43:01
      nf2c2 Link encap:Ethernet HWaddr 00:4E:46:32:43:02
      nf2c3 Link encap:Ethernet HWaddr 00:4E:46:32:43:03

      Thank you very much for your help.

      Delete
  5. Hi pharic, im getting an error while trying to compile the driver…
    make *** /lib/modules/3.6.10-4.fc18.x86_64/build:
    I updated my kernel but im still getting this error
    make: *** /lib/modules/3.9.2-200.fc18.x86_64/build:

    What should i do?
    I using fedora 18 and my kernel versions are showed up there.

    Thanks!

    ReplyDelete
    Replies
    1. Tried the comand
      yum install kernel-dev

      Now im getting another error

      echo /root/netfpga/lib/Perl5:/root/netfpga/projects/reference_nic/lib/Perl5:/root/netfpga/lib/Perl5:
      /root/netfpga/lib/Perl5:/root/netfpga/projects/reference_nic/lib/Perl5:/root/netfpga/lib/Perl5:
      if [ -f "lib/Makefile" ] ; then \
      make -C lib ; \
      fi
      which: no javac in (/root/netfpga/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/home/raphael/.local/bin:/home/raphael/bin)
      make[1]: Entrando no diretório `/root/netfpga/lib’
      make -C C
      make[2]: Entrando no diretório `/root/netfpga/lib/C’
      make -C kernel
      make[3]: Entrando no diretório `/root/netfpga/lib/C/kernel’
      make -C /lib/modules/3.9.2-200.fc18.x86_64/build M=/root/netfpga/lib/C/kernel LDDINC=/root/netfpga/lib/C/kernel/../include modules
      make[4]: Entrando no diretório `/usr/src/kernels/3.9.2-200.fc18.x86_64′
      CC [M] /root/netfpga/lib/C/kernel/nf2_ethtool.o
      /root/netfpga/lib/C/kernel/nf2_ethtool.c:99:2: error: unknown field ‘phys_id’ specified in initializer
      /root/netfpga/lib/C/kernel/nf2_ethtool.c:99:2: warning: initialization from incompatible pointer type [enabled by default]
      /root/netfpga/lib/C/kernel/nf2_ethtool.c:99:2: warning: (near initialization for ‘nf2_ethtool_ops.get_eeprom_len’) [enabled by default]
      make[5]: ** [/root/netfpga/lib/C/kernel/nf2_ethtool.o] Erro 1
      make[4]: ** [_module_/root/netfpga/lib/C/kernel] Erro 2
      make[4]: Saindo do diretório `/usr/src/kernels/3.9.2-200.fc18.x86_64′
      make[3]: ** [modules] Erro 2
      make[3]: Saindo do diretório `/root/netfpga/lib/C/kernel’
      make[2]: ** [kernel] Erro 2
      make[2]: Saindo do diretório `/root/netfpga/lib/C’
      make[1]: ** [C] Erro 2
      make[1]: Saindo do diretório `/root/netfpga/lib’
      make: ** [lib] Erro 2

      Delete
    2. hi rodrigo.. the command is ” yum install kernel-devel* ” not “yum install kernel-dev”..

      Delete
    3. Pharic tried the ” yum install kernel-devel* ” an later tried to recompile the driver…and got the output

      echo /root/netfpga/lib/Perl5:/root/netfpga/projects/reference_nic/lib/Perl5:/root/netfpga/lib/Perl5:
      /root/netfpga/lib/Perl5:/root/netfpga/projects/reference_nic/lib/Perl5:/root/netfpga/lib/Perl5:
      if [ -f "lib/Makefile" ] ; then \
      make -C lib ; \
      fi
      which: no javac in (/root/netfpga/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/home/raphael/.local/bin:/home/raphael/bin)
      make[1]: Entrando no diretório `/root/netfpga/lib’
      make -C C
      make[2]: Entrando no diretório `/root/netfpga/lib/C’
      make -C kernel
      make[3]: Entrando no diretório `/root/netfpga/lib/C/kernel’
      make -C /lib/modules/3.9.2-200.fc18.x86_64/build M=/root/netfpga/lib/C/kernel LDDINC=/root/netfpga/lib/C/kernel/../include modules
      make[4]: Entrando no diretório `/usr/src/kernels/3.9.2-200.fc18.x86_64′
      CC [M] /root/netfpga/lib/C/kernel/nf2_ethtool.o
      /root/netfpga/lib/C/kernel/nf2_ethtool.c:99:2: error: unknown field ‘phys_id’ specified in initializer
      /root/netfpga/lib/C/kernel/nf2_ethtool.c:99:2: warning: initialization from incompatible pointer type [enabled by default]
      /root/netfpga/lib/C/kernel/nf2_ethtool.c:99:2: warning: (near initialization for ‘nf2_ethtool_ops.get_eeprom_len’) [enabled by default]
      make[5]: ** [/root/netfpga/lib/C/kernel/nf2_ethtool.o] Erro 1
      make[4]: ** [_module_/root/netfpga/lib/C/kernel] Erro 2
      make[4]: Saindo do diretório `/usr/src/kernels/3.9.2-200.fc18.x86_64′
      make[3]: ** [modules] Erro 2
      make[3]: Saindo do diretório `/root/netfpga/lib/C/kernel’
      make[2]: ** [kernel] Erro 2
      make[2]: Saindo do diretório `/root/netfpga/lib/C’
      make[1]: ** [C] Erro 2
      make[1]: Saindo do diretório `/root/netfpga/lib’
      make: ** [lib] Erro 2

      Delete