Search by Tags

Kernel Driver Backports Integration

 
Applicable for

Compare with Revision

Subscribe for this article updates

For many off-the-shelf devices to work a suitable driver needs to be compiled into a custom Linux kernel. Not all such drivers are available in custom downstream Linux kernels in which case one can use the driver backports package including suitable drivers available from later Linux kernel versions.

Driver backports are available for the following subsystems:

  • Ethernet
  • Wireless
  • Bluetooth
  • NFC
  • ieee802154 (ZigBee & 6LoWPAN)
  • Media
  • Regulator

The L4T Linux kernel from NVIDIA is not based on top of a clean 3.1 kernel but rather some pre 3.2 version with further Android additions.

Not all the driver backports packages will work with that L4T kernel version. So far the driver backports package v3.11.8-1 has been tested with the L4T Linux kernel.

An Example to Show How to Cross-Compile the Backports Iwlwifi Drivers:

To enable support for iwlwifi a custom Linux kernel is required. Please refer to the following article concerning setup/compilation of the same:

Build U-Boot and Linux Kernel from Source Code

Before cross-compiling driver backports one needs to disable the drivers/dependencies enabled in the L4T Linux kernel to avoid conflicts. For cross-compiling iwlwifi one needs to disable the following configs in the L4T Linux kernel:

  • CONFIG_CFG80211
  • CONFIG_WLAN

Then just compile and deploy the custom kernel as explained in above mentioned article.

Cross-Compiling Backports Iwlwifi Drivers

To avoid errors with EXPORT_SYMBOL_GPL while compiling driver backports change the KERNEL_VERSION to (3,1,0) in backports-include/linux/export.h:

- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
$ export ARCH=arm
$ export CROSS_COMPILE=~/gcc-linaro/bin/arm-linux-gnueabihf-
$ export KLIB=~/build_iwlwifi
$ export KLIB_BUILD=~/linux-toradex

One can use nconfig/menuconfig to configure the driver backports package. Default configuration files are also available which can be used to build the drivers/subsystems. If to use this option just use the 'make defconf-option' in replacement for make menuconfig.

$ make defconfig-help
Driver or subsystem configuration targets:
  defconfig-alx
  defconfig-ar5523
  defconfig-ath10k
  defconfig-ath5k
  defconfig-ath6kl
  defconfig-ath9k
  defconfig-b43
  defconfig-b43legacy
  defconfig-brcmfmac
  defconfig-brcmsmac
  defconfig-carl9170
  defconfig-drm
  defconfig-ieee802154
  defconfig-iwlwifi
  defconfig-media
  defconfig-nfc
  defconfig-regulator
  defconfig-rtlwifi
  defconfig-wifi
  defconfig-wil6210

For example to compile iwlwifi drivers:

$ make defconfig-iwlwifi
$ make -j4

The 'make install' target isn't currently sane for cross-builds. Comment out the scripts backport_firmware_install, update-initramfs etc from being run out of the Makefiles.

$ make install

Copy the compiled modules to target:

$ scp -r ~/build_iwlwifi/lib/modules/3.1.10-g54d69d3 root@10.18.0.124:/lib/modules/

Firmware

Most Wi-Fi hardware uses specific firmware to operate properly. Certain such firmware can easily be installed as follows:

# opkg update
# opkg --force-depends install linux-firmware

Intel 7260 mini-PCIe Wi-Fi module with backported iwlwifi driver on Apalis T30.

During boot one gets the following kernel messages:

[   13.801594] Loading modules backported from Linux version v3.11.8-0-g02709ef                                                                                      
[   13.849714] Backport generated by backports.git v3.11.8-1-0-gb22d1cd                                                                                              
[   14.638853] cfg80211: Calling CRDA to update world regulatory domain                                                                                              
[   15.068568] Intel(R) Wireless WiFi driver for Linux, in-tree:d                                                                                                    
[   15.076809] Copyright(c) 2003-2013 Intel Corporation                                                                                                              
[   15.171085] iwlwifi 0000:04:00.0: loaded firmware version 22.1.7.0 op_mode iwlmvm                                                                                 
[   16.786565] iwlwifi 0000:04:00.0: Detected Intel(R) Wireless N 7260, REV=0x144                                                                                    
[   16.800739] iwlwifi 0000:04:00.0: L1 Disabled; Enabling L0S                                                                                                       
[   16.809894] iwlwifi 0000:04:00.0: L1 Disabled; Enabling L0S                                                                                                       
[   17.038502] Registered led device: phy0-led                                                                                                                       
[   18.410483] ADDRCONF(NETDEV_UP): enp7s0: link is not ready                                                                                                        
[   18.425138] ieee80211 phy0: Selected rate control algorithm 'iwl-mvm-rs'                                                                                          
[   18.493031] iwlwifi 0000:04:00.0: L1 Disabled; Enabling L0S                                                                                                       
[   18.498950] iwlwifi 0000:04:00.0: L1 Disabled; Enabling L0S                                                                                                       
[   18.544093] ADDRCONF(NETDEV_UP): wlp4s0: link is not ready                             
....
root@apalis-t30:~# uname -a
Linux apalis-t30 3.1.10-g54d69d3 #23 SMP PREEMPT Wed Jun 10 17:46:46 IST 2015 armv7l GNU/Linux
root@apalis-t30:~# ls /lib/modules/3.1.10-g54d69d3/
modules.alias        modules.dep          modules.softdep      updates
modules.alias.bin    modules.dep.bin      modules.symbols
modules.builtin.bin  modules.devname      modules.symbols.bin
root@apalis-t30:~# lsmod
Module                  Size  Used by
iwlmvm                150786  0 
mac80211              477632  1 iwlmvm
iwlwifi               153573  1 iwlmvm
cfg80211              439297  3 iwlwifi,mac80211,iwlmvm
compat                 24552  4 cfg80211,iwlwifi,mac80211,iwlmvm