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.

Starting from the Embedded Linux BSP 2.7b4, Toradex added kernel driver backports to its demo images, therefore you may want to have a look at how to build our BSP from scratch using OpenEmbedded, since the backports are already integrated.

Toradex provides a Git repository for backports: backports-toradex.git

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. The backports drivers integrated into the demo images already take that into consideration and have been tested with the L4T Linux kernel.

How to Cross-Compile the Backports Drivers From Source

This section provides information on how to cross-compile the Wi-Fi backports. The instructions apply for other drivers/subsystems.

To enable support for driver backports 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, it is necessary 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 the above mentioned article. Clone the backports Git repository to your machine and checkout the latest remote branch:

git clone git://git.toradex.com/backports-toradex.git
cd backports-toradex
git checkout -b toradex-4.14 origin/toradex-4.14

Export a few more environment variables in addition to the ones described here.

export KLIB=<target-rootfs>
export KLIB_BUILD=<path-to-the-kernel-build-directory>

E.g.

export KLIB=~/build_wifi
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 you choose to use this option just use the make defconfig-option in replacement for make menuconfig.

$ make defconfig-help
Driver or subsystem configuration targets:
defconfig-ar5523
defconfig-ath10k
defconfig-ath5k
defconfig-ath6kl
defconfig-ath9k
defconfig-ath9k-debug
defconfig-b43
defconfig-b43legacy
defconfig-brcmfmac
defconfig-brcmsmac
defconfig-carl9170
defconfig-cw1200
defconfig-hwsim
defconfig-iwlwifi
defconfig-rtlwifi
defconfig-wcn36xx
defconfig-wifi
defconfig-wil6210
defconfig-wwan

For example to compile wifi drivers:

$ make defconfig-wifi
$ make -j4 modules

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 modules_install

Copy the compiled modules to target:

$ scp -r ~/build_wifi/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