compile kernel 4.4

Some dependencies to install before compilation:

1
sudo apt-get install libncurses5-dev libncursesw5-dev libssl-dev

Compile kernel

  1. make menuconfig
  2. make -j$(nproc)
  3. sudo make modules_install
  4. sudo make install
  5. sudo reboot

Add these lines after ‘all: vmlinux’ in Makefile:

1
2
3
4
KBUILD_CFLAGS += $(call cc-option, -fno-pie)
KBUILD_CFLAGS += $(call cc-option, -no-pie)
KBUILD_AFLAGS += $(call cc-option, -fno-pie)
KBUILD_CPPFLAGS += $(call cc-option, -fno-pie)

That is,

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
--- a/Makefile
+++ b/Makefile
@@ -608,6 +608,12 @@ endif # $(dot-config)
# Defaults to vmlinux, but the arch makefile usually adds further targets
all: vmlinux

+# force no-pie for distro compilers that enable pie by default
+KBUILD_CFLAGS += $(call cc-option, -fno-pie)
+KBUILD_CFLAGS += $(call cc-option, -no-pie)
+KBUILD_AFLAGS += $(call cc-option, -fno-pie)
+KBUILD_CPPFLAGS += $(call cc-option, -fno-pie)
+
# The arch Makefile can set ARCH_{CPP,A,C}FLAGS to override the default
# values of the respective KBUILD_* variables
ARCH_CPPFLAGS :=
--