Build your own kernel under Ubuntu using mainline (latest) kernel

Here we will show how to build your own kernel under Ubuntu 16/17/18. We are going to use

mainline kernel

because most of the cases when we need to build our own is when we need some new feature presented in the new kernels. So Ubuntu mainline kernels are selected new kernels, which are packed in deb packets for simplicity and can be used to test new features, but they are not supported by Ubuntu teams and you should test them really carefully if you want to use them in production!
The mainline kernels are here: http://kernel.ubuntu.com/~kernel-ppa/mainline/. This is the main address, where you could download the latest kernels and some other legacy one if you have old system.
This howto is based on https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel and https://wiki.ubuntu.com/Kernel/MainlineBuilds – we summarize the commands needed to build your new and latest kernel and show you some typical mistakes and problems during the process.
To show you more information our purpose will be to build the one of the latest kernels with low latency features enabled (Ubuntu has such type of kernel configuration)! And here is one of the most important dependency, which is not explicitly included or even mentioned in most of the tutorials for building your own kernels –

you MUST include new or even latest Linux firmware package

All Linux distros have a package or packages containing files with different firmware for multiple devices supported by the kernel modules. Basically firmware is used by a kernel module and it can be a micro code (program), which is uploaded in the device or just complete the kernel module to function properly with a device. Recent days firmware is like a black box the manufacturer of the devices pack a proprietary code in a firmware blob and the source code is unknown to the community.

The first thing you should do is to choose the kernel version you want to build. We want version 4.17.x as more stable of the latest 4.18, which was released a few days weeks ago (let’s wait for a month after the initial release before using it!).
So the main address is here http://kernel.ubuntu.com/~kernel-ppa/mainline/ and the kernel files, which we are going to use to rebuild are here http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.17.19/

There are couple of files.
First are the patch files. You must use these files to patch the kernel source code files. You must download these files.

[PARENTDIR]	Parent Directory	 	- 	 
[TXT]	0001-base-packaging.patch	2018-08-24 13:21 	16M	 
[TXT]	0002-UBUNTU-SAUCE-add-vmlinux.strip-to-BOOT_TARGETS1-on-p.patch	2018-08-24 13:21 	902 	 
[TXT]	0003-UBUNTU-SAUCE-tools-hv-lsvmbus-add-manual-page.patch	2018-08-24 13:21 	1.3K	 
[TXT]	0004-UBUNTU-SAUCE-no-up-disable-pie-when-gcc-has-it-enabl.patch	2018-08-24 13:21 	2.1K	 
[TXT]	0005-debian-changelog.patch	2018-08-24 13:21 	210K	 
[TXT]	0006-configs-based-on-Ubuntu-4.17.0-10.11.patch	2018-08-24 13:21 	22K	 

Text files for build information and checksums of the files.

[ ]	BUILD.LOG	2018-08-24 16:46 	19M	 
[ ]	BUILD.LOG.amd64	2018-08-24 16:46 	3.2M	 
[ ]	BUILD.LOG.arm64	2018-08-24 16:46 	4.5M	 
[ ]	BUILD.LOG.armhf	2018-08-24 16:46 	4.1M	 
[ ]	BUILD.LOG.binary-headers	2018-08-24 16:46 	12K	 
[ ]	BUILD.LOG.i386	2018-08-24 16:46 	4.1M	 
[ ]	BUILD.LOG.ppc64el	2018-08-24 16:46 	1.5M	 
[ ]	BUILD.LOG.s390x	2018-08-24 16:46 	1.2M	 
[ ]	BUILT	2018-08-24 16:46 	232 	 
[ ]	CHANGES	2018-08-24 13:19 	23K	 
[ ]	CHECKSUMS	2018-08-24 16:46 	8.5K	 
[ ]	CHECKSUMS.gpg	2018-08-24 16:47 	473 	 
[ ]	COMMIT	2018-08-24 16:46 	50 	 
[TXT]	HEADER.html	2018-08-24 16:46 	7.7K	 
[ ]	README	2018-08-24 16:46 	3.7K	 
[ ]	REBUILD	2018-08-24 16:46 	34 	 
[ ]	SOURCES	2018-08-24 16:46 	422 	 

In file “SOURCES” you will see the source for the kernel source (a git repository and the ID of the last patch of the branch you want to use) and the patches you must apply to it:

git://git.launchpad.net/~ubuntu-kernel-test/ubuntu/+source/linux/+git/mainline-crack v4.17.19 62134e7b2b7993aff369a2f64f5b39634ac7f7c9
0001-base-packaging.patch
0002-UBUNTU-SAUCE-add-vmlinux.strip-to-BOOT_TARGETS1-on-p.patch
0003-UBUNTU-SAUCE-tools-hv-lsvmbus-add-manual-page.patch
0004-UBUNTU-SAUCE-no-up-disable-pie-when-gcc-has-it-enabl.patch
0005-debian-changelog.patch
0006-configs-based-on-Ubuntu-4.17.0-10.11.patch

You can download the deb files and install the kernel 4.17.19 from them if you do not want any changes in it – you can follow our other howto – How to install the latest linux kernel (mainline) in Ubuntu (17.10) distro It is for Ubuntu 17, but the steps are identical for Ubuntu 16 and 18 (and probably for future releases).

[ ]	linux-headers-4.17.19-041719-generic-lpae_4.17.19-041719.201808240919_armhf.deb	2018-08-24 14:25 	738K	 
[ ]	linux-headers-4.17.19-041719-generic_4.17.19-041719.201808240919_amd64.deb	2018-08-24 13:40 	1.1M	 
[ ]	linux-headers-4.17.19-041719-generic_4.17.19-041719.201808240919_arm64.deb	2018-08-24 14:54 	724K	 
[ ]	linux-headers-4.17.19-041719-generic_4.17.19-041719.201808240919_armhf.deb	2018-08-24 14:22 	744K	 
[ ]	linux-headers-4.17.19-041719-generic_4.17.19-041719.201808240919_i386.deb	2018-08-24 14:01 	667K	 
[ ]	linux-headers-4.17.19-041719-generic_4.17.19-041719.201808240919_s390x.deb	2018-08-24 16:46 	379K	 
[ ]	linux-headers-4.17.19-041719-lowlatency_4.17.19-041719.201808240919_amd64.deb	2018-08-24 13:43 	1.1M	 
[ ]	linux-headers-4.17.19-041719-lowlatency_4.17.19-041719.201808240919_i386.deb	2018-08-24 14:04 	667K	 
[ ]	linux-headers-4.17.19-041719-snapdragon_4.17.19-041719.201808240919_arm64.deb	2018-08-24 14:57 	723K	 
[ ]	linux-headers-4.17.19-041719_4.17.19-041719.201808240919_all.deb	2018-08-24 13:22 	9.7M	 
[ ]	linux-image-4.17.19-041719-generic-lpae_4.17.19-041719.201808240919_armhf.deb	2018-08-24 14:24 	7.8M	 
[ ]	linux-image-4.17.19-041719-generic_4.17.19-041719.201808240919_arm64.deb	2018-08-24 14:53 	8.7M	 
[ ]	linux-image-4.17.19-041719-generic_4.17.19-041719.201808240919_armhf.deb	2018-08-24 14:22 	7.9M	 
[ ]	linux-image-4.17.19-041719-generic_4.17.19-041719.201808240919_i386.deb	2018-08-24 14:01 	7.1M	 
[ ]	linux-image-4.17.19-041719-generic_4.17.19-041719.201808240919_s390x.deb	2018-08-24 16:46 	3.9M	 
[ ]	linux-image-4.17.19-041719-lowlatency_4.17.19-041719.201808240919_i386.deb	2018-08-24 14:03 	7.2M	 
[ ]	linux-image-4.17.19-041719-snapdragon_4.17.19-041719.201808240919_arm64.deb	2018-08-24 14:56 	7.0M	 
[ ]	linux-image-unsigned-4.17.19-041719-generic_4.17.19-041719.201808240919_amd64.deb	2018-08-24 13:40 	7.7M	 
[ ]	linux-image-unsigned-4.17.19-041719-lowlatency_4.17.19-041719.201808240919_amd64.deb	2018-08-24 13:42 	7.8M	 
[ ]	linux-modules-4.17.19-041719-generic-lpae_4.17.19-041719.201808240919_armhf.deb	2018-08-24 14:25 	41M	 
[ ]	linux-modules-4.17.19-041719-generic_4.17.19-041719.201808240919_amd64.deb	2018-08-24 13:40 	44M	 
[ ]	linux-modules-4.17.19-041719-generic_4.17.19-041719.201808240919_arm64.deb	2018-08-24 14:54 	44M	 
[ ]	linux-modules-4.17.19-041719-generic_4.17.19-041719.201808240919_armhf.deb	2018-08-24 14:22 	42M	 
[ ]	linux-modules-4.17.19-041719-generic_4.17.19-041719.201808240919_i386.deb	2018-08-24 14:01 	42M	 
[ ]	linux-modules-4.17.19-041719-generic_4.17.19-041719.201808240919_s390x.deb	2018-08-24 16:46 	8.9M	 
[ ]	linux-modules-4.17.19-041719-lowlatency_4.17.19-041719.201808240919_amd64.deb	2018-08-24 13:42 	44M	 
[ ]	linux-modules-4.17.19-041719-lowlatency_4.17.19-041719.201808240919_i386.deb	2018-08-24 14:04 	42M	 
[ ]	linux-modules-4.17.19-041719-snapdragon_4.17.19-041719.201808240919_arm64.deb	2018-08-24 14:56 	43M	 

So here are the steps to build your own kernel with Ubuntu 16/17/18:

STEP 1) Clone the source code of the kernel 4.17.19

It’ll put the sources in directory v4.17.19. Then you must change the branch to version 4.17.19 (if you are not familiar with git, then just follow the commands below). As you can see the git url is taken from the named “SOURCES” in sub-directory URL for the kernel we’ve chosen http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.17.19/

root@srv:/root/tests/kernel# git clone git://git.launchpad.net/~ubuntu-kernel-test/ubuntu/+source/linux/+git/mainline-crack v4.17.19
Cloning into 'v4.17.19'...
remote: Counting objects: 7401126, done.
remote: Compressing objects: 100% (1380661/1380661), done.
Receiving objects: 100% (7401126/7401126), 1.67 GiB | 20.61 MiB/s, done.
remote: Total 7401126 (delta 6298473), reused 7068676 (delta 5973332)
Resolving deltas: 100% (6298473/6298473), done.
Checking connectivity... done.
Checking out files: 100% (61722/61722), done.
root@srv:/root/tests/kernel# cd v4.17.19
root@srv:/root/tests/kernel/v4.17.19# git checkout v4.17.19
Checking out files: 100% (11040/11040), done.
Note: checking out 'v4.17.19'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 62134e7... Linux 4.17.19
root@srv:/root/tests/kernel/v4.17.19# ls -altr
total 792
-rw-r--r--   1 root root   1498 Sep  3 08:15 .gitignore
-rw-r--r--   1 root root     30 Sep  3 08:15 .gitattributes
-rw-r--r--   1 root root     31 Sep  3 08:15 .get_maintainer.ignore
-rw-r--r--   1 root root    423 Sep  3 08:15 COPYING
-rw-r--r--   1 root root     59 Sep  3 08:15 .cocciconfig
-rw-r--r--   1 root root   2245 Sep  3 08:15 Kbuild
drwxr-xr-x   5 root root   4096 Sep  3 08:15 LICENSES
-rw-r--r--   1 root root    800 Sep  3 08:15 README
drwxr-xr-x   2 root root   4096 Sep  3 08:15 firmware
drwxr-xr-x  27 root root   4096 Sep  3 08:15 include
drwxr-xr-x  27 root root   4096 Sep  3 08:15 samples
drwxr-xr-x  26 root root   4096 Sep  3 08:15 sound
drwxr-xr-x  32 root root   4096 Sep  3 08:15 tools
drwxr-xr-x   4 root root   4096 Sep  3 08:15 virt
-rw-r--r--   1 root root   9559 Sep  3 08:32 .mailmap
-rw-r--r--   1 root root  13060 Sep  3 08:32 .clang-format
-rw-r--r--   1 root root  98651 Sep  3 08:32 CREDITS
drwxr-xr-x 119 root root  12288 Sep  3 08:32 Documentation
-rw-r--r--   1 root root    321 Sep  3 08:32 Kconfig
-rw-r--r--   1 root root 460274 Sep  3 08:32 MAINTAINERS
drwxr-xr-x  26 root root   4096 Sep  3 08:32 .
-rw-r--r--   1 root root  59564 Sep  3 08:32 Makefile
drwxr-xr-x  26 root root   4096 Sep  3 08:32 arch
drwxr-xr-x   2 root root   4096 Sep  3 08:32 certs
drwxr-xr-x   3 root root   4096 Sep  3 08:32 block
drwxr-xr-x 136 root root   4096 Sep  3 08:32 drivers
drwxr-xr-x   4 root root   4096 Sep  3 08:32 crypto
drwxr-xr-x  73 root root   4096 Sep  3 08:32 fs
drwxr-xr-x   2 root root   4096 Sep  3 08:32 init
drwxr-xr-x   2 root root   4096 Sep  3 08:32 ipc
drwxr-xr-x  18 root root   4096 Sep  3 08:32 kernel
drwxr-xr-x  13 root root  12288 Sep  3 08:32 lib
drwxr-xr-x   3 root root   4096 Sep  3 08:32 mm
drwxr-xr-x  70 root root   4096 Sep  3 08:32 net
drwxr-xr-x  14 root root   4096 Sep  3 08:32 scripts
drwxr-xr-x  10 root root   4096 Sep  3 08:32 security
drwxr-xr-x   2 root root   4096 Sep  3 08:32 usr
drwxr-xr-x   8 root root   4096 Sep  3 08:32 .git
drwxr-xr-x   3 root root   4096 Sep  3 08:38 ..

After the last command now you have the sources for kernel version 4.17.19 and in the next step will apply all the Ubuntu patches (which also help us to build the kernel as Ubuntu way).
Be careful the unpacked kernel sources consume around 2.8G and you’ll need around 35-40G to compile all the needed packets for our goal. You could just copy the the directory v4.17.19 to somewhere else to have a backup and if you need to start from the beginning no need to wait for the downloading of the sources again.

STEP 2) Download all the Ubuntu patches listed in file SOURCES (you could see them here, too) and apply them to the kernel source of 4.17.19

root@srv:/root/tests/kernel/v4.17.19# cd ..
root@srv:/root/tests/kernel# wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.17.19/0001-base-packaging.patch
root@srv:/root/tests/kernel# wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.17.19/0002-UBUNTU-SAUCE-add-vmlinux.strip-to-BOOT_TARGETS1-on-p.patch
root@srv:/root/tests/kernel# wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.17.19/0003-UBUNTU-SAUCE-tools-hv-lsvmbus-add-manual-page.patch
root@srv:/root/tests/kernel# wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.17.19/0004-UBUNTU-SAUCE-no-up-disable-pie-when-gcc-has-it-enabl.patch
root@srv:/root/tests/kernel# wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.17.19/0005-debian-changelog.patch
root@srv:/root/tests/kernel# wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.17.19/0006-configs-based-on-Ubuntu-4.17.0-10.11.patch
root@srv:/root/tests/kernel/v4.17.19# cd v4.17.19/
root@srv:/root/tests/kernel/v4.17.19# git am ../????-*
Applying: base packaging
.git/rebase-apply/patch:293344: trailing whitespace.
The sources may be found at most Linux ftp sites, including 
.git/rebase-apply/patch:296836: trailing whitespace.
flavours        = 
.git/rebase-apply/patch:296866: trailing whitespace.
# fashion. 
.git/rebase-apply/patch:296893: trailing whitespace.
                if grep -q -e $1\.\*dhcp $IF_FILE; then 
.git/rebase-apply/patch:297269: trailing whitespace.
UBUNTU: 
warning: squelched 23 whitespace errors
warning: 28 lines add whitespace errors.
Applying: UBUNTU: SAUCE: add vmlinux.strip to BOOT_TARGETS1 on powerpc
Applying: UBUNTU: SAUCE: tools/hv/lsvmbus -- add manual page
Applying: UBUNTU: SAUCE: (no-up) disable -pie when gcc has it enabled by default
Applying: debian changelog
Applying: configs (based on Ubuntu-4.17.0-10.11)

STEP 3) Build the low latency kernel type from kernel source of 4.17.19

In fact we are going to build all kind of kernels and dependency packages for them like linux-tools, for example, which you do not have if you just use the deb packets from mainline. There are two external dependency libraries SPL and ZFS – you must download them and put them in the sub-directory to the main v4.17.19 – SPL in v4.17.19/spl and v4.17.19/zfs – if you fail to do this the build process will fail. Be careful SPL library is scheduled to merge into ZFS, so things could change slightly.

root@1c1-30-d5556-190:/root/tests/kernel# cd v4.17.19
root@1c1-30-d5556-190:/root/tests/kernel/v4.17.19# git clone -b spl-0.7-release --single-branch https://github.com/zfsonlinux/spl.git
Cloning into 'spl'...
remote: Counting objects: 8641, done.
remote: Compressing objects: 100% (46/46), done.
remote: Total 8641 (delta 0), reused 46 (delta 0), pack-reused 8595
Receiving objects: 100% (8641/8641), 3.50 MiB | 0 bytes/s, done.
Resolving deltas: 100% (6038/6038), done.
Checking connectivity... done.
root@srv:/root/tests/kernel/v4.17.19# ls -altr spl/
total 104
-rw-r--r--  1 root root   748 Sep  3 18:59 .gitignore
-rw-r--r--  1 root root   859 Sep  3 18:59 AUTHORS
-rw-r--r--  1 root root  1377 Sep  3 18:59 README.markdown
-rw-r--r--  1 root root   158 Sep  3 18:59 META
-rw-r--r--  1 root root  1522 Sep  3 18:59 Makefile.am
-rw-r--r--  1 root root  1376 Sep  3 18:59 DISCLAIMER
-rw-r--r--  1 root root 18092 Sep  3 18:59 COPYING
drwxr-xr-x  4 root root  4096 Sep  3 18:59 cmd
-rwxr-xr-x  1 root root    49 Sep  3 18:59 autogen.sh
-rwxr-xr-x  1 root root  2608 Sep  3 18:59 copy-builtin
-rw-r--r--  1 root root  2613 Sep  3 18:59 configure.ac
drwxr-xr-x  2 root root  4096 Sep  3 18:59 config
drwxr-xr-x  4 root root  4096 Sep  3 18:59 man
drwxr-xr-x  2 root root  4096 Sep  3 18:59 lib
drwxr-xr-x  9 root root  4096 Sep  3 18:59 include
drwxr-xr-x  4 root root  4096 Sep  3 18:59 module
drwxr-xr-x  2 root root  4096 Sep  3 18:59 scripts
drwxr-xr-x  4 root root  4096 Sep  3 18:59 rpm
-rw-r--r--  1 root root    38 Sep  3 18:59 spl.release.in
drwxr-xr-x  8 root root  4096 Sep  3 18:59 .git
drwxr-xr-x 11 root root  4096 Sep  3 18:59 .
drwxr-xr-x 30 root root  4096 Sep  3 19:00 ..
root@srv:/root/tests/kernel/v4.17.19# git clone https://github.com/zfsonlinux/zfs
Cloning into 'zfs'...
remote: Counting objects: 119599, done.
remote: Compressing objects: 100% (34/34), done.
remote: Total 119599 (delta 15), reused 14 (delta 9), pack-reused 119556
Receiving objects: 100% (119599/119599), 46.37 MiB | 28.60 MiB/s, done.
Resolving deltas: 100% (85640/85640), done.
Checking connectivity... done.
root@srv:/root/tests/kernel/v4.17.19# chmod a+x debian/rules
root@srv:/root/tests/kernel/v4.17.19# chmod a+x debian/scripts/*
root@srv:/root/tests/kernel/v4.17.19# chmod a+x debian/scripts/misc/*
root@srv:/root/tests/kernel/v4.17.19# fakeroot debian/rules clean
for i in debian.master/control.stub.in; do                                      \
  new=`echo $i | sed 's/\.in$//'`;                                      \
  cat $i | sed -e 's/PKGVER/4.17.19/g'                              \
        -e 's/ABINUM/041719/g'                                       \
        -e 's/SRCPKGNAME/linux/g'                             \
        -e 's/=HUMAN=/64 bit x86/g'                                    \
  > $new;                                                               \
done
flavours="debian.master/control.d/vars.generic debian.master/control.d/vars.generic-lpae debian.master/control.d/vars.lowlatency debian.master/control.d/vars.snapdragon";\
for i in $flavours; do                                                  \
  /bin/bash -e debian/scripts/control-create $i "true" |        \
        sed -e 's/PKGVER/4.17.19/g'                                  \
        -e 's/ABINUM/041719/g'                                       \
        -e 's/SRCPKGNAME/linux/g'                             \
        -e 's/=HUMAN=/64 bit x86/g'                                    \
        >> debian.master/control.stub;                                          \
done
echo "# placebo control.stub for kernel-wedge flow change" >debian/control.stub
cp debian.master/control.stub debian/control
export KW_DEFCONFIG_DIR=debian.master/d-i && \
export KW_CONFIG_DIR=debian.master/d-i && \
LANG=C kernel-wedge gen-control 4.17.19-041719 | \
        perl -f debian/scripts/misc/kernel-wedge-arch.pl amd64 \
        >>/root/tests/kernel/v4.17.19/debian/control
dh_testdir
dh_testroot
dh_clean
# d-i stuff
rm -rf debian.master/d-i-amd64
# Generated on the fly.
rm -f debian.master/d-i/firmware/amd64/kernel-image
# normal build junk
rm -rf debian.master/abi/4.17.19-041719.201808240919
rm -rf /root/tests/kernel/v4.17.19/debian/build
rm -f /root/tests/kernel/v4.17.19/debian/stamps/stamp-*
rm -rf debian.master/linux-*
# This gets rid of the d-i packages in control
cp -f debian.master/control.stub debian/control
cp debian.master/changelog debian/changelog
# Install the copyright information.
cp debian.master/copyright debian/copyright
# Install the retpoline extractor.
cp debian/scripts/retpoline-extract-one scripts/ubuntu-retpoline-extract-one
# If we have a reconstruct script use it.
[ -f debian.master/reconstruct ] && bash debian.master/reconstruct
# Remove generated intermediate files
rm -f debian/control.stub debian.master/control.stub

You could download the SPL/ZFS compressed files (here we use git to get the sources)

STEP 4*) Make changes to the configuration of the kernel sources.

This step could be skipped f you do not need any changes in the kernel config, but if you do, you should go through it.

root@srv:/root/tests/kernel/v4.17.19# fakeroot debian/rules editconfigs
dh_testdir;
/bin/bash -e debian/scripts/misc/kernelconfig editconfigs
Do you want to edit config: amd64/config.flavour.generic? [Y/n] Y
make[1]: Entering directory '/root/tests/kernel/v4.17.19'
make[2]: Entering directory '/root/tests/kernel/v4.17.19/build'
  HOSTCC  scripts/basic/fixdep
  GEN     ./Makefile
../scripts/kconfig/mconf-cfg.sh: line 7: pkg-config: command not found
../scripts/kconfig/mconf-cfg.sh: line 13: pkg-config: command not found
  UPD     scripts/kconfig/.mconf-cfg
  HOSTCC  scripts/kconfig/mconf.o
  YACC    scripts/kconfig/zconf.tab.c
  LEX     scripts/kconfig/zconf.lex.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTCC  scripts/kconfig/lxdialog/checklist.o
  HOSTCC  scripts/kconfig/lxdialog/inputbox.o
  HOSTCC  scripts/kconfig/lxdialog/menubox.o
  HOSTCC  scripts/kconfig/lxdialog/textbox.o
  HOSTCC  scripts/kconfig/lxdialog/util.o
  HOSTCC  scripts/kconfig/lxdialog/yesno.o
  HOSTLD  scripts/kconfig/mconf
scripts/kconfig/mconf  Kconfig
.config:5052:warning: override: M686 changes choice state
.config:10784:warning: override: reassigning to symbol 104_QUAD_8
.config:10785:warning: override: reassigning to symbol 60XX_WDT
.config:10786:warning: override: reassigning to symbol 64BIT
.config:10788:warning: override: reassigning to symbol 6LOWPAN_DEBUGFS
.config:10789:warning: override: reassigning to symbol 6LOWPAN_GHC_EXT_HDR_DEST
.config:10790:warning: override: reassigning to symbol 6LOWPAN_GHC_EXT_HDR_FRAG
.config:10791:warning: override: reassigning to symbol 6LOWPAN_GHC_EXT_HDR_HOP
.config:10792:warning: override: reassigning to symbol 6LOWPAN_GHC_EXT_HDR_ROUTE
.config:10793:warning: override: reassigning to symbol 6LOWPAN_GHC_ICMPV6
.config:10794:warning: override: reassigning to symbol 6LOWPAN_GHC_UDP
.config:10795:warning: override: reassigning to symbol 6LOWPAN_NHC
.config:10796:warning: override: reassigning to symbol 6LOWPAN_NHC_DEST
.config:10797:warning: override: reassigning to symbol 6LOWPAN_NHC_FRAGMENT
.config:10798:warning: override: reassigning to symbol 6LOWPAN_NHC_HOP
.config:10799:warning: override: reassigning to symbol 6LOWPAN_NHC_IPV6

STEP 5) Build the kernel sources

Multiple deb packages will be generated a directory above the kernel sources v4.17.19.

root@srv:/root/tests/kernel/v4.17.19# fakeroot debian/rules binary
Debug: install-headers
dh_testdir
dh_testroot
dh_prep
install -d /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719
find . -path './debian' -prune -o -path './debian.master' -prune \
  -o -path './include/*' -prune \
  -o -path './scripts/*' -prune -o -type f \
  \( -name 'Makefile*' -o -name 'Kconfig*' -o -name 'Kbuild*' -o \
     -name '*.sh' -o -name '*.pl' -o -name '*.lds' \) \
  -print | cpio -pd --preserve-modification-time /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719
16290 blocks
cp -a scripts include /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719
(find arch -name include -type d -print | \
        xargs -n1 -i: find : -type f) | \
        cpio -pd --preserve-modification-time /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/openrisc/include/uapi/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/openrisc/include/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/arm64/include/uapi/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/arm64/include/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/m68k/include/uapi/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/m68k/include/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/nios2/include/uapi/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/nios2/include/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/mips/include/uapi/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/mips/include/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/ia64/include/uapi/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/ia64/include/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/nds32/include/uapi/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/nds32/include/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/alpha/include/uapi/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/alpha/include/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/riscv/include/uapi/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/riscv/include/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/um/include/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/parisc/include/uapi/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/parisc/include/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/x86/include/uapi/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/x86/include/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/microblaze/include/uapi/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/microblaze/include/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/sparc/include/uapi/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/sparc/include/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/s390/include/uapi/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/s390/include/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/c6x/include/uapi/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/c6x/include/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/powerpc/include/uapi/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/powerpc/include/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/sh/include/uapi/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/sh/include/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/unicore32/include/uapi/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/unicore32/include/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/xtensa/include/uapi/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/xtensa/include/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/arc/include/uapi/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/arc/include/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/arm/include/uapi/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/arm/include/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/hexagon/include/uapi/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/hexagon/include/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/h8300/include/uapi/asm/Kbuild not created: newer or same age version exists
cpio: /root/tests/kernel/v4.17.19/debian/linux-headers-4.17.19-041719/usr/src/linux-headers-4.17.19-041719/arch/h8300/include/asm/Kbuild not created: newer or same age version exists
33186 blocks
Debug: install-doc
dh_testdir
dh_testroot
install -d /root/tests/kernel/v4.17.19/debian/linux-doc/usr/share/doc/linux-doc
# Copy the rest
cp -a Documentation/* /root/tests/kernel/v4.17.19/debian/linux-doc/usr/share/doc/linux-doc
find /root/tests/kernel/v4.17.19/debian/linux-doc/usr/share/doc/linux-doc -name .gitignore | xargs rm -f
Debug: install-source
install -d /root/tests/kernel/v4.17.19/debian/linux-source-4.17.19/usr/src/linux-source-4.17.19
Debug: /root/tests/kernel/v4.17.19/debian/stamps/stamp-prepare-perarch
rm -rf /root/tests/kernel/v4.17.19/debian/build/tools-perarch
install -d /root/tests/kernel/v4.17.19/debian/build/tools-perarch
rsync -a --exclude debian --exclude debian.master --exclude debian.master --exclude .git -a ./ /root/tests/kernel/v4.17.19/debian/build/tools-perarch/
touch /root/tests/kernel/v4.17.19/debian/stamps/stamp-prepare-perarch
Debug: install-arch-headers
dh_testdir
dh_testroot
dh_prep -plinux-libc-dev
rm -rf /root/tests/kernel/v4.17.19/debian/tmp-headers
install -d /root/tests/kernel/v4.17.19/debian/tmp-headers /root/tests/kernel/v4.17.19/debian/linux-libc-dev/usr/include/
/usr/bin/make -C /root/tests/kernel/v4.17.19 O=/root/tests/kernel/v4.17.19/debian/tmp-headers KERNELVERSION=4.17.19-041719 INSTALL_HDR_PATH=/root/tests/kernel/v4.17.19/debian/tmp-headers/install SHELL="/bin/bash -e" ARCH=x86 defconfig
make[1]: Entering directory '/root/tests/kernel/v4.17.19'
make[2]: Entering directory '/root/tests/kernel/v4.17.19/debian/tmp-headers'
  HOSTCC  scripts/basic/fixdep
  GEN     ./Makefile
  HOSTCC  scripts/kconfig/conf.o
  YACC    scripts/kconfig/zconf.tab.c
  LEX     scripts/kconfig/zconf.lex.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
*** Default configuration is based on 'x86_64_defconfig'
#
# configuration written to .config
#
make[2]: Leaving directory '/root/tests/kernel/v4.17.19/debian/tmp-headers'
make[1]: Leaving directory '/root/tests/kernel/v4.17.19'
mv /root/tests/kernel/v4.17.19/debian/tmp-headers/.config /root/tests/kernel/v4.17.19/debian/tmp-headers/.config.old
sed -e 's/^# \(CONFIG_MODVERSIONS\) is not set$/\1=y/' \
  -e 's/.*CONFIG_LOCALVERSION_AUTO.*/# CONFIG_LOCALVERSION_AUTO is not set/' \
  /root/tests/kernel/v4.17.19/debian/tmp-headers/.config.old > /root/tests/kernel/v4.17.19/debian/tmp-headers/.config
/usr/bin/make -C /root/tests/kernel/v4.17.19 O=/root/tests/kernel/v4.17.19/debian/tmp-headers KERNELVERSION=4.17.19-041719 INSTALL_HDR_PATH=/root/tests/kernel/v4.17.19/debian/tmp-headers/install SHELL="/bin/bash -e" ARCH=x86 syncconfig
make[1]: Entering directory '/root/tests/kernel/v4.17.19'
make[2]: Entering directory '/root/tests/kernel/v4.17.19/debian/tmp-headers'
  GEN     ./Makefile
scripts/kconfig/conf  --syncconfig Kconfig
make[2]: Leaving directory '/root/tests/kernel/v4.17.19/debian/tmp-headers'
make[1]: Leaving directory '/root/tests/kernel/v4.17.19'
/usr/bin/make -C /root/tests/kernel/v4.17.19 O=/root/tests/kernel/v4.17.19/debian/tmp-headers KERNELVERSION=4.17.19-041719 INSTALL_HDR_PATH=/root/tests/kernel/v4.17.19/debian/tmp-headers/install SHELL="/bin/bash -e" ARCH=x86 headers_install
make[1]: Entering directory '/root/tests/kernel/v4.17.19'
make[2]: Entering directory '/root/tests/kernel/v4.17.19/debian/tmp-headers'
  CHK     include/generated/uapi/linux/version.h
  UPD     include/generated/uapi/linux/version.h
  WRAP    arch/x86/include/generated/uapi/asm/bpf_perf_event.h
  WRAP    arch/x86/include/generated/uapi/asm/poll.h
  SYSTBL  arch/x86/include/generated/asm/syscalls_32.h
  SYSHDR  arch/x86/include/generated/asm/unistd_32_ia32.h
  SYSHDR  arch/x86/include/generated/asm/unistd_64_x32.h
  SYSTBL  arch/x86/include/generated/asm/syscalls_64.h
  SYSHDR  arch/x86/include/generated/uapi/asm/unistd_32.h
  SYSHDR  arch/x86/include/generated/uapi/asm/unistd_64.h
  SYSHDR  arch/x86/include/generated/uapi/asm/unistd_x32.h
  HOSTCC  arch/x86/tools/relocs_32.o
  HOSTCC  arch/x86/tools/relocs_64.o
  HOSTCC  arch/x86/tools/relocs_common.o
  HOSTLD  arch/x86/tools/relocs
  HOSTCC  scripts/unifdef
  INSTALL include/asm-generic (37 files)
  INSTALL include/drm (25 files)
  INSTALL include/linux (496 files)
  INSTALL include/linux/android (1 file)
  INSTALL include/linux/byteorder (2 files)
  INSTALL include/linux/caif (2 files)
  INSTALL include/linux/can (6 files)
  INSTALL include/linux/cifs (1 file)
  INSTALL include/linux/dvb (8 files)
.....
.....
  AR      drivers/iio/common/st_sensors/built-in.a
  AR      net/ipv6/built-in.a
  CC [M]  drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.o
  CC [M]  net/vmw_vsock/af_vsock_tap.o
  CC [M]  drivers/iio/common/ssp_sensors/ssp_dev.o
  CC [M]  drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_cik.o
  CC [M]  drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_vi.o
  CC [M]  drivers/iio/common/st_sensors/st_sensors_i2c.o
  CC [M]  drivers/gpio/gpio-twl6040.o
  CC [M]  fs/reiserfs/xattr.o
  CC [M]  drivers/gpio/gpio-ucb1400.o
  CC      net/ipv4/cipso_ipv4.o
  CC      net/ipv4/xfrm4_policy.o
  AR      fs/proc/built-in.a
  CC      net/ipv4/xfrm4_state.o
  CC [M]  drivers/gpio/gpio-viperboard.o
  CC      net/ipv4/xfrm4_input.o
  CC [M]  drivers/i2c/busses/i2c-nforce2.o
  CC [M]  drivers/gpio/gpio-vx855.o
  CC [M]  drivers/gpio/gpio-wcove.o
  CC [M]  drivers/hwmon/adc128d818.o
  CC [M]  fs/ubifs/recovery.o
  CC [M]  fs/ubifs/ioctl.o
  CC [M]  net/sched/em_meta.o
  CC [M]  drivers/hid/hid-lenovo.o
  CC [M]  drivers/hid/hid-lg.o
  CC [M]  drivers/hid/hid-lgff.o
  CC [M]  drivers/hid/hid-lg2ff.o
  LD [M]  fs/udf/udf.o
  CC [M]  drivers/hid/hid-lg3ff.o
  CC [M]  drivers/iio/accel/mma7455_i2c.o
  CC [M]  drivers/iio/accel/mma7455_spi.o
  CC [M]  drivers/hwmon/adcxx.o
  CC [M]  drivers/hwmon/adm1021.o
  CC [M]  net/wimax/debugfs.o
  CC [M]  drivers/hwmon/adm1025.o
  CC [M]  drivers/hwmon/adm1026.o
  CC [M]  drivers/hwmon/adm1029.o
  CC [M]  drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.o
  CC [M]  drivers/iio/adc/ad799x.o
  CC [M]  drivers/iio/adc/axp20x_adc.o
  CC [M]  drivers/iio/adc/axp288_adc.o
  CC [M]  drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.o
  CC [M]  drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.o
  CC [M]  net/netfilter/nf_nat_ftp.o
  CC [M]  drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_cik.o
  CC [M]  drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_vi.o
  CC [M]  drivers/iio/common/ssp_sensors/ssp_spi.o
  CC [M]  drivers/gpu/drm/amd/amdkfd/kfd_interrupt.o
  CC [M]  drivers/iio/common/st_sensors/st_sensors_spi.o
  CC [M]  drivers/iio/common/st_sensors/st_sensors_core.o
  CC [M]  fs/reiserfs/lock.o
  CC [M]  net/vmw_vsock/vsock_addr.o
  CC [M]  fs/reiserfs/xattr_user.o
  CC [M]  net/netfilter/nf_nat_irc.o
  CC [M]  drivers/gpio/gpio-winbond.o
  CC [M]  net/netfilter/nf_nat_sip.o
  CC [M]  drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.o
  CC [M]  drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.o
  CC [M]  drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.o
  CC [M]  drivers/i2c/busses/i2c-nforce2-s4985.o
  CC [M]  net/netfilter/nf_nat_tftp.o
  CC [M]  net/vmw_vsock/diag.o
  CC [M]  drivers/hid/hid-lg4ff.o
  CC [M]  drivers/hid/hid-logitech-dj.o
  CC [M]  drivers/hid/hid-logitech-hidpp.o
  CC [M]  drivers/iio/accel/mma7660.o
  CC [M]  drivers/gpu/drm/amd/amdkfd/kfd_events.o
  CC [M]  drivers/gpu/drm/amd/amdkfd/cik_event_interrupt.o
  CC [M]  drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.o
  CC [M]  fs/ubifs/lpt_commit.o
  CC [M]  drivers/hwmon/adm1031.o
  CC [M]  fs/reiserfs/xattr_trusted.o
  CC [M]  fs/reiserfs/xattr_security.o
  CC [M]  fs/reiserfs/xattr_acl.o
  CC [M]  fs/ubifs/tnc_misc.o
  CC [M]  fs/ubifs/xattr.o
  CC [M]  fs/ubifs/debug.o
  CC [M]  drivers/iio/adc/cc10001_adc.o
  CC [M]  drivers/iio/adc/da9150-gpadc.o
  CC [M]  drivers/gpu/drm/amd/amdgpu/amdgpu_sync.o
  CC [M]  fs/ubifs/misc.o
  CC [M]  drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.o
  CC      net/ipv4/xfrm4_output.o
  CC [M]  drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.o
  CC [M]  drivers/gpu/drm/amd/amdgpu/amdgpu_virt.o
  LD [M]  net/wimax/wimax.o
  CC      net/ipv4/xfrm4_protocol.o
  CC [M]  drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.o
  CC [M]  net/sched/em_text.o
  CC [M]  net/sched/em_canid.o
  CC [M]  drivers/iio/common/ssp_sensors/ssp_iio.o
  CC [M]  net/sched/em_ipset.o
  CC [M]  net/sched/em_ipt.o
  CC [M]  drivers/i2c/busses/i2c-piix4.o
  CC [M]  drivers/iio/adc/dln2-adc.o
  CC [M]  drivers/hid/hid-magicmouse.o
  CC [M]  drivers/iio/common/st_sensors/st_sensors_buffer.o
  CC [M]  drivers/gpio/gpio-wm831x.o
  CC [M]  drivers/hid/hid-mf.o
  CC [M]  drivers/hid/hid-microsoft.o
  CC [M]  drivers/iio/common/st_sensors/st_sensors_trigger.o
  CC [M]  drivers/iio/accel/mma8452.o
  CC [M]  drivers/iio/accel/mma9551_core.o
  CC [M]  drivers/iio/adc/hi8435.o
......
......
dpkg-deb: building package 'vlan-modules-4.17.19-041719-generic-di' in 'debian/.debhelper/scratch-space/build-vlan-modules-4.17.19-041719-generic-di/vlan-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.deb'.
        Renaming vlan-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.deb to vlan-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
dpkg-deb: building package 'ipmi-modules-4.17.19-041719-generic-di' in 'debian/.debhelper/scratch-space/build-ipmi-modules-4.17.19-041719-generic-di/ipmi-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.deb'.
        Renaming ipmi-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.deb to ipmi-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
dpkg-deb: building package 'multipath-modules-4.17.19-041719-generic-di' in 'debian/.debhelper/scratch-space/build-multipath-modules-4.17.19-041719-generic-di/multipath-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.deb'.
        Renaming multipath-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.deb to multipath-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
# Generate the meta-udeb dependancy lists.
dpkg-deb: building package 'linux-udebs-generic' in 'debian/.debhelper/scratch-space/build-linux-udebs-generic/linux-udebs-generic_4.17.19-041719.201808240919_amd64.deb'.
        Renaming linux-udebs-generic_4.17.19-041719.201808240919_amd64.deb to linux-udebs-generic_4.17.19-041719.201808240919_amd64.udeb
Debug: binary-arch-headers
dh_testdir
dh_testroot
dh_installchangelogs -plinux-libc-dev
dh_installdocs -plinux-libc-dev
dh_compress -plinux-libc-dev
dh_fixperms -plinux-libc-dev
dh_installdeb -plinux-libc-dev
flock -w 60 /root/tests/kernel/v4.17.19/debian/.LOCK dh_gencontrol -plinux-libc-dev -- 
dh_md5sums -plinux-libc-dev
dh_builddeb -plinux-libc-dev
dpkg-deb: building package 'linux-libc-dev' in '../linux-libc-dev_4.17.19-041719.201808240919_amd64.deb'.
Debug: binary-arch
root@srv:/root/tests/kernel/v4.17.19#

As you can see no errors and everyhting was built successfully. Now all the debian packages are in “/root/tests/kernel”:

root@srv:/root/tests/kernel/v4.17.19# ls -altr ../
total 183180
-rw-r--r--  1 root root    22753 Aug 24 13:21 0006-configs-based-on-Ubuntu-4.17.0-10.11.patch
-rw-r--r--  1 root root   215214 Aug 24 13:21 0005-debian-changelog.patch
-rw-r--r--  1 root root     2111 Aug 24 13:21 0004-UBUNTU-SAUCE-no-up-disable-pie-when-gcc-has-it-enabl.patch
-rw-r--r--  1 root root     1377 Aug 24 13:21 0003-UBUNTU-SAUCE-tools-hv-lsvmbus-add-manual-page.patch
-rw-r--r--  1 root root      902 Aug 24 13:21 0002-UBUNTU-SAUCE-add-vmlinux.strip-to-BOOT_TARGETS1-on-p.patch
-rw-r--r--  1 root root 17160790 Aug 24 13:21 0001-base-packaging.patch
drwxr-xr-x  4 root root     4096 Sep  3 18:45 ..
-rw-r--r--  1 root root     2176 Sep  3 19:08 linux-source-4.17.19_4.17.19-041719.201808240919_all.deb
-rw-r--r--  1 root root  7907610 Sep  3 19:08 linux-doc_4.17.19-041719.201808240919_all.deb
-rw-r--r--  1 root root 10318098 Sep  3 19:09 linux-headers-4.17.19-041719_4.17.19-041719.201808240919_all.deb
-rw-r--r--  1 root root   125748 Sep  3 19:09 linux-tools-common_4.17.19-041719.201808240919_all.deb
-rw-r--r--  1 root root     8176 Sep  3 19:09 linux-cloud-tools-common_4.17.19-041719.201808240919_all.deb
-rw-r--r--  1 root root    16782 Sep  3 19:09 linux-tools-host_4.17.19-041719.201808240919_all.deb
-rw-r--r--  1 root root  1228872 Sep  3 19:09 linux-tools-4.17.19-041719_4.17.19-041719.201808240919_amd64.deb
-rw-r--r--  1 root root    15954 Sep  3 19:09 linux-cloud-tools-4.17.19-041719_4.17.19-041719.201808240919_amd64.deb
drwxr-xr-x 30 root root     4096 Sep  3 19:27 v4.17.19
-rw-r--r--  1 root root  8084568 Sep  3 19:27 linux-image-unsigned-4.17.19-041719-generic_4.17.19-041719.201808240919_amd64.deb
-rw-r--r--  1 root root 13054964 Sep  3 19:28 linux-modules-4.17.19-041719-generic_4.17.19-041719.201808240919_amd64.deb
-rw-r--r--  1 root root 33048820 Sep  3 19:30 linux-modules-extra-4.17.19-041719-generic_4.17.19-041719.201808240919_amd64.deb
-rw-r--r--  1 root root  1054586 Sep  3 19:30 linux-headers-4.17.19-041719-generic_4.17.19-041719.201808240919_amd64.deb
-rw-r--r--  1 root root     2106 Sep  3 19:30 linux-tools-4.17.19-041719-generic_4.17.19-041719.201808240919_amd64.deb
-rw-r--r--  1 root root     2010 Sep  3 19:30 linux-cloud-tools-4.17.19-041719-generic_4.17.19-041719.201808240919_amd64.deb
-rw-r--r--  1 root root  8137568 Sep  3 19:50 linux-image-unsigned-4.17.19-041719-lowlatency_4.17.19-041719.201808240919_amd64.deb
-rw-r--r--  1 root root 46000500 Sep  3 19:53 linux-modules-4.17.19-041719-lowlatency_4.17.19-041719.201808240919_amd64.deb
-rw-r--r--  1 root root  1055756 Sep  3 19:53 linux-headers-4.17.19-041719-lowlatency_4.17.19-041719.201808240919_amd64.deb
-rw-r--r--  1 root root     2108 Sep  3 19:53 linux-tools-4.17.19-041719-lowlatency_4.17.19-041719.201808240919_amd64.deb
-rw-r--r--  1 root root     2016 Sep  3 19:53 linux-cloud-tools-4.17.19-041719-lowlatency_4.17.19-041719.201808240919_amd64.deb
-rw-r--r--  1 root root 16243175 Sep  3 19:53 linux_4.17.19-041719.201808240919_amd64.tar.gz
-rw-r--r--  1 root root  9071916 Sep  3 19:54 kernel-image-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root     4240 Sep  3 19:54 fat-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root    13580 Sep  3 19:54 fb-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root    65364 Sep  3 19:54 firewire-core-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root    34394 Sep  3 19:54 floppy-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root  1521042 Sep  3 19:55 fs-core-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root   702796 Sep  3 19:55 fs-secondary-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root   439540 Sep  3 19:55 input-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root   287008 Sep  3 19:55 md-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root  4657978 Sep  3 19:55 nic-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root   143160 Sep  3 19:55 nic-pcmcia-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root   317262 Sep  3 19:55 nic-usb-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root   557954 Sep  3 19:55 nic-shared-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root    31694 Sep  3 19:55 parport-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root   122684 Sep  3 19:55 pata-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root    63292 Sep  3 19:55 pcmcia-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root    60144 Sep  3 19:55 pcmcia-storage-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root     8668 Sep  3 19:55 plip-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root    25082 Sep  3 19:55 ppp-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root    95646 Sep  3 19:55 sata-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root  2564480 Sep  3 19:55 scsi-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root    92380 Sep  3 19:55 serial-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root    49878 Sep  3 19:55 storage-core-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root   139400 Sep  3 19:55 usb-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root   538794 Sep  3 19:55 nfs-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root   292508 Sep  3 19:55 block-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root   207272 Sep  3 19:55 message-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root   322948 Sep  3 19:55 crypto-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root   106534 Sep  3 19:55 virtio-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root    58294 Sep  3 19:55 mouse-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root    26046 Sep  3 19:55 vlan-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root    61358 Sep  3 19:55 ipmi-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root    18264 Sep  3 19:55 multipath-modules-4.17.19-041719-generic-di_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root      940 Sep  3 19:55 linux-udebs-generic_4.17.19-041719.201808240919_amd64.udeb
-rw-r--r--  1 root root   979312 Sep  3 19:56 linux-libc-dev_4.17.19-041719.201808240919_amd64.deb

STEP 6) Install your new kernel v4.17.19.

Put all the deb packets in your repository or if you do not have repo install the deb packets like this:

root@srv:/root/tests/kernel# dpkg -i linux-headers-4.17.19-041719-lowlatency_4.17.19-041719.201808240919_amd64.deb \
linux-tools-4.17.19-041719-lowlatency_4.17.19-041719.201808240919_amd64.deb \
linux-image-unsigned-4.17.19-041719-lowlatency_4.17.19-041719.201808240919_amd64.deb \
linux-modules-4.17.19-041719-lowlatency_4.17.19-041719.201808240919_amd64.deb \
linux-tools-4.17.19-041719_4.17.19-041719.201808240919_amd64.deb \
linux-headers-4.17.19-041719_4.17.19-041719.201808240919_all.deb
(Reading database ... 216891 files and directories currently installed.)
Preparing to unpack linux-headers-4.17.19-041719-lowlatency_4.17.19-041719.201808240919_amd64.deb ...
Unpacking linux-headers-4.17.19-041719-lowlatency (4.17.19-041719.201808240919) over (4.17.19-041719.201808240919) ...
Preparing to unpack linux-tools-4.17.19-041719-lowlatency_4.17.19-041719.201808240919_amd64.deb ...
Unpacking linux-tools-4.17.19-041719-lowlatency (4.17.19-041719.201808240919) over (4.17.19-041719.201808240919) ...
Preparing to unpack linux-image-unsigned-4.17.19-041719-lowlatency_4.17.19-041719.201808240919_amd64.deb ...
Unpacking linux-image-unsigned-4.17.19-041719-lowlatency (4.17.19-041719.201808240919) over (4.17.19-041719.201808240919) ...
Preparing to unpack linux-modules-4.17.19-041719-lowlatency_4.17.19-041719.201808240919_amd64.deb ...
Unpacking linux-modules-4.17.19-041719-lowlatency (4.17.19-041719.201808240919) over (4.17.19-041719.201808240919) ...
Preparing to unpack linux-tools-4.17.19-041719_4.17.19-041719.201808240919_amd64.deb ...
Unpacking linux-tools-4.17.19-041719 (4.17.19-041719.201808240919) over (4.17.19-041719.201808240919) ...
Selecting previously unselected package linux-headers-4.17.19-041719.
Preparing to unpack linux-headers-4.17.19-041719_4.17.19-041719.201808240919_all.deb ...
Unpacking linux-headers-4.17.19-041719 (4.17.19-041719.201808240919) ...
Setting up linux-modules-4.17.19-041719-lowlatency (4.17.19-041719.201808240919) ...
Setting up linux-tools-4.17.19-041719 (4.17.19-041719.201808240919) ...
Setting up linux-headers-4.17.19-041719 (4.17.19-041719.201808240919) ...
Setting up linux-headers-4.17.19-041719-lowlatency (4.17.19-041719.201808240919) ...
Setting up linux-tools-4.17.19-041719-lowlatency (4.17.19-041719.201808240919) ...
Setting up linux-image-unsigned-4.17.19-041719-lowlatency (4.17.19-041719.201808240919) ...
Processing triggers for linux-image-unsigned-4.17.19-041719-lowlatency (4.17.19-041719.201808240919) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-4.17.19-041719-lowlatency
W: Possible missing firmware /lib/firmware/tigon/tg3_tso5.bin for module tg3
W: Possible missing firmware /lib/firmware/tigon/tg3_tso.bin for module tg3
W: Possible missing firmware /lib/firmware/tigon/tg3.bin for module tg3
/etc/kernel/postinst.d/zz-update-grub:
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-4.17.19-041719-lowlatency
Found initrd image: /boot/initrd.img-4.17.19-041719-lowlatency
Found linux image: /boot/vmlinuz-4.4.0-75-generic
Found initrd image: /boot/initrd.img-4.4.0-75-generic
Found Ubuntu 16.04.5 LTS (16.04) on /dev/sda2
done

And here we have a problem:

update-initramfs: Generating /boot/initrd.img-4.17.19-041719-lowlatency
W: Possible missing firmware /lib/firmware/tigon/tg3_tso5.bin for module tg3
W: Possible missing firmware /lib/firmware/tigon/tg3_tso.bin for module tg3
W: Possible missing firmware /lib/firmware/tigon/tg3.bin for module tg3

Because of our old linux firmware files. So you must update them with

root@srv:/root/tests/kernel# apt install linux-firmware
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  nagios-nrpe-server
Use 'apt autoremove' to remove it.
The following packages will be upgraded:
  linux-firmware
1 upgraded, 0 newly installed, 0 to remove and 45 not upgraded.
Need to get 0 B/50.0 MB of archives.
After this operation, 36.5 MB of additional disk space will be used.
(Reading database ... 234379 files and directories currently installed.)
Preparing to unpack .../linux-firmware_1.157.20_all.deb ...
Unpacking linux-firmware (1.157.20) over (1.157.13) ...
Setting up linux-firmware (1.157.20) ...
update-initramfs: Generating /boot/initrd.img-4.17.19-041719-lowlatency
update-initramfs: Generating /boot/initrd.img-4.4.0-75-generic

The update is from linux-firmware 1.157.13 to linux-firmware 1.157.20.
The initrd.img are repacked with the new firmware files and no errors there, so it should work well after reboot, but after the reboot you shuld check again for firmware errors in dmesg or if some of your devices does not work probably the you need more recent version than there is in the Ubuntu official repos, so you can check here: https://launchpad.net/ubuntu/+source/linux-firmware and/or here: https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git The second one is the official repository of the supported firmware files by the Linux kernel. This step is very important, because YOU COULD LOSE your device for example your NETWORKING because of the network driver and after the reboot of your server you’ll have no connection to it!

STEP 7) Now is the time to reboot your server to load the new kernel v4.17.19.

Verify the server is with your new kernel then.

root@srv:/root/tests/kernel# reboot
Connection to srv closed by remote host.
Connection to srv closed.
myuser@local:~$ ssh srv
root@srv ~ # uname -a
Linux srv 4.13.4-041304-lowlatency #201709270931 SMP PREEMPT Wed Nov 1 11:44:52 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

One thought on “Build your own kernel under Ubuntu using mainline (latest) kernel”

Leave a Reply

Your email address will not be published.