☰
×
◈ Introductions
◈ Linux Kernel Compilation
◈ Linux Kernel Debugging
◈ Linux Kernel APIs - I
◈ Linux Kernel APIS - II
◈ Linux Kernel APIS - III
◈ KGDB Setup
◈ QEMU Setup
◈ Linux System Calls Table
◈ Useful Linux Commands
Home
About
Consulting
Training
Tutorials
Interview Questions
Contact
Tutorials
Linux Kernel Compilation
Home
Linux Kernel Compilation
◈ Introductions
◈ Linux Kernel Compilation
◈ Linux Kernel Debugging
◈ Linux Kernel APIs - I
◈ Linux Kernel APIS - II
◈ Linux Kernel APIS - III
◈ KGDB Setup
◈ QEMU Setup
◈ Linux System Calls Table
◈ Useful Linux Commands
Tutorials - Linux Kernel Compilation
Coimpilation Steps
« Prev
Next »
Linux Kernel Compilation Steps
1. Download the Latest Stable Kernel The first step is to download the latest stable kernel from kernel.org. # cd /usr/src/ # wget https://kernel.org/pub/linux/kernel/v4.x/linux-4.12.3.tar.xz 2. Untar the Kernel Source The second step is to untar the kernel source file for compilation. # tar -xvJf linux-4.12.3.tar.xz 3. Configure the Kernel The kernel contains nearly 3000 configuration options. To make the kernel used by most people on most hardware, the Linux distro like Ubuntu, Fedora, Debian, RedHat, CentOS, etc, will generally include support for most common hardware. You can take any one of configuration from the distro, and on top of that you can add your own configuration, or you can configure the kernel from scratch, or you can use the default config provided by the kernel. ( OR ) You can copy the old configuration cp /boot/config-$(uname -r) /usr/src/linux-4.12.3/.config # cd linux-4.12.3 # make menuconfig xconfig gconfig The make menuconfig, will launch a text-based user interface with default configuration options as shown in the figure. You should have installed “libncurses and libncurses-devel” packages for this command to work. We will use the default config provided by the kernel. So select “Save” and save the config in the file name “.config”. 4. Compile the Linux Kernel Compile the main kernel: # make Compile the kernel modules: # make modules Install the kernel modules # make modules_install At this point, you should see a directory named /lib/modules/4.12.3/ in your system. 5. Install the New Kernel Install the new kernel on the system: # make install The make install command will create the following files in the /boot directory. vmlinuz-4.12.3 – The actual kernel System.map-4.12.3 – The symbols exported by the kernel initrd.img-4.12.3 – initrd image is temporary root file system used during boot process config-4.12.3 – The kernel configuration file The command “make install” will also update the grub.cfg by default. So we don’t need to manually edit the grub.cfg file. 6. Boot Linux to the new Kernel To use the new kernel that you just compiled, reboot the system. # reboot
« Prev
Next »
Helpful Links
Interview Questions
Corporate Training
Recommended Books
Linux Consulting
Apply for Job Assistance
If you have any queries please email us at
info@motionzen.com