Sunday, January 7, 2018

Installing Vanilla Kernel in Ubunutu ( Kernel Compilation Steps 4.14 in Ubuntu)

1.0.Some packages might be needed for Kernel compilation.
apt-get install libelf-dev linux-headers-generic   build-essential
sudo apt-get build-dep linux-image-$(uname -r)

2.Download Kernel
wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.14.12.tar.xz

3. Extract
tar xvf *.tar.xz

3.Now since lots of Configuration has to be choose
better use existing kernel .config files.
i.e
root@# uname -r
4.10.0-42-generic
root@# cp /boot/config-4.10.0-42-generic to kernel src directory.

5.make menuconfig and Select some of this options ( Press / and search)
GENERIC_IRQ_DEBUGFS
CONFIG_IKCONFIG_PROC
CONFIG_GENERIC_IRQ_DEBUGFS
CONFIG_PERF_EVENTS
CONFIG_PROFILING:
CONFIG_MCORE2
CONFIG_MAGIC_SYSRQ
CONFIG_DEBUG_INFO
CONFIG_KGDB
CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE: 
CONFIG_LOCK_STAT:
CONFIG_PROVE_LOCKING:
KALLSYMS_ALL
CONFIG_PROFILING
CONFIG_FRAME_POINTER
CONFIG_DEBUG_SPINLOCK
CONFIG_DEBUG_MUTEXES
CONFIG_DEBUG_KERNEL
CONFIG_ENABLE_WARN_DEPRECATED:                                                                                                                   x
FUNCTION_GRAPH_TRACER
DYNAMIC_FTRACE

6.DISABLE this
CONFIG_MODULE_SIG

7. Make –j 8 ( cores *2)

8.sudo make modules_install


9. Make backup of grub config before update the grub.
1. Check /etc/default/grub
GRUB_DEFAULT="1>6"
GRUB_HIDDEN_TIMEOUT=0 ( need to removed ???)
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
(Change alteast timeout time so that if kernel fails to boot you can select other kernel next time)

2. Checl /boot/grub/grub.conf
if [ "${recordfail}" = 1 ] ; then
  set timeout=30





10. Update grub using
make install
(
sh ./arch/x86/boot/install.sh 4.14.12 arch/x86/boot/bzImage \
        System.map "/boot"
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.14.12 /boot/vmlinuz-4.14.12
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.14.12 /boot/vmlinuz-4.14.12
update-initramfs: Generating /boot/initrd.img-4.14.12

)

11.For kernel programming , copy headers of this kernel to /usr
sudo make headers_install INSTALL_HDR_PATH=/usr

No comments:

Post a Comment

Featured Post

XDP - Getting Started with XDP (Linux)