Forum Discussion

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

AOCL with the DE5-Net on Ubuntu workstation : Recompiling the PCIe driver from source

Hello everyone,

I have recently acquired a DE5-Net development kit from Terasic. This board includes a StratixV GX from Altera.

However, the PCIe driver bundled with it targets a RedHat Linux platform.

Currently I only have access to Ubuntu 14.04 LTS.

I understand that this makes things a bit complicated, but I do not have the option of changing to CentOS, RedHat or SUSE.

I would need to recompile the PCIe driver from source, and since Ubuntu uses a different Linux kernel (3.13.0-35-generic on this system), this involves quite a lot of things.

Correct me if any of my assumptions are mistaken, but I am attempting to recompile the PCIe driver source located at $aocl_board_package_root/host/linux64/driver .

The install script make_all.sh had to be modified to use the Ubuntu kernel source headers. I think there is a fair bit more to do, but I am not sure.

Is there anything I should watch out for?

I have browsed for similar topics, and am in touch with others who were or are in a similar scenario.

Regards,

Victor

PS: I am currently running Quartus II with the AOCL installed, updated to the most recent service pack (Version 14.0.1 Build 205).

2 Replies

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

    You are right that the PCIe driver is not supporting Ubuntu, but there is a way to workaround this. To do so, you will need to modify your board package.

    1. Go to the driver source location ($AOCL_BOARD_PACKAGE_ROOT/host/linux64/driver). In file "aclpci_cmd.c", and comment out the following lines

    if (dev->aer_firmware_first) {

    return -EIO;

    }

    2. In the same directory, the file "make_all.sh", modify the line from

    SRC_PATH=/usr/src/kernels/`uname -r`-`uname -m`

    to

    SRC_PATH=/lib/modules/`uname -r`/build

    3. Go to $AOCL_BOARD_PACKAGE_ROOT/linux64/bin, modify the "install" script. Add commands to create the directories for both MODPROBE_FILE (sudo mkdir -p /etc/sysconfig/modules) and RULE_FILE (sudo mkdir -p /etc/udev/rules.d) before those files are created.

    After the three steps above, you should be able to install the driver by running "aocl install". I have successfully installed and run the driver on Ubuntu with a Nallatech board before. Hopes this works for you as well.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi zHiO.o,

    I had figured some of these steps out already, the community here is very good!

    There is a bit more to do with regards to step# 1; are the __devinit and __devexit macros no longer required?

    Also pci_restore_state(aclpci->pci_dev) function call no longer returned a result 0, as it returns void.

    A simple recoding later and aclpci_cmd.c was all set.

    I found out about step# 3 a little bit too late, but thankfully was able to realize what was going on and migrate the script-generated files from the /tmp/ folder.

    Your instruction is a life-saver to anyone possibly running into this scenario in the future.

    Thank you!

    Victor

    PS: Although the reprogram has been recompiled successfully and I can run aocl install without a hitch, I tried flashing using

    > aocl flash de5net_a7 blank.aocx

    where blank.aocx is a blank program supplied by Terasic (or Altera?) for me to run verification. I get

    aocl flash: Running flash from /opt/altera/14.0/hld/board/terasic/de5net/linux64/bin
    Error: Currently only .bin files are accepted.
           Please use the .bin from the original compiled project

    I think I'll figure it out, but really I'm at a loss as to what the error message means.

    I should be able to work it out once I understand the error.

    Should I start a new thread since this is a different issue?

    Edit: Whoops. Forgot to edit this post earlier to say that I quickly found out what was going on.

    It seems that the blank.aocx was compiled for an earlier version (13.1).

    Therefore flashing with it gave funny errors.

    I simply acquired a more uptodate BSP from Terasic's mail server.

    Refer to: http://www.alteraforum.com/forum/showthread.php?t=45720

    And here is the link mentioned in post# 9 and also passed onto me from the support team at Terasic:

    http://mail.terasic.com.cn/~wyzhou/terasic.zip