Ubuntu Unleashed 2019 Edition: Covering 18.04, 18.10, 19.04

(singke) #1

You issue the following command in the /usr /src/linux-4.15
directory:


Click here to view code image
matthew@seymour:~$ sudo scripts/patch-kernel /usr/src/linux-4.15.1
/usr/src/linux- 4.15.1/patch


Each successive patch file is applied, eventually creating a 4.15.3 code
tree. If any errors occur during this operation, files named xxx# or xxx.rej
are created, where xxx is the version of the patch that failed. You have to
resolve these failed patches manually by examining the errors and looking at
the source code and the patch. An inexperienced person will not have any
success with this because you need to understand C programming and kernel
programming to know what is broken and how to fix it. Because this was a
stock 4.1.1 code tree, the patches were all successfully applied without
errors. If you are attempting to apply a nonstandard third-party patch, the
patch might fail.


When you have successfully patched the kernel, you are ready to begin
compiling this code tree as if you were starting with a fresh, stock 4.15.3
kernel tree.


USING   THE PATCH   COMMAND
If you have a special, nonstandard patch to apply—such as a third-party
patch for a commercial product—you can use the patch command rather
than the special patch-kernel script that is normally used for kernel
source updates. Here are some quick steps and an alternative method of
creating patched code and leaving the original code alone:


  1. Create a directory in your home directory and name it something
    meaningful, like mylinux.

  2. Copy the pristine Linux source code there with the following:
    Click here to view code image
    cp -ravd /usr/src/linux-4.15/* ~/mylinux

  3. Copy the patch file to that same directory as follows:
    Click here to view code image
    cp patch_filename ~/mylinux

  4. Change to the ~/mylinux directory with this command:
    Click here to view code image
    cd ~/mylinux

Free download pdf