Compiling custom kernel has its own advantages and disadvantages. However, new Linux user / admin find it difficult to compile Linux kernel. Compiling kernel needs to understand few things and then just type couple of commands. This step by step howto covers compiling Linux kernel version 2.6.xx under Debian GNU Linux. However, instructions remains the same for any other distribution except for apt-get command.

Step # 1 Get Latest Linux kernel code

Visit http://kernel.org/ and download the latest source code. File name would be linux-x.y.z.tar.bz2, where x.y.z is actual version number. For example file inux-2.6.25.tar.bz2 represents 2.6.25 kernel version. Use wget command to download kernel source code:

$ cd /tmp
$ wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-x.y.z.tar.bz2

Note: Replace x.y.z with actual version number.

Step # 2 Extract tar (.tar.bz3) file

Type the following command:

# tar -xjvf linux-2.6.25.tar.bz2 -C /usr/src

# cd /usr/src

Step # 3 Configure kernel

Before you configure kernel make sure you have development tools (gcc compilers and related tools) are installed on your system. If gcc compiler and tools are not installed then use apt-get command under Debian Linux to install development tools.

# apt-get install gcc

Now you can start kernel configuration by typing any one of the command:

  • $ make menuconfig - Text based color menus, radiolists & dialogs. This option also useful on remote server if you wanna compile kernel remotely.
  • $ make xconfig - X windows (Qt) based configuration tool, works best under KDE desktop
  • $ make gconfig - X windows (Gtk) based configuration tool, works best under Gnome Dekstop.

For example make menuconfig command launches following screen:

$ make menuconfig

You have to select different options as per your need. Each configuration option has HELP button associated with it so select help button to get help.

Step # 4 Compile kernel

Start compiling to create a compressed kernel image, enter:

$ make

Start compiling to kernel modules:

$ make modules

Install kernel modules (become a root user, use su command):

$ su -

# make modules_install

Step # 5 Install kernel

So far we have compiled kernel and installed kernel modules. It is time to install kernel itself.

# make install

It will install three files into /boot directory as well as modification to your kernel grub configuration file:

  • System.map-2.6.25
  • config-2.6.25
  • vmlinuz-2.6.25

Step # 6: Create an initrd image

Type the following command at a shell prompt:

# cd /boot

# mkinitrd -o initrd.img-2.6.25 2.6.25

initrd images contains device driver which needed to load rest of the operating system later on. Not all computer requires initrd, but it is safe to create one.

Step # 7 Modify Grub configuration file - /boot/grub/menu.lst

Open file using vi:

# vi /boot/grub/menu.lst

title           Debian GNU/Linux, kernel 2.6.25 Default
root (hd0,0)
kernel /boot/vmlinuz root=/dev/hdb1 ro
initrd /boot/initrd.img-2.6.25
savedefault
boot

Remember to setup correct root=/dev/hdXX device. Save and close the file. If you think editing and writing all lines by hand is too much for you, try out update-grub command to update the lines for each kernel in /boot/grub/menu.lst file. Just type the command:

# update-grub

Neat. Huh?

Step # 8 : Reboot computer and boot into your new kernel

Just issue reboot command:

# reboot

最新文章

  1. mac系统使用帮助
  2. Diwali
  3. Memcache基础教程
  4. Android studio快捷键总结
  5. Linear or non-linear shadow maps?
  6. python内置模块(4)
  7. Bson
  8. Appium对京东App中WebView的处理
  9. grep比较两个文本相同不同行
  10. Spark Streaming揭秘 Day21 动态Batch size实现初探(下)
  11. 配置nginx的负载均衡
  12. 文成小盆友python-num13 整个堡垒机
  13. 基于内容的自适应变长编码[CAVLC]
  14. 一个跨平台的 C++ 内存泄漏检测器
  15. linux(2)文件和目录管理(新增,删除,复制,移动,文件和目录权限,文件查找)
  16. NoSQL Manager for MongoDB 30天到期破解
  17. jira7.3.6的安装步骤
  18. Ubuntu server LTS 16.04安装SSH以及连接问题
  19. day 7-11 初识MySQL数据库及安装密码设置破解
  20. MYSQL数据库在Windows系统中重置root密码

热门文章

  1. k8s-高可用多主master配置
  2. 后缀数组--summer-work之我连模板题都做不起
  3. webbench接口并发测试
  4. 20190926 - macOS 下查看进程路径
  5. PI膜热作用机理
  6. springboot整合es客户端操作elasticsearch(四)
  7. Nginx 配置文件解释及简单配置
  8. SQL 查看某个表被哪些存储过程或者视图使用
  9. STL priority_queue 常见用法详解
  10. VC++2017关于项目出现"const char *" 类型的实参与 "char *" 类型的形参不兼容错误的解决方法