Changes between Version 14 and Version 15 of linux/kernel


Ignore:
Timestamp:
07/24/2019 05:49:19 PM (4 months ago)
Author:
Ryan Erbstoesser
Comment:

add info about kernel headers, point to prebuilt

Legend:

Unmodified
Added
Removed
Modified
  • linux/kernel

    v14 v15  
    252252[=#headers]
    253253== Installing Kernel Headers
     254
     255This section is in regards to installing kernel headers into the Linux kernel build detailed above. These instructions are not for installing headers on an already running target board (ie Gateworks SBC).
     256
    254257The 'make headers_install' command exports the kernel's header files in a form suitable for use by userspace programs. These headers describe the API for user space programs attempting to use kernel services and are used by the system's C library (ie glibc or uClibc) to define available system calls as well as constants and structures to be used with these system calls. The C library's header files are usually installed in /usr/include and the kernel's headers are usually in /usr/include/linux and /usr/include/asm. Kernel headers are backwards compatible but not forwards compatible meaning a program built against a C library using older kernel headers should run on a newr kernel (although possibly missing access to new features) but a program built against newer kernel headers may not work on an older kernel.
    255258
     
    258261Reference:
    259262 - https://www.kernel.org/doc/Documentation/kbuild/headers_install.txt
     263
     264
    260265
    261266
     
    268273To build external modules you must have a prebuilt kernel available that contains the configuration and header files used in the build. Also the kernel must have been built with modules enabled.
    269274
     275 * Newport prebuilt kernel: [http://dev.gateworks.com/newport/kernel/]
     276 * Ventana prebuilt kernel: [http://dev.gateworks.com/ventana/images/]
     277 * Note, for example, on a running Gateworks Newport SBC using Ubuntu, do not use the below command, because this will install the Ubuntu kernel headers which do not match the Gateworks kernel:
     278{{{
     279apt-get install linux-headers-generic
     280}}}
     281
    270282To build an external kernel module you typically would use:
    271283{{{#!bash
     
    273285make -C <path-to-prebuilt-kernel> M=$PWD
    274286}}}
    275  * this will build the modules located in the current directory pointed to by the M param
    276  * you can then manually copy or load your kernel modules or use the modules_install make target to install them to a specific path
    277  * if cross-compiling make sure to define ARCH and CROSS_COMPILE env variables and have the $(CROSS_COMPILE)-gcc in your path
     287 * This will build the modules located in the current directory pointed to by the M param
     288 * You can then manually copy or load your kernel modules or use the modules_install make target to install them to a specific path
     289 * If cross-compiling make sure to define ARCH and CROSS_COMPILE env variables and have the $(CROSS_COMPILE)-gcc in your path
    278290
    279291As an example consider the following files in a directory called 'hello-driver':