Presentation is loading. Please wait.

Presentation is loading. Please wait.

Rebuilding Linux Kernel Dedicated to penguin lovers everywhere 26 September 20161Rebuilding kernel by Visakh M R.

Similar presentations


Presentation on theme: "Rebuilding Linux Kernel Dedicated to penguin lovers everywhere 26 September 20161Rebuilding kernel by Visakh M R."— Presentation transcript:

1 Rebuilding Linux Kernel Dedicated to penguin lovers everywhere 26 September 20161Rebuilding kernel by Visakh M R

2 Why REBUILD? To optimize the kernel to your environment To extract every ounce of performance Typically we rebuild kernel when  A new hardware is added  Kernel is to be modified 26 September 20162Rebuilding kernel by Visakh M R

3 Hardware requirements 128M RAM 2G of hard drive space 200MhZ Pentium or equivalent CPU The kernel does not need to be built on the same machine on which it will be deployed. This means that you can compile and package your kernel on a more robust machine and then install on a minimal system. 26 September 20163Rebuilding kernel by Visakh M R

4 Determining Current hardware We start by running the utility to print information $ /sbin/lpsci To determine processor type if not known $ cat /proc/cpuinfo This information is needed during the configuration process when we decide which hardware will be supported under our new kernel. 26 September 2016Rebuilding kernel by Visakh M R4

5 Download the source The latest sources are always available from http://kernel.org http://kernel.org Patches are available from many sites Many other vendors and individuals have developed patches to improve aspects of the kernel’s performance. 26 September 2016Rebuilding kernel by Visakh M R5

6 Patching the kernel Patches attach new features to kernel We can apply patches to the kernel sources It is important to apply the patches in order from the source directory $patch -p1 <path/to/patchfile1 $patch -p1 <path/to/patchfile2 Once all the patches are applied you might consider backing up the directory 26 September 2016Rebuilding kernel by Visakh M R6

7 Configuration process Compile module or static Assigning unique name Makefile is a default file in source used by make utility to compile the Linux source. When final installation is done, kernel module files get written to /lib/modules/$VERSION.$PATCHLEVEL.$SUBLEVEL-$EXTRAVERSION first few lines of Makefile will contain versioning information VERSION = 2 PATCHLEVEL= 4 SUBLEVEL= 22 EXTRAVERSION= -1 Backup.config to config.save All previous configurations are wiped out using $make mrproper (Contd..) 26 September 2016Rebuilding kernel by Visakh M R7

8 Configuring the 2.4.x kernels using make utility you can configure config, oldconfig, menuconfig and xconfig Building dependencies(eg: create include files) $ make dep $ make clean Build the kernel $ make bzImage If everything went correctly then the new kernel should exist in./arch/$ARCH/boot Build Modules $ make modules $ make modules_install(Contd..) 26 September 2016Rebuilding kernel by Visakh M R8

9 Create Initial RAMDisk $ mkinitrd /boot/initrd-version If your main boot drivers are modules then you have to create an initial RAMDisk image. Drivers are needed to load the root filesystem but the filesysytem cannot be loaded because the drivers are on the filesystem. initrd is a way to sidestep this chicken and egg problem. Installation copy kernel and System.map file to /boot. Configure the bootloader edit the grub configuration file located in /boot/grub/menu.lst 26 September 2016Rebuilding kernel by Visakh M R9

10 Summarizing Log on as Root (or become SU) cd /usr/src/linux make config alternately, make menuconfig make xconfig make dep make clean make zImage alternately, make bzImage make zlilo Above step should take only a few minutes with a fast CPU If you are building a modular kernel make modules make modules_install Copy new kernel image to /boot set symbolic link to vmlinuz /sbin/lilo or grub 26 September 2016Rebuilding kernel by Visakh M R10

11 Thanking you 26 September 2016Rebuilding kernel by Visakh M R11


Download ppt "Rebuilding Linux Kernel Dedicated to penguin lovers everywhere 26 September 20161Rebuilding kernel by Visakh M R."

Similar presentations


Ads by Google