You are here: Foswiki>NetFPGA/OneGig Web>UbuntuCompatibility (20 May 2008, Shafer)EditAttach
These instructions should allow the NetFPGA platform, including the Linux device driver, download utility, SCONE router control software, and Xilinx tools, to run on a variety of 32-bit Ubuntu releases. We have successfully run NetFPGA on Ubuntu 6.06, 7.04 (kernel 2.6.20-16), 7.10, and 8.04 (kernel 2.6.24-16).

General Notes

  • You can run NetFPGA as a normal user. But, you need to use SUDO on most of the commands , i.e
 sudo make install   (for the driver)
 sudo cpci_reprogram.pl --all
 sudo nf2_download ~/NF2/bitfiles/reference_nic.bit
 sudo ~/NF2/bin/nf21_regress_test.pl

  • The following packages are required for either the selftest, reference NIC, or reference router. Install them all to be safe:
 sudo apt-get install build-essential            (for compiling driver)
 sudo apt-get install linux-headers-`uname -r`   (for compiling driver)
 sudo apt-get install ncurses-dev                (for selftest)
 sudo apt-get install libnet1-dev                (for the reference router/selftest)
 sudo apt-get install libxml-simple-perl         (Used in ./nf21_run_test.pl to verify *simulator* output)
sudo apt-get install libio-interface-perl (Used to manually build a newer version of Net
PCap) sudo apt-get install liblist-moreutils-perl (Used to manually build a newer version of Net
RawIP)
 sudo apt-get install liberror-perl              (for the reference router)
 sudo apt-get install sun-java6-jre              (for the reference router GUI)
 sudo apt-get install sun-java6-jdk
 sudo apt-get install libpcap0.8                 (for SCONE)
 sudo apt-get install libpcap0.8-dev             (for SCONE)

NetFPGA Beta Changes (for Ubuntu)

  • Install all packages as directed in General Notes section

  • The following utilities are expected:
 /sbin/lspci
 /sbin/setpci
Create links to the actual utilities on Ubuntu
 sudo ln /usr/bin/lspci /sbin/lspci
 sudo ln /usr/bin/setpci /sbin/setpci

  • The built-in command "usleep" is not present in BASH in Ubuntu/Debian. The command "sleep" is equivalent and supports floating-point time intervals, but is off by 10^6 (obviously).
    • Edit these files:
 projects/reference_nic/regress/test_loopback_drop/run:    usleep 10;
 projects/reference_nic/regress/test_loopback_drop/run:    usleep 10;
 projects/reference_nic/regress/test_loopback_drop/run:    usleep 10;
 projects/reference_nic/regress/test_loopback_drop/run:    usleep 10;
 projects/reference_nic/regress/test_loopback_drop/run:    usleep 10;
 projects/reference_nic/regress/test_loopback_drop/run:    usleep 10;
 projects/reference_nic/regress/test_loopback_drop/run:    usleep 10;
 projects/router_buffer_sizing/regress/test_time_stamp/send_pkt: `usleep 10000`;
 projects/router_buffer_sizing/regress/test_store_event/send_pkt:        `usleep 10000`;
    • Replace
 usleep 10;         ... with
 sleep 0.000010;

  • SCONE requires libpcap.so.0.8.3 which is not available from the package manager. But, version 0.8 is available, and is close enough.
 sudo  ln -s /usr/lib/libpcap.so.0.8 /usr/lib/libpcap.so.0.8.3

  • Edit NF2/lib/C/kernel/Makefile and change "CFLAGS" to "EXTRA_CLFAGS"

  • The IRQF_SHARED flag is deprecated in kernels greater than 2.6.24. Instead, the SA_SHIRQ flag is used in include/linux/interrupt.h .
    • This change fixes an error that would occur in NF2/lib/C/kernel/nf2_control.c . Edit NF2/lib/C/kernel/nf2util.h and add the following section inside the main #ifndef block:
 // Replace SA_SHIRQ with IRQF_SHARED on newer kernels
 #ifndef SA_SHIRQ
 #define SA_SHIRQ IRQF_SHARED
 #endif

  • In the newer kernels, usleep seems to run much much faster. This affects the nf2_download program because it no longer waits long enough for the Virtex II FPGA to fully initialize after resetting, and produces the error "INIT went active during programming - there was an error!"
    • In NF2/lib/C/download/nf2_download.c replace
      /* Sleep for a while to allow the INIT pin to be reset */
      usleep(100);
      retries = 3;
      while (retries-- > 0 && NF2_RD32(CPCI_PROGRAMMING_STATUS) & 0x10002)
      {
         usleep(100);
      }
   } // if (!cpci_reprog)
  • with
      /* Sleep for a while to allow the INIT pin to be reset */
      usleep(10000);
      retries = 3;
      while (NF2_RD32(CPCI_PROGRAMMING_STATUS) & 0x10002)
      {
if ((NF2_RD32(CPCI_PROGRAMMING_STATUS) & 0x10000)) usleep(10000); else break; retries--; if (retries <= 0) { printf("CPCI's INIT signal did not clear in time, exiting\n"); printf ("CPCI_PROGRAMMING_STATUS: 0x%08x\n", NF2_RD32(CPCI_PROGRAMMING_STATUS)); exit(1); }
      }
   } // if (!cpci_reprog)

  • After making these changes, follow the normal NetFPGA installation process as described in the user guide.
    • You do not need to install the packages specified for CentOS
    • Change /boot/grub/menu.lst as requested to allocate more kernel memory, and reboot
      • NOTE: The uppermem entry is not needed, as it was a fix for an ancient Grub bug
    • Load new environment variables in .bashrc file
    • make in NF2/ directory
      • Note that Java compilation doesn't work (on our test system, at least)
    • sudo make install in NF2/ directory, and reboot
    • sudo cpci_reprogram.pl --all

Xilinx Installation / Execution on Ubuntu

  • NOTE: These instructions have only been tested on Ubuntu 7.10 running an AMD64 kernel (while the rest of the instructions on this page are for 32-bit kernels)

  • Make sure to forward X and have an X server running (installer is GUI)
  • Perform the installation (and any future updates) as the root user (might need to set a root password and then su to root)
  • Download 2.5GB ISE tarball and unpack
  • Install libstdc++5 to run the installer
 sudo apt-get install libstdc++5
  • Install libmotif to run the floorplanner
 sudo apt-get install libmotif3 
  • Install portmap to run the floorplanner and FPGA Editor (to fix the RPC "Cannot register service" error)
 sudo apt-get install portmap
  • To use 64-bit version correctly, edit the "setup" file in the installer root directory, and change
 procType=`uname -p`;        # Get the processor type
to
 procType=`uname -m`;        # Get the processor type
  • Run the installer
 ./setup &
  • Steps:
    • Enter the registration ID
    • Accept the license files
    • Install to /Xilinx91i
    • Accept the default installation options (and add the cable drivers)
    • Accept the default environment variable options
    • Check the Launch WebUpdate option
  • Install
  • Warning message: "Error: Cannot run process - /Xilinx91i/.xinstall/install_driverscript/" - IGNORE
  • Check for Updates and accept any updates
  • Environment variables are written to /Xilinx91/settings.(c)sh. In each user that runs Xilinx tools, do
 source /Xilinx91/settings.sh
  • Run WebUpdate again to make sure everything is current:
 ./webupdate &
 sudo apt-get install libusb-devsour
 cd usb-derver
 make
  • Put the following command in the .bashrc file:
  export LD_PRELOAD=/XXX-path-to/usb-driver/libusb-driver.so
  • Run the following commands AS ROOT USER to run impact
  impact

Show Contents...Hide Contents...

ChipScope Installation (for Ubuntu)

  • Unzip/untar the Chipscope package to /chipscope
  • Add the following line to the .bashrc file:
 export CHIPSCOPE=/chipscope
  • Source the .bashrc file
 source .bashrc
  • Register Chipscope
 $CHIPSCOPE/bin/lin/cs_register.sh register xxxx-xxxx-xxxx-xxxx

Xilinx Tools Instructions (for Ubuntu)

  • These are instructions from a non-root user account
  • Make directory (first time only)
 mkdir ~/.qt
  • Install license files for IP cores
    • Upload .zip file of license data to home directory
    • Unzip file to place in correct destination (i.e. /home/shafer/.Xilinx/Coregen/CoreLicenses/):
 unzip core_licenses_eval.zip 
  • Load environment variables
 source /Xilinx91/settings.sh
  • Run programs
 ise &
 floorplanner &
 coregen &

  • To run ChipScope tools:
 $CHIPSCOPE/bin/lin/gengui.sh  (Core Generator tool)
 $CHIPSCOPE/bin/lin/inserter.sh  (Core Inserter tool)
 $CHIPSCOPE/bin/lin/analyzer.sh   (Analyzer tool)
 $CHIPSCOPE/bin/lin/cs_register.sh   (License Manager tool)

OLD / DEPRECATED CHANGES (from NetFPGA Alpha testing)

The changes below are for old versions of the NetFPGA platform.

NetFPGA Selftest Changes (for Ubuntu)

  • Configure Ubuntu with the following packages
 sudo apt-get install build-essential
 sudo apt-get install ncurses-dev
 sudo apt-get install libnet1-dev
 sudo apt-get install linux-headers-`uname -r`

  • Modify the /boot/grub/menu.lst file as directed in setup instructions to increase kernel virtual memory space

  • Modify driver to solve bug with undeclared symbols (such as POLLIN, POLLRDNORM, POLLOUT, etc...). Edit "nf2_user.c" in /lib/C/kernel directory and add
 #include 

  • On Ubuntu Installs (6.06LTS), the setpci tool apparently has a quirk/bug/difference that breaks the CPCI programming. The error message is "lspci: -s: Invalid slot number". The following hack in reprogram_cpci.pl fixes this. Place right before the call to dumpregs.sh.
    • Note that this "fix" is NOT NEEDED in newer Ubuntu versions
 # JAS - Override device ID.  Go from 0000:01:09.0 to 01:09.0
 $device_id[$j*2]="01:09.0";

  • Get a WARNING MESSAGE when building the selftest software. Ignore it:
 shafer@netfpga09:~/nf2_setup_20070918/selftest/sw$ make
 gcc -g    -c -o selftest.o selftest.c
 gcc -g    -c -o selftest_dram.o selftest_dram.c
 gcc -g    -c -o selftest_sram.o selftest_sram.c
 gcc -g    -c -o selftest_serial.o selftest_serial.c
 gcc -g    -c -o selftest_phy.o selftest_phy.c
 gcc -g    -c -o selftest_mdio.o selftest_mdio.c
 gcc -g    -c -o selftest_reg.o selftest_reg.c
 gcc -g    -c -o selftest_clk.o selftest_clk.c
 gcc -g    -c -o selftest_dma.o selftest_dma.c
 gcc -g    -c -o or_ip.o or_ip.c
 gcc -g    -c -o or_utils.o or_utils.c
 gcc -lncurses  selftest.o selftest_dram.o selftest_sram.o selftest_serial.o selftest_phy.o selftest_mdio.o selftest_reg.o  selftest_clk.o selftest_dma.o or_ip.o or_utils.o /usr/lib/libnet.a ../../download/common/nf2util.o   -o selftest
 gcc -g    -c -o bad_pkt_dump.o bad_pkt_dump.c
 make: *** No rule to make target `/lib/C/common/nf2util.o', needed by `bad_pkt_dump'.  Stop.

NetFPGA NIC Alpha Changes (for Ubuntu)

Modifications to Standard Package

  • Configure Ubuntu with the following packages
 sudo apt-get install build-essential
 sudo apt-get install linux-headers-`uname -r` 
 sudo apt-get install ncurses-dev
 sudo apt-get install libnet1-dev
 sudo apt-get install libxml-simple-perl    (Used in ./nf21_run_test.pl to verify *simulator* output)
sudo apt-get install libio-interface-perl (Used to manually build a newer version of Net
PCap)

  • Do NOT install the following packages (they are old versions).
 libpcap-dev
 libnet-pcap-perl    

  • The following utilities are expected:
 /sbin/lspci
 /sbin/setpci
Create links to the actual utilities on Ubuntu
 sudo ln /usr/bin/lspci /sbin/lspci
 sudo ln /usr/bin/setpci /sbin/setpci

  • Disable verbose output from the driver. Edit /lib/C/kernel/Makefile and comment out the first line.
  • Modify the /boot/grub/menu.lst file as directed in setup instructions to increase kernel virtual memory space

  • Change all instances of "install -C ..." in ANY MAKEFILE to simply "install ...". The -C option is no longer present.
    • According to an old manpage, the -C option means "Copy the file. If the target file already exists and the files are the same, then don't change the modification time of the target." This flag is not essential.
    • The version of install present in CentOS 4.4 is 5.2.1, while the version in Ubuntu 7.04 is 5.97
    • These are the files to be modified
 bitfiles/Makefile
 lib/scripts/cpci_config_reg_access/Makefile
 lib/scripts/cpci_reprogram/Makefile
 lib/C/download/Makefile
 lib/C/reg_access/Makefile
 lib/C/reg_access/Makefile

  • Modify the driver. Edit "nf2_user.c" in /lib/C/kernel directory and add
 #include 
    • This change seems to be required for all kernels newer than that used in CentOS 4.4, i.e. 2.6.9

  • The built-in command "usleep" is not present in BASH in Ubuntu/Debian. The command "sleep" is equivalent and supports floating-point time intervals, but is off by 10^6 (obviously). Edit these files:
    • /projects/reference_nic/regress/src/reset_phy
    • /projects/reference_nic/regress/src/phy_loopback
    • /projects/reference_nic/regress/src/disable_crc
    • /projects/reference_nic/regress/src/enable_crc
    • /projects/reference_nic/regress/test_loopback_drop/run
  • Replace
 usleep 10;         ... with
 sleep 0.0000010;   

= Installing libpcap and Perl Net
PCAP =

  • The version of libnet-pcap-perl that Debian and Ubuntu 6.06/7.04/7.10 provides is ANCIENT (version 0.04). The latest stable version is 0.14. No newer version is available as a package, so we must build it ourselves.
  • The version of libpcap that Debian and Ubuntu 7.04 provides by default is old (version 0.72). The latest stable version is 0.9.8. Fortunately, the package manager has a newer version called "libpcap0.8" that is really version 0.9.5
  • Remove old packages / install new ones
 sudo apt-get remove libpcap0.7
 sudo apt-get remove libpcap0.7-dev
 sudo apt-get remove libpcap-dev
 sudo apt-get remove libnet-pcap-perl
 sudo apt-get install libpcap0.8
 sudo apt-get install libpcap0.8-dev

 wget http://search.cpan.org/CPAN/authors/id/S/SA/SAPER/Net-Pcap-0.14.tar.gz
  • Unpack Net-Pcap and cd to directory
  • Build from source and install
 perl Makefile.PL
 make
 sudo make install


Dev,,Alpha,,Beta(ro),,Beta-plus
Topic revision: r1 - 20 May 2008 - 19:49:36 - Shafer