Coder Social home page Coder Social logo

linux-patches's Introduction

Some patches to GNU/Linux kernel

Here are some patches to GNU/Linux which aims to:

  • Fix some bugs in the kernel.
  • Make it possible to compile the kernel with many compiler warnings flags, because several compiler warnings are useful but can't be used in vanilla kernel code because of "false-positives". The compiler-flag configuration is in make_allmodconfig.sh script.
  • Enable using clang to compile the kernel, which reports different warnings from gcc, by using LLVMLinux patches (http://llvm.linuxfoundation.org/index.php/Main_Page). NB: according to ClangBuiltLinux/linux#219 LLVMLinux seems to be now deprecated. A list of issues of building Linux with clang is available at https://github.com/ClangBuiltLinux/linux/issues.

How to build a kernel with these patches?

Short answer, in a terminal:

./apply_patches.sh && ./make_allmodconfig.sh "-j$(nproc)"

This command line will clone GNU/Linux git repository, apply patches and build a kernel with clang using a parallel build.

In order to explain what each script does, here is a workflow when updating the patches with a more recent version of GNU/Linux:

  • ./apply_patches.sh : clone GNU/Linux git repository in linux/ and apply patches from patches/ directory

  • cd linux && git fetch origin && git rebase origin/master : update GNU/Linux to latest master branch and rebase the patches on top of it

  • JOBS="$(nproc)" ./test_make_gcc_clang.sh : compile the GNU/Linux once with gcc, then with clang, and if both succeed, record the output in a file named make.log_clang_YYY-MM-DD (with the current date).

    • If there were errors during the build, fix them in new patches and build again

    • It is possible to use make_allmodconfig.sh script to make debugging some issues easier. All parameters given to this script are transmitted to the underlying make command:

      # Build files in kernel/ directory using gcc
      HOSTCC=gcc CC=gcc ./make_allmodconfig.sh kernel/
      
      # Build init/main.o using clang (which is the default compiler)
      HOSTCC=clang CC=clang ./make_allmodconfig.sh init/main.o
      
  • ./export_patches.sh : export the patches back to patches/ directory, using reorganize_patches.py to organize them in sub-directories.

How are the patches organized?

All the patches lies in subdirectories inside patches/:

  • patches/bug/ patches fix some bugs which make the compiling fail.
  • patches/constify/ patches add const keyword in some places.
  • patches/frama-c/ patches modify the kernel so that Frama-C can be used.
  • patches/llvmlinux/ patches are related to clang compatibility (c.f. http://llvm.linuxfoundation.org/ ).
  • patches/maybe_upstreamable/ patches have a very low priority of being sent upstream.
  • patches/not_upstreamble/ patches have no chance to go upstream (they do not comply with coding rules, introduce dirty code, etc.).
  • patches/plugin/ patches implement some GCC plugins to analyze the code at compile time.
  • patches/pragma/ patches introduce #pragma statement, mostly to ignore warnings when it is expected.
  • patches/printf/ patches add __printf attribute to printf-like functions so that potential format string vulnerabilities are detected at build time.
  • patches/rejected/ patches were rejected (sometimes silently) by kernel developers.
  • patches/sent-upstream/ patches have already been sent upstream even though they were not yet applied.
  • patches/typo/ patches fix typos which are sprinkled all around in the kernel.

Moreover there are two important files to apply the patches:

  • patches/series define the order used to apply the patches
  • patches/upstream-commit.hash contains the GNU/Linux commit ID which is used as the base to apply the patches on.

Upstreamed patches

Patches are occasionally sent upstream. Here are some which got successfully applied:

Other upstreamed patches can be found using for example https://github.com/torvalds/linux/commits/master?author=fishilico

linux-patches's People

Contributors

fishilico avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.