<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>转烛空间内核 &#187; </title>
	<atom:link href="http://wangliping.net/tag/%e5%86%85%e6%a0%b8/feed" rel="self" type="application/rss+xml" />
	<link>http://wangliping.net</link>
	<description>记录生活，学习技术</description>
	<lastBuildDate>Fri, 30 Jul 2010 02:30:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>编译Linux内核教程（Ubuntu为例）</title>
		<link>http://wangliping.net/make_linux_kernel_update</link>
		<comments>http://wangliping.net/make_linux_kernel_update#comments</comments>
		<pubDate>Mon, 16 Nov 2009 08:22:22 +0000</pubDate>
		<dc:creator>转烛</dc:creator>
				<category><![CDATA[编程技术]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[内核]]></category>
		<category><![CDATA[升级]]></category>
		<category><![CDATA[编译]]></category>

		<guid isPermaLink="false">http://wangliping.net/?p=460</guid>
		<description><![CDATA[　　有时候觉得Linux内核版本太低，想升级一下，或者想研究一下，我们就需要以下方法了。顺带说，Linux的开放性在此也体现出来了优越性，呵呵～

　　以下先介绍简单快捷的方法，根据各大教程总结出来的。步骤：

　　一、到http://kernel.org下载最新的kernel（或者你想要的版本，以下以linux-2.6.31.6为例说明，并假设在root权限，否则加sudo）。
　　二、拷贝到/usr/src目录下，$ cp ~/linux-2.6.31.6.tar.bz2 /usr/src。（其实在任意目录都可以，只是在这个目录看起来正规一点，呵呵～）
　　三、到/usr/src目录下，$ cd /usr/src。解压kernel。$ tar jxf  linux-2.6.31.6.tar.bz2。（想了解jxf参数的意思，可以tar --help）。
　　四、编译config，最简单的方法就是将已有的config拷贝过来。查看/boot目录，cd到linux-2.6.31.6目录，$ cd linux-2.6.31.6。譬如我的，$ cp config--2.6.28-16-generic config。然后$make config。当然还有推荐$make menuconfig $make xconfig 可视化比较好，可以很直观，不过这两者都需要安装一些包，看你个人。make config用文字方式列出很多很多参数，你看着选择（后面转载文章详细列出参数）。]]></description>
			<content:encoded><![CDATA[<p>　　有时候觉得Linux内核版本太低，想升级一下，或者想研究一下，我们就需要以下方法了。顺带说，Linux的开放性在此也体现出来了优越性，呵呵～</p>
<p>　　总的来说，根据各大教程总结出来，在你解压的Kernel目录下执行以下步骤就完成了。</p>
<blockquote><p># make config<br />
# make bzImage<br />
# make modules<br />
# make modules_install<br />
# mkinitramfs -o yourinitrd.img 2.3.31.6(或mkinitrd yourinitrd.img)<br />
# make install</p></blockquote>
<p><span id="more-460"></span>　　以下简单说明一下上述方法：</p>
<p>　　一、到<a href="http://kernel.org">http://kernel.org</a>下载最新的kernel（或者你想要的版本，以下以linux-2.6.31.6为例说明，并假设在root权限，否则加sudo）。<br />
　　二、拷贝到/usr/src目录下，$ cp ~/linux-2.6.31.6.tar.bz2 /usr/src。（其实在任意目录都可以，只是在这个目录看起来正规一点，呵呵～）<br />
　　三、到/usr/src目录下，$ cd /usr/src。解压kernel。$ tar jxf  linux-2.6.31.6.tar.bz2。（想了解jxf参数的意思，可以tar --help）。<br />
　　四、编译config，最简单的方法就是将已有的config拷贝过来。查看/boot目录，cd到linux-2.6.31.6目录，$ cd linux-2.6.31.6。譬如我的，$ cp /boot/config--2.6.28-16-generic config。然后$make config。当然还有推荐$make menuconfig $make xconfig 可视化比较好，可以很直观，不过这两者都需要安装一些包，看你个人。make config用文字方式列出很多很多参数，你看着选择（后面转载文章详细列出参数）。当然还有两个比较简便的方法。$ make defconfig 就是利用默认的选项，据说Linus的i386机子就是这个配置，哈哈～$ make allyesconfig 就是将所有选项都选yes，这个编译要花的时间就很长很长了，4小时以上，当然得看你机子的配置了。<br />
　　五、清楚一些不要的东西，$ make clean。当然如果你是刚下载下来，从来没编译过的，可以忽略此步骤。<br />
　　六、$make bzImage。一般大于512K用这个，当然你说一定要用$make zImage我也没辙，不过还是推荐$ make bzImage吧。<br />
　　七、$ make modules。编译模块。<br />
　　八、$ make modules_install。安装模块。<br />
　　九、制作initrd.img文件。SCSI硬盘需要制作，IDE盘好像可以省略，我没试，因为自己的是SCSI。$ mkinitramfs -o initrd-newkernel.img 2.6.31.6。这个是在Ubuntu下的，因为Ubuntu下mkinitrd命令不可以用。至于参数可以自己用help（其实如果你敲错了，它自己就会出来提示，呵呵）<br />
　　十、$ make install。将上述的东西安装到/boot下，执行完此命令后，你就可以到/boot目录下看到System.map-2.6.31.6/vmlinuz-2.6.31.6/config-2.6.31.6。你如果看到以上文件，恭喜你，你编译成功了。记得手动把生成的initrd-newkernel.img也栲过来，想重新命名随你。<br />
　　十一、接下来就是编写menu了。有的是menu.lst，有的是grub.conf，看你的发行版本来，以Ubuntu为例，添加以下代码到原来的menu之后：</p>
<blockquote><p>title           Ubuntu new, kernel 2.6.31.6<br />
uuid            050d4e1f-eb58-4b5b-8902-d65999fa6bb3<br />
kernel          /boot/vmlinuz-2.6.31.6 root=UUID=050d4e1f-eb58-4b5b-8902-d65999fa6bb3 ro quiet splash<br />
initrd          /boot/initrd-newkernel.img.img</p></blockquote>
<p>　　上面uuid和root=后面的东西都是依照原来的menu画出来的，你可以参考自己的menu。</p>
<p>　　至此，系统编译完成，你可以reboot你的电脑了。$ reboot。重启后，选择你的系统进去，享受你的过程吧。利用$ uname -r查看你的版本号。</p>
<h3  class="related_post_title">你可能也感兴趣的文章：</h3><ul class="related_post"><li><a href="http://wangliping.net/tar_ubuntu" title="使用tar命令备份Ubuntu系统">使用tar命令备份Ubuntu系统</a></li><li><a href="http://wangliping.net/how-to-use-fdisk-in-linux" title="实例解说 fdisk 使用方法">实例解说 fdisk 使用方法</a></li><li><a href="http://wangliping.net/c-change-file-permission" title="C语言查看和更改文件的权限">C语言查看和更改文件的权限</a></li><li><a href="http://wangliping.net/source-insight-see-source-code" title="Source-Insight-看大规模大工程源代码">Source-Insight-看大规模大工程源代码</a></li><li><a href="http://wangliping.net/linux-android-x86-test-keyboard-mouse-touch-screen" title="Linux下测试键盘鼠标触摸屏触摸板">Linux下测试键盘鼠标触摸屏触摸板</a></li><li><a href="http://wangliping.net/linux_mem_info_watch" title="Linux内存信息查看相关">Linux内存信息查看相关</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://wangliping.net/make_linux_kernel_update/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
