Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Nächste Überarbeitung
Vorhergehende Überarbeitung
Nächste ÜberarbeitungBeide Seiten der Revision
software:linux:realtime:preempt_rt:build_kernel [2019-01-21 16:28] – angelegt mgehrig2software:linux:realtime:preempt_rt:build_kernel [2019-02-15 10:31] mgehrig2
Zeile 8: Zeile 8:
  
 ==== Get the preemt-rt patch ==== ==== Get the preemt-rt patch ====
-Check [[https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/|here]] whether a patch is available for your currently installed kernel and download it.+Check [[https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/|here]] whether a patch is available for your currently installed kernel.
 If not, choose the next newer version and download the patch. If not, choose the next newer version and download the patch.
- 
  
 For example:\\ For example:\\
 If you are running a 4.4.165 kernel choose the following patch:\\ If you are running a 4.4.165 kernel choose the following patch:\\
 [[https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/4.4/patch-4.4.148-rt166-rc1.patch.gz|patch-4.4.148-rt166-rc1.patch.gz]] [[https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/4.4/patch-4.4.148-rt166-rc1.patch.gz|patch-4.4.148-rt166-rc1.patch.gz]]
 +
 +If you want to use a kernel version that is not already installed, please install the generic kernel with the correct version with [[software:linux:linux_os:install_old_kernel|this guide]] first.
  
 ==== Get the Linux sources ==== ==== Get the Linux sources ====
   * Clone the kernel <code>git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git</code>   * Clone the kernel <code>git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git</code>
 +  * Check out the same version as chosen for the patch <code>git checkout -b RTPatch tags/v4.4.148</code>
 +
 +==== Install the compatible generic kernel ====
 +For RT-patch v4.4.148-rt166-rc1 install generic kernel 4.4.0
 +
 +[[software:linux:linux_os:install_old_kernel|Instructions]]
 +
 +
 +
 +===== Build the kernel =====
 +==== Patch the kernel sources ====
 +  * Go into the kernel source directory
 +  * Apply the patch<code>cd <pathToKernelSrc>
 +patch -p1 < <pathToPatch>/patch-4.4.148-rt166-rc1.patch</code>
 +
 +==== Choose the build variant ====
 +This selection will affect, how many modules will be built.
 +The sizef and the range of functions of the monolitic kernel will not be changed.
 +Additional modules can be built and installed after the kernel is installed.
 +
 +
 +  * **a.) Full module support** **(The easy way)** A normal Linux distribution, like Ubuntu, will install a kernel and most of the available kernel modules. Many of them are never used, because they are drivers for hardware, which is not installed on the PC. This variant contains the same modules like a full Ubuntu kernel.
 +  * **b.) Minimal**: **(The propper way)** This will only build modules which are essential. Some basic functionality, like WiFi drivers, may be missing. Some common Ethernet drive are in the monolithic part of the kernel and will still work. You can add all modules you need manually. This method is recommended in order to obtain a system that is as stable as possible. If fewer drivers are loaded, there is less risk that an unused driver will cause high latency.
 +
 +==== Configure the kernel ====
 +=== a.) Full module support ===
 +  - Copy the kernel configuration from the generic kernel.
 +    * Make sure you copy the correct config-file with the correct version (i.e. ''config-4.4.0-040400-generic'')<code>cd <pathToKernelSrc>
 +cp /boot/<yourDistributionConfig> ./.config</code>
 +  - Applay the configuration to the patched kernel sources.<code>make oldconfig</code>
 +    * This will apply the configuration. However, since the kernel is patched and not identical to the generic kernel, not all configurations are defined. Acccept all presented options with ''ENTER''.
 +
 +
 +=== b.) Minimal ===
 +You have three different options:
 +  * **a.)** Configure the kernel to add only the bare minimum. Add all additional modules manually.
 +  * **b.)** Configure the kernel to add all modules, which are currently loaded on the host pc.
 +  * **c.)** Configure the kernel to add all modules, which are currently loaded on a different pc.
 +
 +
 +  - <code>cd <pathToKernelSrc></code>
 +  - Depending on the CPU architecture:
 +    - X86 - 64bit <code>make x86_64_defconfig</code>
 +    - X86 - 32bit ''make i386_defconfig''
 +    - See ''<pathToKernelSrc>/arch/<architecture>/configs'' for more possibilities
 +
 +
 +=== Additional configurations ===
 +  - Open the configuration menu <code>make menuconfig</code>
 +  - Enable the fully preemptible kernel (The path may be different depending on the kernel version)
 +    * Processor type and features ---> Preemption  Model /Voluntary Kernel Preemption (Desktop)) ---> **(X) Fully Preemptible Kernel (RT)** 
 +      * or
 +    * Kernel options  ---> Preemption Model (No Forced Preemption (Server))  --->  **(X) Fully Preemptible Kernel (RT)** 
 +  - Deactivate expert mode
 +    - General setup ---> **[ ] Configure standard kernel features (expert users)**
 +  - Save the configuration and exit the menu
 +
 +
 +
 +==== Make and install the kernel ====
 +This will going to take about an hour.
 +
 +  - Compile kernel <code>make -j8</code>
 +  - Compile modules <code>make modules -j8</code>
 +  - Install kernel modules <code>sudo make modules_install</code>
 +  - Install kernel <code>sudo make install</code>
 +  - Reboot
 +  - Check with ''uname -a'' the kernel version
 +