Ubuntu Unleashed 2019 Edition: Covering 18.04, 18.10, 19.04

(singke) #1

  1. Apply the patch like this:
    Click here to view code image
    -patch -p1 < patch_filename > mypatch.log 2>&1


(This   last    bit of  code    saves   the message output  to  a   file    so  that    you can
look at it later.)


  1. If the patch applies successfully, you are done and have not endangered
    any of the pristine source code. If the newly patched code does not
    work, you do not have to reinstall the original, pristine source code.

  2. Copy your new code to /usr/src and make that special symbolic link
    described elsewhere in the chapter.


Compiling the Kernel


If you want to update the kernel from new source code you have downloaded,
or if you have applied a patch to add new functionality or hardware support,
you must compile and install a new kernel to actually use that new
functionality. Compiling the kernel involves translating the kernel’s contents
from human-readable code to binary form. Installing the kernel involves
putting all the compiled files where they belong in /boot and /lib and
making changes to the boot loader.


The process of compiling the kernel, like the process of installing it, is almost
completely automated by the make utility. By providing the necessary
arguments and following the steps covered next, you can recompile and
install a custom kernel for your use



  1. Do not delete your current kernel, so that you will have a backup that you
    can use to boot if there is a problem with the one you compile.

  2. Apply all patches, if any, so that you have the features you desire. See the
    previous section for details.

  3. Back up the .config file, if it exists, so that you can recover from the
    inevitable mistake. Use the following cp command to do so:
    Click here to view code image
    matthew@seymour:~$ sudo cp .config .config.bak


NOTE
If you are recompiling the Ubuntu default kernel, the
/usr/src/linux-4.15/configs directory contains several versions
of configuration files for different purposes.
Free download pdf