FUN WITH LINUX

Git: Using Git for building the Linux-Kernel from sources

19 January 2016

Git was invented by Linus Thorvalds for managing the Linux-kernel-sources. So it’s pretty clear that it is the best tool for managing our own kernel-builds too. I love to use Docker. That’s why I also need the AUFS-Support which is not included in the Linux-Tree. Git can also help us to easily include external kernel-patches. In this article I will clone the linux tree and create an own branch with my prefered kernel-version(and my customized kernel-config). I will pull the AUFS-Patches directly into this branch and compile this kernel afterwards.

Cloning the Linux-Kernel:

git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

List all Tags:

git tag 
... 
... 
v4.3 
v4.3-rc1 
v4.3-rc2 
v4.3-rc3 
v4.3-rc4 
v4.3-rc5 
v4.3-rc6 
v4.3-rc7 
v4.4 
v4.4-rc1 
v4.4-rc2 
v4.4-rc3 
v4.4-rc4 
v4.4-rc5 
v4.4-rc6 
v4.4-rc7 
v4.4-rc8 

Add AUFS-Remote:

git remote add aufs4 git://github.com/sfjro/aufs4-linux.git

Fetch AUFS:

git fetch aufs4

Create a new branch with kernel v4.4:

git checkout -b own4.4 v4.4

Pull AUFS into our new branch:

git pull aufs4 aufs4.4 

Configure the kernel:

make menuconfig 

Compile the kernel(using 8 cpu-cores) and create a Debian-package

make-kpkg -j 8 --initrd kernel_image modules modules_image kernel_headers 
[ Linux  Sysadmin  git  Kernel  ]
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution 3.0 Unported License.

Copyright 2015-present Hoti