UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor andyzkey
Visitor
3,709 Views
Registered: ‎08-06-2017

Platform Cable USB on Linux Fedora 26 - install_drivers problems

Jump to solution

Almost certainly an unsupported combo, but hey, someone may find this useful...

 

I upgraded my system to Fedora 25 land installed ISE 14.7, and then couldn't get the drivers to work.

I downloaded the latest install_drivers package last week, but couldn't use it as I couldn't get the right kernel source package installed.

So today I upgraded to Fedora 26 and got all the kernel-* packages installed successfully, and tried again.

I'm currently using 4.11.11-300.fc26.x86_64.

 

 

When I run ./install_drivers, I get the attempt1.log output, of which the interesting part is

checking linux kernel version... hello.c:1:10: fatal error: linux/utsrelease.h: No such file or directory
#include <linux/utsrelease.h>

I suspect the driver package isn't looking in the right place, as I find a suitable file in

/usr/src/kernels/4.11.11-300.fc26.x86_64/include/generated/utsrelease.h

 

As I'm not using parallel port, I'm using the USB driver, rather than fix the above, I edited install_drivers to skip the windrvr6 stuff like this

#@@@AK
# install_windrvr6
true

 

Next it fails with

scripts/Makefile.build:49: *** CFLAGS was changed in "/opt/install_drivers/linux_drivers/xpc4drvr2_6/xpc4drvr/Makefile". Fix it to use ccflags-y. Stop.

 

https://stackoverflow.com/questions/11077957/kernel-module-compilation-and-kbuild-nopedantic

explains the problem, so I edit linux_drivers/xpc4drvr2_6/xpc4drvr/Makefile as follows :-

ifeq ($(ARCH_64BIT),1)
#@@@AK
ccflags-y += -mcmodel=kernel
#CFLAGS += -mcmodel=kernel
endif
ifeq ($(GET_USER_SIZE_SYM),0)
#@@@AK
ccflags-y += -DNO_GET_USER_SIZE
#CFLAGS += -DNO_GET_USER_SIZE
endif

I expect Xilinx will need to update the official package in the same way.

 

Trying again I get attempt2.log, including this line

CC [M] /opt/install_drivers/linux_drivers/xpc4drvr2_6/xpc4drvr/xpc4.o
In file included from ./include/linux/linkage.h:4:0,
from ./include/linux/kernel.h:6,
from /opt/install_drivers/linux_drivers/xpc4drvr2_6/xpc4drvr/xpc4.c:18:
/opt/install_drivers/linux_drivers/xpc4drvr2_6/xpc4drvr/xpc4.c: In function ???XPC4_access_ok???:
./arch/x86/include/asm/uaccess.h:38:33: error: dereferencing pointer to incomplete type ???struct task_struct???

Lots more breakage follows...

 

Now this is obviously much more of a breakage, probably not one I'll be able to hack around.

 

Is anyone able to use the Platform USB cable on Fedora 26...?

As Fedora is upstream of distros like RedHat, should I be optimistic that fixes will be forthcoming, and if so, on what timetable?

 

{{{ Andy

 

0 Kudos
1 Solution

Accepted Solutions
Visitor andyzkey
Visitor
6,359 Views
Registered: ‎08-06-2017

Re: Platform Cable USB on Linux Fedora 26 - install_drivers problems

Jump to solution

Well, if Xilinx isn't likely to update the code, I thought I'd have a try.

I edited /opt/install_drivers/linux_drivers/xpc4drvr2_6/xpc4drvr/xpc4.c, with these changes

 

//@@@AK
#include <linux/sched.h> // for task_struct
#include <linux/slab.h> // for kmalloc

 

#ifdef HAVE_UNLOCKED_IOCTL
DEFINE_MUTEX(xpc4_mutex);
EXPORT_SYMBOL_GPL(xpc4_mutex);
// @@@AK, .unlocked_ioctl is a new interface, as of 2.6.11.
// its called without the BKL, per https://lwn.net/Articles/119652/.
// https://lkml.org/lkml/2008/1/8/213 doesn't help that much because
// lock_kernel and unlock_kernel vanish as of 2.6.39.
// A better pattern is in https://lwn.net/Articles/383420/.
long xpc4_unlocked_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
    {
    int err;
    mutex_lock(&xpc4_mutex);
    err = xpc4_ioctl(NULL /* luckily not used */, filp, cmd, arg);
    mutex_unlock(&xpc4_mutex);
    return err;
    }
#endif

 

struct file_operations xpc4_fops = {
   .owner = THIS_MODULE,
// @@@AK
#ifdef HAVE_UNLOCKED_IOCTL
    .unlocked_ioctl = xpc4_unlocked_ioctl,
#else
    .ioctl = xpc4_ioctl,
#endif
    .open = xpc4_open,
    .release = xpc4_release
};

 

This got it to compile.

 

I noticed that I had to fix /etc/udev/rules.d/xusbdfwu.rules, so that if found the .hex file beneath etc/hotplug/usb/xusbdfwu.fw rather than below /usr/share.

 

I unplugged and replugged my cable, and I notice some errors in the journal log.

But despite this, the LED lights up, and I was able to program an xc3s500 Spartan using the excellent xc3sprog tool (which I prefer over iMPACT).

 

Net result - SUCCESS - I can continue to program my Xilinx FPGAs, despite upgrading Linux even further away from the officially support distros/versions.

 

Hopefully this is of use to others.

 

{{{ Andy

6 Replies
Voyager
Voyager
3,658 Views
Registered: ‎06-24-2013

Re: Platform Cable USB on Linux Fedora 26 - install_drivers problems

Jump to solution

Hey @andyzkey

 

I hate to say it, but the Xilinx ISE 14.7 IRN clearly states (on page 7):

 

Xilinx only supports the following operating systems on x86 and x86-64 processor architectures.

 

Linux Support

  • Red Hat Enterprise Workstation 5 (32-bit and 64-bit)
  • Red Hat Enterprise Workstation 6 (32-bit and 64-bit)
  • SUSE Linux Enterprise 11 (32-bit and 64-bit)

So I guess there are no plans to make it work on Fedora 25 or 26 ... but maybe I'm wrong.

 

Best,

Herbert

-------------- Yes, I do this for fun!
0 Kudos
Scholar hbucher
Scholar
3,618 Views
Registered: ‎03-22-2016

Re: Platform Cable USB on Linux Fedora 26 - install_drivers problems

Jump to solution

@hpoetzl @andyzkey

Looks like RH6 is based on Fedora 12/13 - kernel was still 2.6

Fedora 25 has kernel 4.11

It is a huge jump, especially if you are building kernel modules

 

 

vitorian.com --- We do this for fun. Always give kudos. Accept as solution if your question was answered.
I will not answer to personal messages - use the forums instead.
0 Kudos
Voyager
Voyager
3,610 Views
Registered: ‎06-24-2013

Re: Platform Cable USB on Linux Fedora 26 - install_drivers problems

Jump to solution

It is a huge jump, especially if you are building kernel modules.

 

Indeed!

 

The main question is: is it a wrapper around some binary blob or is the driver available in source.

In the latter case, it should be definitely possible to adapt it to newer Linux kernels.

 

Best,

Herbert

-------------- Yes, I do this for fun!
0 Kudos
Visitor andyzkey
Visitor
6,360 Views
Registered: ‎08-06-2017

Re: Platform Cable USB on Linux Fedora 26 - install_drivers problems

Jump to solution

Well, if Xilinx isn't likely to update the code, I thought I'd have a try.

I edited /opt/install_drivers/linux_drivers/xpc4drvr2_6/xpc4drvr/xpc4.c, with these changes

 

//@@@AK
#include <linux/sched.h> // for task_struct
#include <linux/slab.h> // for kmalloc

 

#ifdef HAVE_UNLOCKED_IOCTL
DEFINE_MUTEX(xpc4_mutex);
EXPORT_SYMBOL_GPL(xpc4_mutex);
// @@@AK, .unlocked_ioctl is a new interface, as of 2.6.11.
// its called without the BKL, per https://lwn.net/Articles/119652/.
// https://lkml.org/lkml/2008/1/8/213 doesn't help that much because
// lock_kernel and unlock_kernel vanish as of 2.6.39.
// A better pattern is in https://lwn.net/Articles/383420/.
long xpc4_unlocked_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
    {
    int err;
    mutex_lock(&xpc4_mutex);
    err = xpc4_ioctl(NULL /* luckily not used */, filp, cmd, arg);
    mutex_unlock(&xpc4_mutex);
    return err;
    }
#endif

 

struct file_operations xpc4_fops = {
   .owner = THIS_MODULE,
// @@@AK
#ifdef HAVE_UNLOCKED_IOCTL
    .unlocked_ioctl = xpc4_unlocked_ioctl,
#else
    .ioctl = xpc4_ioctl,
#endif
    .open = xpc4_open,
    .release = xpc4_release
};

 

This got it to compile.

 

I noticed that I had to fix /etc/udev/rules.d/xusbdfwu.rules, so that if found the .hex file beneath etc/hotplug/usb/xusbdfwu.fw rather than below /usr/share.

 

I unplugged and replugged my cable, and I notice some errors in the journal log.

But despite this, the LED lights up, and I was able to program an xc3s500 Spartan using the excellent xc3sprog tool (which I prefer over iMPACT).

 

Net result - SUCCESS - I can continue to program my Xilinx FPGAs, despite upgrading Linux even further away from the officially support distros/versions.

 

Hopefully this is of use to others.

 

{{{ Andy

Voyager
Voyager
3,595 Views
Registered: ‎06-24-2013

Re: Platform Cable USB on Linux Fedora 26 - install_drivers problems

Jump to solution

@andyzkey  congrats!  please go ahead and mark this as solution ^^

-------------- Yes, I do this for fun!
0 Kudos
Newbie dsaoe
Newbie
2,249 Views
Registered: ‎02-27-2018

Re: Platform Cable USB on Linux Fedora 26 - install_drivers problems

Jump to solution
The other option is to run the install_drivers script for Vivado - this will also allow ISE to access the device using the correct drivers. I'm running Fedora 27 and tested with a Basys2, Nexys2 and Nexys3. The setup is described in UG973.
0 Kudos