3.3.2. Patches

Patch descriptions are very similar to configuration fragment descriptions, which are described in the previous section. However, instead of a .cfg file, these descriptions work with source patches (i.e. .patch files).

A typical patch includes a description file and the patch itself. As an example, consider the build patches used with the linux-yocto-4.12 kernel as defined outside of the recipe space (i.e. yocto-kernel-cache). This Metadata consists of several files: build.scc and a set of *.patch files. You can find these files in the patches/build directory of the yocto-4.12 branch in the yocto-kernel-cache Git repository.

The following listings show the build.scc file and part of the modpost-mask-trivial-warnings.patch file:

     patches/build/build.scc:
        patch arm-serialize-build-targets.patch
        patch powerpc-serialize-image-targets.patch
        patch kbuild-exclude-meta-directory-from-distclean-processi.patch

        # applied by kgit
        # patch kbuild-add-meta-files-to-the-ignore-li.patch

        patch modpost-mask-trivial-warnings.patch
        patch menuconfig-check-lxdiaglog.sh-Allow-specification-of.patch

     patches/build/modpost-mask-trivial-warnings.patch:
        From bd48931bc142bdd104668f3a062a1f22600aae61 Mon Sep 17 00:00:00 2001
        From: Paul Gortmaker <paul.gortmaker@windriver.com>
        Date: Sun, 25 Jan 2009 17:58:09 -0500
        Subject: [PATCH] modpost: mask trivial warnings

        Newer HOSTCC will complain about various stdio fcns because
                          .
                          .
                          .
 	        char *dump_write = NULL, *files_source = NULL;
 	        int opt;
        --
        2.10.1

        generated by cgit v0.10.2 at 2017-09-28 15:23:23 (GMT)
            

The description file can include multiple patch statements where each statement handles a single patch. In the example build.scc file, five patch statements exist for the five patches in the directory.

You can create a typical .patch file using diff -Nurp or git format-patch commands. For information on how to create patches, see the "Using devtool to Patch the Kernel" and "Using Traditional Kernel Development to Patch the Kernel" sections.