| 1 |
Building Out-of-Tree Kernel Drivers for Linux |
| 2 |
============================================= |
| 3 |
|
| 4 |
Prerequisites |
| 5 |
------------- |
| 6 |
|
| 7 |
The system must have relevant Linux kernel headers or source code installed. |
| 8 |
|
| 9 |
|
| 10 |
Build |
| 11 |
----- |
| 12 |
|
| 13 |
To build ``igb_uio`` driver, simply run ``make`` command |
| 14 |
inside the ``igb_uio`` directory: |
| 15 |
|
| 16 |
.. code-block:: console |
| 17 |
|
| 18 |
cd igb_uio |
| 19 |
make |
| 20 |
|
| 21 |
If compiling against a specific kernel source directory is required, |
| 22 |
it is possible to specify the kernel source directory |
| 23 |
using the ``KSRC`` variable: |
| 24 |
|
| 25 |
.. code-block:: console |
| 26 |
|
| 27 |
make KSRC=/path/to/custom/kernel/source |
| 28 |
|
| 29 |
|
| 30 |
Load |
| 31 |
---- |
| 32 |
|
| 33 |
.. note:: |
| 34 |
|
| 35 |
These commands are to be run as ``root`` user. |
| 36 |
|
| 37 |
The ``igb_uio`` driver requires the UIO driver to be loaded beforehand. |
| 38 |
If ``uio`` is not built-in: |
| 39 |
|
| 40 |
.. code-block:: console |
| 41 |
|
| 42 |
modprobe uio |
| 43 |
|
| 44 |
Then the out-of-tree driver may be loaded. |
| 45 |
|
| 46 |
.. code-block:: console |
| 47 |
|
| 48 |
insmod igb_uio.ko |
| 49 |
|
| 50 |
|
| 51 |
Clean |
| 52 |
----- |
| 53 |
|
| 54 |
To clean the build directory, the following command can be run: |
| 55 |
|
| 56 |
.. code-block:: console |
| 57 |
|
| 58 |
make clean |