NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Installing Kernel Drivers

Hi,

I'm trying to install STAR-System driver on cRIO-9033 by following steps in the attached driver setup guide. I'm running into the following error when running one of the installation scripts (./build_star-system.sh)

--------------

#make -C /lib/modules/3.10.31-ltsi-rt29-2.0.0f0/build M=/usr/local/STAR-Dundee/STAR-System/STAR-System/driver_src/pci_driver modules

#make: *** /lib/modules/3.10.31-ltsi-rt29-2.0.0f0/build: No such file or directory.  Stop.

-------------

I understand that when building a driver, you need to get the source of the running kernel and compile it to get kernel hearders and the "/lib/modules/3.10.31-ltsi-rt29-2.0.0f0/build" folder that the driver install script is looking for . I got the source by running the following command:

#git clone git://github.com/ni/linux.git

and then I tried compiling the kernel by running:

#cd linux

#make clean

#make ARCH=x86_64 menuconfig

which resulted in the following error:

-----------

Free' [-Wimplicit-function-declaration]

make[1]: *** [scripts/kconfig/zconf.tab.o] Error 1

make: *** [menuconfig] Error 2

-----------

Is there something wrong with the steps I'm following? What's the best way to get the "/lib/modules/3.10.31-ltsi-rt29-2.0.0f0/build" on my cRIO?

Thanks for your help,

-Sev

Sev K.
Senior Systems R&D Engineer | Wireless | CLA
National Instruments
Message 1 of 7
(6,463 Views)

This tutorial is a good starting place for adding kernel modules/drivers: "Tutorial: Adding Kernel Modules on NI Linux Real-Time"

0 Kudos
Message 2 of 7
(3,954 Views)

I've tried adding the kernel module from source as mentioned in the tutorial, however, I ran into some errors (see attached screenshot).

The driver setup instructions state to execute "build_star-system.sh" script that does similar steps to those described in the tutorial, however, it also performs other steps that this driver installation needs. I think if I can get this script to execute successfully we'll be good to go. Right now I'm missing the "/lib/modules/3.10.31-ltsi-rt29-2.0.0f0/build" on my cRIO which prevent the script from executing successfully. Do you know how can I get this folder on my system?

Sev K.
Senior Systems R&D Engineer | Wireless | CLA
National Instruments
0 Kudos
Message 3 of 7
(3,954 Views)

I took a quick look at the source for this, it's a real mess of mixed source and binary blobs that needs quite a bit of work to build on our targets (and, even with ironing out the build issues, there may be kernel version issues).

If, however, you wanted to work through this, the error message gives you a big hint:

No rule to make target `.../spwusb_driver.o`

this is one of the binary blobs included with the component, and it's looking for it in the wrong place.

0 Kudos
Message 4 of 7
(3,954 Views)

I found a folder that has /spwusb_driver.o_shipped file. Copying that file and other .o_shipped files to driver source directory and renaming it to .o files fixes that issue, but other issues come up. Do you know what will generate the /lib/modules/3.10.31-ltsi-rt29-2.0.0f0/build folder on the cRIO?

Sev K.
Senior Systems R&D Engineer | Wireless | CLA
National Instruments
0 Kudos
Message 5 of 7
(3,954 Views)

That should be done by step 3 of the document linked above. Once you've done that, I usually just run this command:

ln -s /var/volatile/tmp/headers/kernel /lib/modules/$(uname -r)/build

0 Kudos
Message 6 of 7
(3,954 Views)

In the normal module "keying" for NI driver modules (e.g. make sure that NI-RIO 14 will load into the current kernel), there is no need for the build folder to exist at that exact location. If there is something coded to expect that folder, it's probably not doing something correctly. It certainly is not flexible and would not work for all Linux distributions.

If you simply must have the contents of a normal /lib/modules/`uname -r`/build, DAQjr got it noting that you should link /var/volatile/tmp/headers/kernel. Now, note that, on reboot, that will now be a broken symlink until you re-source the versioning_utils script and rerun setup_versioning_env.

0 Kudos
Message 7 of 7
(3,954 Views)