how to compile and install linux kernel

by Torstan  2011-7-3 13:20

 

In this weekend, I just want to try compiling and installing linux kernel. The root cause is I am a programmer having 3 years working experience图片. After 2 days, I succeeded. I am so happy. Now I am recording the flow.

Before all steps, I describe the environment I used. I have installed a ubuntu on VMware which works on window XP. So I decided to install another linux version on the VMware.

On Saturday, I intended to install the latest linux version, 2.6.39.2. After getting the source code form www.kernel.org, I followed the instructions in the README in the extracted file. However, I failed to boot the system with the newest kernel. Then I googled the error messages, and found that I made a big mistake, no initrd file generated. After I used mkinitramfs to generate it, I failed again. I guessed everything seemed ok except the grub file, menu.lst under /boot/grub. I googled the meanings of all the items in grub file, such as root, and root of kernel. I recompiled code and installed kernel several times, and failed on and on. Fortunately, I used update-grub command, which automatically updated menu.lst for me. I believe it more reasonable than what I wrote. I still failed...In the evening, I noticed that I had installed several kernels by automatic update, for example, 2.6.24-16-generic, 2.6.24-24-generic and 2.6.24-29-generic. All of them are at brach 2.6.24, so I guessed I should try 2.6.24 version of code. What's more, make config is not easy.

On sunday moring, I succeeded, after a lot of failure. Here are the steps.
1) download version 2.6.24 from http://www.kernel.org/pub/linux/kernel/v2.6/
2) extract file by using tar xjvf linux-2.6.24.tar.bz2
3) cd linux-2.6.24/
   make mrproper
  cp /boot/config-2.6.24-16-generic .config
  make oldconfig
  make
  sudo make modules_install install
  sudo update-initramfs -c -k 2.6.24
  edit menu.lst in /boot/grub to add an option of 2.6.24
4) reboot and express ESC to choose kernel 2.6.24.
5)done

Finally, I checked what kernel is used.
图片torstan@stan:~$ uname -r
2.6.24


转载于:https://www.cnblogs.com/Torstan/archive/2012/02/18/2357703.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值