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

态度决定高度

英语,沟通,rhca,管理

 
 
 

日志

 
 

定制安装光盘里面的initrd.img文件,以支持新驱动  

2012-07-17 11:47:49|  分类: linux |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
To update the initrd.img to load additional drivers early in the boot process, normally you would simply run /sbin/mkinitrd and let the script do the work, and you can use the command line options --preload=module and --with=module to force it to load a certain module before or after the SCSI drivers respectively.

However, if you need to modify the initrd.img used during the installation of Red Hat Enterprise Linux (found in isolinux/initrd.img and images/pxeboot/initrd.img on the CD or DVD), it may be easier to modify the image by hand.  Below are instructions to accomplish this.

As an example, let's use Red Hat Enterprise Linux 5.1 i386 and add the ide-cs.ko driver to the initrd.img to support PCMCIA devices during installation.  (This was fixed in Red Hat Enterprise Linux 5.3.)

First, we need to get the ide-cs.ko module from the kernel package.  Assuming the Red Hat Enterprise Linux 5.1 DVD is mounted on /mnt/cdrom, let's extract the files from the kernel RPM.

mkdir /tmp/2.6.18-53.el5
cd /tmp/2.6.18-53.el5
rpm2cpio /mnt/cdrom/Server/kernel-2.6.18-53.el5.i686.rpm | cpio -ivd
ls /tmp/2.6.18-53.el5/lib/modules/2.6.18-53.el5/kernel/drivers/ide/legacy/ide-cs.ko

Next we'll extract the initrd.img from the DVD.  The initrd.img is a gzip'ed cpio archive.


mkdir /tmp/initrd
cd /tmp/initrd
gzip -dc /mnt/cdrom/isolinux/initrd.img | cpio -ivd

In the modules/ subdirectory, you'll see modules.cgz which is yet another gzip'ed cpio archive.  Let's extract it next.


cd /tmp/initrd/modules
gzip -dc modules.cgz | cpio -ivd

Now we can copy the ide-cs.ko module from the kernel into our custom initrd.img.  We also need to update the modules.alias file so Anaconda (the installation program for Red Hat Enterprise Linux) knows which hardware devices need the ide-cs.ko module.  Some drivers may also need the module-info, modules.dep, and pci.ids files updated too.  For more information on these files, see How do I manually update a Driver Update Disk?

cd /tmp/initrd/modules
cp /tmp/2.6.18-53.el5/lib/modules/2.6.18-53.el5/kernel/drivers/ide/legacy/ide-cs.ko 2.6.18-53.el5/i686/
modinfo -F alias 2.6.18-53.el5/i686/ide-cs.ko | sed -e 's/^/alias /' -e 's/$/ ide-cs/' >> modules.alias

Finally, we can package everything back up into our new custom initrd.img.  Be careful when creating the cpio archives because the modules.cgz file uses the crc format whereas initrd.img uses the newc format!  If you use the wrong format, the installation will not be able to read the initrd.img.


cd /tmp/initrd/modules
find 2.6.18-53.el5 | cpio -o -H crc | gzip -9 > modules.cgz
rm -fr 2.6.18-53.el5
cd ..
find . | cpio -o -H newc | gzip -9 > /tmp/initrd.img

Now copy your new /tmp/initrd.img onto your PXE boot server, or burn a new installation DVD with this replacement initrd.img.

  评论这张
 
阅读(1135)| 评论(0)
推荐 转载

历史上的今天

评论

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

页脚

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