<?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; initrd</title>
	<atom:link href="http://blog.myhnet.cn/tag/initrd/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.myhnet.cn</link>
	<description>秋湍泻石髓 风叶聚云根</description>
	<lastBuildDate>Wed, 28 Jul 2010 16:00:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>搞定PXE中的网卡驱动</title>
		<link>http://blog.myhnet.cn/2010/01/25/add-nic-driver-to-intrid-img-for-pxe/</link>
		<comments>http://blog.myhnet.cn/2010/01/25/add-nic-driver-to-intrid-img-for-pxe/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 11:59:55 +0000</pubDate>
		<dc:creator>myhnet</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[asus]]></category>
		<category><![CDATA[网络引导]]></category>
		<category><![CDATA[网卡驱动]]></category>
		<category><![CDATA[网卡支持]]></category>
		<category><![CDATA[driver]]></category>
		<category><![CDATA[initrd]]></category>
		<category><![CDATA[initrd.img]]></category>
		<category><![CDATA[nic]]></category>
		<category><![CDATA[nic adapter]]></category>
		<category><![CDATA[nic driver]]></category>
		<category><![CDATA[PXE]]></category>

		<guid isPermaLink="false">http://blog.myhnet.cn/?p=905</guid>
		<description><![CDATA[硬件： 主板ASUS P5QL Pro 软件： CentOS 5.4 64bit 公司最近进的一台机器用的是用的华硕p5ql pro的板子，要上centos系统，最开始没有注意到没有centos54居然不支持网卡驱动，等到PXE加载完，installation报找不到ks文件（我指定了ks的），我这才意识到，原来centos54并不支持这个网卡。。。 实在是不想刻碟，太麻烦，想起来原来赵小明老师跟我们讲过，这种情况，只要把网卡的驱动加载到启动用的initrd.img中就可以了，于是就开始看看怎么把驱动加载到启动文件当中。 首先，当然是要找一台机器把驱动编译好。 驱动可以在asus的官方网站可以下载到。 编译的机器，最好用没有升过级的内核，不然，不保证可以直接用。 编译好之后，可以得到一个名称为 atl1e.ko 的文件 这个，就是我们要用到的文件 接下来，才是重头戏，我们要把这个文件加入到initrd.img中。 开始之前，建议参考一下这篇文s档： http://www.ibm.com/developerworks/cn/linux/l-linux-netinst/index.html 如果你发现里面的那个脚本不能用，恭喜你，你碰到了跟我一样的问题了，我这篇文章的意义就在于此！ 使用file命令，我们可以知道initrd.img这个文件是一个gzip文件，那么，我们就要用gzip进行解压 mv initrd.img initrd.img.gzgunzip initrd.img.gz 再使用file命令，我们又可以得知，解压之后的文件，是一个cpio格式的文件，那么，我就可以用cpio来进行解压 cpio -ivmd &#60; initrd.img 解压之后，我们会得到许多目录与文件，因为我们要修改的只是驱动部分，所以要用到的就只有modules目录。 进入这个目录，我们只能看到五个文件 module-info&#160; modules.alias&#160; modules.cgz&#160; modules.dep&#160; pci.ids 其中module-info是记录硬件设备信息的，在这个文件里面，我们要添加如下三行 atl1e eth &#34;AR8121/AR8113 PCI-E Ethernet Adapter&#34; 其实的atl1e是模块名称，eth是设备类型(eth代表以太网卡)，第三行是模块的描述 然后就是第二个文件，modules.alias，在这个文件里面，我们只要添加一行 alias pci:v00001969d00001026sv*sd*bc*sc*i* atl1e 虽然只有一行，但是解释起来还是挺麻烦的。这里涉及到一些硬件相关的信息。 其1969是硬件厂商的信息，可以从http://www.pcidatabase.com/查到是Atheros Communications的产品，而1026是产品的编号，继续查询可以得知是AR8121/AR8113的芯片。 这些信息的得到，是比较麻烦的，当然，我用的是一张很老的debian的救援盘，然后用lspci [...]]]></description>
			<content:encoded><![CDATA[<p><strong>硬件：</strong><br />
主板ASUS P5QL Pro</p>
<p><strong>软件：</strong><br />
CentOS 5.4 64bit</p>
<p>公司最近进的一台机器用的是用的华硕p5ql pro的板子，要上centos系统，最开始没有注意到没有centos54居然不支持网卡驱动，等到PXE加载完，installation报找不到ks文件（我指定了ks的），我这才意识到，原来centos54并不支持这个网卡。。。</p>
<p>实在是不想刻碟，太麻烦，想起来原来赵小明老师跟我们讲过，这种情况，只要把网卡的驱动加载到启动用的initrd.img中就可以了，于是就开始看看怎么把驱动加载到启动文件当中。</p>
<p><strong>首先，当然是要找一台机器把驱动编译好。</strong><br />
驱动可以在asus的官方网站可以下载到。<br />
编译的机器，最好用没有升过级的内核，不然，不保证可以直接用。<br />
编译好之后，可以得到一个名称为<em> atl1e.ko </em>的文件<br />
这个，就是我们要用到的文件</p>
<p>接下来，才是重头戏，我们要把这个文件加入到initrd.img中。<br />
开始之前，建议参考一下这篇文s档： <a href="http://www.ibm.com/developerworks/cn/linux/l-linux-netinst/index.html" target="_blank">http://www.ibm.com/developerworks/cn/linux/l-linux-netinst/index.html</a><br />
如果你发现里面的那个脚本不能用，恭喜你，你碰到了跟我一样的问题了，我这篇文章的意义就在于此！</p>
<p>使用file命令，我们可以知道initrd.img这个文件是一个gzip文件，那么，我们就要用gzip进行解压</p>
<div class="hl-surround"><div class="hl-main">mv initrd.img initrd.img.gz<br />gunzip initrd.img.gz</div></div>
<p>再使用file命令，我们又可以得知，解压之后的文件，是一个cpio格式的文件，那么，我就可以用cpio来进行解压</p>
<div class="hl-surround"><div class="hl-main">cpio -ivmd &lt; initrd.img</div></div>
<p>解压之后，我们会得到许多目录与文件，因为我们要修改的只是驱动部分，所以要用到的就只有modules目录。</p>
<p>进入这个目录，我们只能看到五个文件</p>
<div class="hl-surround"><div class="hl-main">module-info&nbsp; modules.alias&nbsp; modules.cgz&nbsp; modules.dep&nbsp; pci.ids</div></div>
<p>其中<em>module-info</em>是记录硬件设备信息的，在这个文件里面，我们要添加如下三行</p>
<div class="hl-surround"><div class="hl-main">atl1e<br />	eth<br />	&quot;AR8121/AR8113 PCI-E Ethernet Adapter&quot;</div></div>
<p>其实的<em>atl1e</em>是模块名称，<em>eth</em>是设备类型(eth代表以太网卡)，第三行是模块的描述</p>
<p>然后就是第二个文件，<em>modules.alias</em>，在这个文件里面，我们只要添加一行</p>
<div class="hl-surround"><div class="hl-main">alias pci:v00001969d00001026sv*sd*bc*sc*i* atl1e</div></div>
<p>虽然只有一行，但是解释起来还是挺麻烦的。这里涉及到一些硬件相关的信息。<br />
其1969是硬件厂商的信息，可以从<a href="http://www.pcidatabase.com/" target="_blank">http://www.pcidatabase.com/</a>查到是Atheros Communications的产品，而1026是产品的编号，继续查询可以得知是AR8121/AR8113的芯片。<br />
这些信息的得到，是比较麻烦的，当然，我用的是一张很老的debian的救援盘，然后用lspci -n得到这些数据的</p>
<p>其他的，<em>sv,sd,sc,i</em>等等我也搞不太清楚是什么意思，我反正照着r8169的抄。你可以看看这篇文章：<a href="http://www.examda.com/linux/fudao/20091227/094826740-3.html" target="_blank">http://www.examda.com/linux/fudao/20091227/094826740-3.html</a>。</p>
<p>接下来，我们跳过<em>modules.cgz</em>，讲讲<em>modules.dep</em>。<br />
这是一个描述模块之间的依赖关系的文件，因为在这块网卡的驱动中没有找到相关的依赖说明，所以我就没有修改此文件。</p>
<p><em>pci.ids</em>这个文件，是modules目录里面，我们要修改的第二重要的文件<br />
在这个文件里面，我们要添加网卡的对应关系，要添加如下两行：</p>
<div class="hl-surround"><div class="hl-main">1969&nbsp; Atheros(R)<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;1026&nbsp; AR8121/AR8113 PCI-E Ethernet Adapter</div></div>
<p><font color=red>记得这两行的写法有一个从属关系，1026是从属于1969的</font></p>
<p>最后，让我们来说说<em>modules.cgz</em>，通过file命令，我们又可以得知到，这是一个gzip文件，同样，我们要进行解压：</p>
<div class="hl-surround"><div class="hl-main">mv modules.cgz modules.cgz.gz<br />gunzipmodules.cgz.gz</div></div>
<p>新到的新的<em>modules.cgz</em>，又是一个cpio文件，我们又要用cpio来进行解压</p>
<div class="hl-surround"><div class="hl-main">cpio -ivmd &lt; modules</div></div>
<p>之后，就会得到2.6.18-164.el5这么一个目录，把我们开始得到的<em>atl1e.ko</em>文件拷贝到其中的<em>2.6.18-164.el5/x86_64/</em>目录中（其中还有其他许多ko文件）。</p>
<p>所有的工作都做得差不多了，接下来就是要进行封装了。<br />
首先是封装modules.cgz</p>
<div class="hl-surround"><div class="hl-main">find 2.6.18-164.el5/|cpio&nbsp; -o -H crc &gt; newmodules<br />gzip newmodules<br />rm -rf 2.6.18-164.el5 modules<br />mv newmodules.gz modules.cgz</div></div>
<p>这里要注意的是把旧的文件modules.cgz文件与解压生成的目录删除以减少体积</p>
<p>这里封装好之后，我们要封装整个intrid.img文件了。</p>
<div class="hl-surround"><div class="hl-main">rm -f initrd.img vmlinuz<br />find . | cpio -c -o &gt; ../new<br />gzip ../new<br />mv ../new.gz initrd.img</div></div>
<p>同上面的一样，要把一些与intrid.img不相干的文件文件删除以减少体积。</p>
<p>这个时候所有的东西时都管弄完了，你再用这个新生成的initrd.img进行引导，就可以正确的识别你的网卡并从网络读取文件了。</p>
<p><font color=red><strong>最后要注意的是：</strong></font><br />
装好的系统并不能使用这块网卡，装好系统之后，还是要进行网卡的编译。<br />
当然，你也可以学我的，在kickstart文件当中，用%post来完成网卡的编译</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.myhnet.cn/2010/01/25/add-nic-driver-to-intrid-img-for-pxe/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用cpio解压initrd.img[转]</title>
		<link>http://blog.myhnet.cn/2009/05/03/unpack-initrd-img-with-cpio/</link>
		<comments>http://blog.myhnet.cn/2009/05/03/unpack-initrd-img-with-cpio/#comments</comments>
		<pubDate>Sun, 03 May 2009 11:15:05 +0000</pubDate>
		<dc:creator>myhnet</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[cpio]]></category>
		<category><![CDATA[img]]></category>
		<category><![CDATA[initrd]]></category>
		<category><![CDATA[initrd.img]]></category>
		<category><![CDATA[内核]]></category>
		<category><![CDATA[启动]]></category>

		<guid isPermaLink="false">http://blog.myhnet.cn/?p=804</guid>
		<description><![CDATA[2.6内核中的initrd.img采用cpio压缩，不再是2.4内核使用的ext2格式，无法使用mount -o loop 挂载。需要使用gunzip解压缩，然后再使用cpio解包 cp /boot/initrd-2.6.18-8.1.15.el5.img initrd.img.gzgunzip initrd.img.gzmkdir initrdmv initrd.img initrdcd initrdcpio -ivmd &#60; initrd.img 通过以上命令就将initrd.img解压了，现在就可以对其进行编辑，完成后使用以下命令重新压制 find . &#124; cpio -cv &#62; ../initrd.new.imggzip ../initrd.new.img 再将其改名拷贝至/boot目录，重启就可以观察修改后的效果 IBM Linux社区的一篇强贴http://www.ibm.com/developerworks/cn/linux/l-k26initrd/ 还有另外一篇，可以参考（里面的那个脚本现在好像已经不能用了） http://www.ibm.com/developerworks/cn/linux/l-linux-netinst/index.html 本文来源：http://www.wardking.com/blog/read.php/250.htm]]></description>
			<content:encoded><![CDATA[<p>2.6内核中的initrd.img采用cpio压缩，不再是2.4内核使用的ext2格式，无法使用mount -o loop 挂载。需要使用gunzip解压缩，然后再使用cpio解包</p>
<div class="hl-surround"><div class="hl-main">cp /boot/initrd-2.6.18-8.1.15.el5.img initrd.img.gz<br />gunzip initrd.img.gz<br />mkdir initrd<br />mv initrd.img initrd<br />cd initrd<br />cpio -ivmd &lt; initrd.img</div></div>
<p>通过以上命令就将initrd.img解压了，现在就可以对其进行编辑，完成后使用以下命令重新压制</p>
<div class="hl-surround"><div class="hl-main">find . | cpio -cv &gt; ../initrd.new.img<br />gzip ../initrd.new.img</div></div>
<p>再将其改名拷贝至/boot目录，重启就可以观察修改后的效果</p>
<p>IBM Linux社区的一篇强贴<a href="http://www.ibm.com/developerworks/cn/linux/l-k26initrd/">http://www.ibm.com/developerworks/cn/linux/l-k26initrd/</a></p>
<p>还有另外一篇，可以参考（里面的那个脚本现在好像已经不能用了）<br />
<a href="http://www.ibm.com/developerworks/cn/linux/l-linux-netinst/index.html">http://www.ibm.com/developerworks/cn/linux/l-linux-netinst/index.html</a></p>
<p><strong>本文来源：</strong><a href="http://www.wardking.com/blog/read.php/250.htm">http://www.wardking.com/blog/read.php/250.htm</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.myhnet.cn/2009/05/03/unpack-initrd-img-with-cpio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
