注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

艾伯特的鸟屋

 
 
 

日志

 
 

Compile Linux Kernel on Ubuntu 12.04 LTS  

2012-10-17 14:07:52|  分类: linux |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
1) installing some dependencies
sudo apt-get install git-core libncurses5 libncurses5-dev libelf-dev asciidoc binutils-dev linux-source qt3-dev-tools libqt3-mt-dev libncurses5 libncurses5-dev fakeroot build-essential crash kexec-tools makedumpfile kernel-wedge kernel-package
2) get the kernel sources with wget from www.kernel.org
wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.2.31.tar.bz2
3) extract the archive and change into the kernel directory
tar -xvjf linux-3.2.31.tar.bz2; cd linux-3.2.31/
4) (optional)patch into the kernel
patch -p1 < xxx.patch
5) copying the current config contained in /boot
cp -vi /boot/config-`uname -r` .config
6) parsing the .config file
make oldconfig
7)(optional)Since the 2.6.32 kernel, a new feature allows you to update the configuration to only compile modules that are actually used in your system
make localmodconifg
8) configure the kernel to your needs (以下8.x操作任选其一)
8.1) make menuconfig
8.2) make xconfig
In either case, you will be presented with a series of menus, from which you will choose the options you want to include. For most options you have three choices: (blank) leave it out; (M) compile it as a module, which will only be loaded if the feature is needed; (*) compile it into monolithically into the kernel, so it will always be there from the time the kernel first loads.

There are several things you might want to accomplish with your reconfiguration:

    Reduce the size of the kernel, by leaving out unnecessary components. This is helpful for kernel development. A small kernel will take a lot less time to compile and less time to load. It will also leave more memory for you to use, resulting in less page swapping and faster compilations.
    Retain the modules necessary to use the hardware installed on your system. To do this without including just about everything conceivable, you need figure out what hardware is installed on your system. You can find out about that in several ways.

Before you go too far, use the “General Setup” menu and the “Local version” and “Automatically append version info” options to add a suffix to the name of your kernel, so that you can distinguish it from the “vanilla” one. You may want to vary the local version string, for different configurations that you try, to distinguish them also.

Assuming you have a running Linux system with a working kernel, there are several places you can look for information about what devices you have, and what drivers are running.

    Look at the system log file, /var/log/messages or use the command dmesg to see the messages printed out by the device drivers as they came up.
    Use the command lspci -vv to list out the hardware devices that use the PCI bus.
    Use the command lsub -vv to list out the hardware devices that use the USB.
    Use the command lsmod to see which kernel modules are in use.
    Look at /proc/modules to see another view of the modules that are in use.
    Look at /proc/devices to see devices the system has recognized.
    Look at /proc/cpuinfo to see what kind of CPU you have.
    Open up the computer’s case and read the labels on the components.
    Check the hardware documentation for your system. If you know the motherboard, you should be able to look up the manual, which will tell you about the on-board devices.

Using the available information and common sense, select a reasonable set of kernel configuration options. Along the way, read through the on-line help descriptions (for at least all the top-level menu options) so that you become familiar with the range of drivers and software components in the Linux kernel.

9)cimpiling the kernel
make -j5

10)
sudo make modules_install

11)
sudo make install

12) reboot
sudo reboot
  评论这张
 
阅读(308)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017