hardware requirements:

you will need AT LEAST 15GB of free disk space, better 20GB. (yes you can free disk space again after compilation…)

du -h --max-depth=0 /usr/src/linux-4.17.12
12G /usr/src/linux-4.17.12


if you want the LATEST Kernel ( above  4.17.19) you will need also gcc version > 4.5 or you run into

make clean
arch/x86/Makefile:184: *** Compiler lacks asm-goto support..  Stop.


under Centos7/Redhat/Fedora this seems to be done like this: (src)

yum install centos-release-scl
yum install devtoolset-7-gcc*
scl enable devtoolset-7 bash
which gcc
gcc --version

gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO

tested with:
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-862.9.1.el7.x86_64
Architecture: x86-64
about x86: Force asm-goto: „We want to start using asm-goto to guarantee the absence of dynamic branches (and thus speculation). A primary prerequisite for this is of course that the compiler supports asm-goto. This effecively lifts the minimum GCC version to build an x86 kernel to gcc-4.5. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Thomas Gleixner of: linutronix.de  Link: https://lkml.kernel.org/r/20180319201327.GJ4043@hirez.programming.kicks-ass.net

if you want the latest kernel for Debian: debian9 stretch…

it seems to pretty much be always the same process:

  1. pull latest kernel
  2. try make menuconfig
  3. install missing packages until make menuconfig works

in this example i try to compile the latest kernel from kernel.org on CentOS7

it compiles… and boots up…

hit ESC or other keys to see the verbose kernel output instead of the loading bar…

hostnamectl; # tested on
   Static hostname: CentOS7
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-514.26.1.el7.x86_64
      Architecture: x86-64

# also tested on
Kernel: Linux 3.10.0-693.11.6.el7.x86_64
# also tested 2018-02-06 on
Kernel: Linux 3.10.0-693.17.1.el7.x86_64
# also tested on 2018-07
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-862.6.3.el7.x86_64

su; # become root
yum update; # update system

yum search kernel-devel; # search for kernel headers
yum install kernel-devel.x86_64; # install kernel headers required by gcc
yum search ncurses; # search for devel and i386 (32bit) or 64Bit
yum install wget gcc ncurses-devel.x86_64; # install gcc and ncurses
cd /usr/src/
# now visit http://kernel.org/ and get the link to the latest kernel

wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.12.tar.xz
tar fxvJ linux-4.12.tar.xz
ln -sv linux-4.12 linux
cd linux
uname -r;
# this is our current kernel version
cp -v /boot/config-$(uname -r) .; # reuse the currently used kernel.config
make clean
make menuconfig;

# gave me this error:
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/mconf.o
YACC scripts/kconfig/zconf.tab.c
/bin/sh: bison: command not found
make[1]: *** [scripts/kconfig/zconf.tab.c] Error 127
make: *** [menuconfig] Error 2

yum install bison

# rerun
make menuconfig
# gave me this error
YACC scripts/kconfig/zconf.tab.c
LEX scripts/kconfig/zconf.lex.c
/bin/sh: flex: command not found
make[1]: *** [scripts/kconfig/zconf.lex.c] Error 127
make: *** [menuconfig] Error 2

yum install flex

# rerun
make menuconfig
# now finally worked:

# all i modified here is under General -> Custom string cuztom

# older versions look like this

# for compile to work one needs additional packages
yum install elfutils-libelf-devel.x86_64 openssl-devel.x86_64 bc screen

# screen package is optional
# allows you to start compilation and disconnect
# while installing the new kernel requires root
# according to this, you should not compile as root
screen -S compiling_kernel; # starting a new screen session with this name
make clean;
time make -j2; # compile using all 2 cores

# on system with 2x Intel Xeon Processor (Skylake, IBRS) 2GHZ 16MByte Cache bogomips: 4199.99
# it took 85minutes to compile 4.17.4
# Ctrl+A then D = detach from current screen session
screen -ls; # show current screen sessions
screen -R compiling_kernel; # resume this screen session
compiling kernel 4.12.13 under centos7 with 8x xeon E5504 at 2.00GHz cores on supermicro X8DT3 server

compiling kernel 4.12.13 under centos7 with 8x xeon E5504 at 2.00GHz cores on supermicro X8DT3 server (2018-01) good way to stress test your system 😀  real: 24m48.755s … not too bad 😀

make modules_install
make install
reboot; # and test your new kernel
# if that worked you might want to make it boot the new kernel per default
vim /etc/default/grub; # make sure those orange lines are present
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"

# :wq save quit vim

# centos7 update grub config and menu
grub2-mkconfig -o /boot/grub2/grub.cfg

# can show you what the boot menu looks like and what entry should be default
awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
0 : CentOS Linux (4.10.0-862.14.4.el7.x86_64) 7 (Core)
1 : CentOS Linux (3.10.0-862.9.1.el7.x86_64) 7 (Core)
2 : CentOS Linux (0-rescue-9063ac396d784f4c997ceacdd0590c25) 7 (Core)

# show what is current default kernel
grub2-editenv list
saved_entry=CentOS Linux (3.10.0-862.14.4.el7.x86_64) 7 (Core)

grub2-set-default 0

# or if you have access to the server directly:
# reboot select new kernel and it should be set to default
# after
# and all goes well, you should be running your latest kernel

modules and kernel install fine – after reboot i can select the new kernel 4.12 and it boots up fine.

[user@CentOS7 ~]$ hostnamectl
   Static hostname: CentOS7
         Icon name: computer-vm
           Chassis: vm
        Machine ID: ad6f3410bf2346ec97a6fdc05dc4a607
           Boot ID: 58e86772e8b34dab97bd2428e7592413
    Virtualization: microsoft
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 4.12.0cuztom
      Architecture: x86-64

 Static hostname: CentOSworkstation.localdomain
 Icon name: computer-laptop
 Operating System: CentOS Linux 7 (Core)
 CPE OS Name: cpe:/o:centos:centos:7
 Kernel: Linux 4.14.12 (recent in 2017-01)
 Architecture: x86-64


cleaning up:

# to avoid overwriting your custom compiled kernel with the next update add this
vim /etc/yum.conf 
# if it is a desktop workstation you might also want to
exclude=icedove* firefox* libreoffice*


a quadcore Intel(R) Core(TM) i5-3470T CPU @ 2.90GHz needs real 36m58.294s to compile linux-4.15.1

….not sure what those messages are about:

full error message:

SELinux is preventing /usr/libexec/accounts-daemon from using the dac_read_search capability.

*****  Plugin dac_override (91.4 confidence) suggests   **********************

If sie berprfen wollen, ob Domne diesen Zugriff bentigt oder Sie eine Datei mit den falschen Berechtigungen auf Ihrem System haben
Then aktivieren Sie die vollstndige Audit-Funktion, um die Pfad-Information der problematischen Datei zu erhalten. Dann reproduzieren Sie den Fehler erneut.

Volle Audit-Funktion aktivieren
# auditctl -w /etc/shadow -p w
Versuchen Sie AVC zu reproduzieren. Fhren Sie dann folgendes aus
# ausearch -m avc -ts recent
Falls PATH record ersichtlich ist, berprfen Sie Eigentmer/ Berechtigungen der Datei und korrigieren Sie dies,
anderenfalls melden Sie dies an Bugzilla.

*****  Plugin catchall (9.59 confidence) suggests   **************************

If sie denken, dass accounts-daemon standardmig dac_read_search Berechtigung haben sollten.
Then sie sollten dies als Fehler melden.
Um diesen Zugriff zu erlauben, knnen Sie ein lokales Richtlinien-Modul erstellen.
allow this access for now by executing:
# ausearch -c 'accounts-daemon' --raw | audit2allow -M my-accountsdaemon
# semodule -i my-accountsdaemon.pp

Additional Information:
Source Context                system_u:system_r:accountsd_t:s0
Target Context                system_u:system_r:accountsd_t:s0
Target Objects                Unknown [ capability ]
Source                        accounts-daemon
Source Path                   /usr/libexec/accounts-daemon
Host                          CentOS7
Source RPM Packages
Target RPM Packages
Policy RPM                    selinux-policy-3.13.1-102.el7_3.16.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     CentOS7
Platform                      Linux CentOS7 4.12.0cuztom #1 SMP Mon Jul 3
                              12:01:05 CEST 2017 x86_64 x86_64
Alert Count                   6
First Seen                    2017-07-03 15:13:18 CEST
Last Seen                     2017-07-03 15:13:52 CEST
Local ID                      286945cd-6cfc-4233-a5b4-747cfe5afe79

Raw Audit Messages
type=AVC msg=audit(1499087632.710:111): avc:  denied  { dac_read_search } for  pid=782 comm="accounts-daemon" capability=2  scontext=system_u:system_r:accountsd_t:s0 tcontext=system_u:system_r:accountsd_t:s0 tclass=capability permissive=0

Hash: accounts-daemon,accountsd_t,accountsd_t,capability,dac_read_search

important or simply cool and probably related links 🙂

watch Linus Torvalds at work at kernel.org: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


Among the material likely coming for Linux 4.13 that we have already covered on Phoronix includes:

– Initial AMD Raven Ridge graphics support (sans no display due to no DC/DAL yet), Vega fixes, and other updates.

Many Allwinner DRM changes.

DRM sync objects are landing.

Raspberry Pi / VC4 improvements.

Various updates to the Intel DRM driver.

Large directory support for EXT4.

XPad updates and Google Rose Touchpad support.

AES-128-CBC support in Fscrypt, the file-system generic crypto code currently utilized by EXT4 and F2FS.

– Possibly the AMD SME/SEV security features supported by new EPYC CPUs.

– Continued push for more HDMI CEC drivers.

Stay tuned for thorough Linux 4.13 kernel feature coverage once the merge window opens following the 4.12 debut.

src: http://www.phoronix.com/scan.php?page=news_item&px=Linux-4.13-Early-Look