定制CentOS 5.5精简版操作系统(支持 Logic MegaRAID SAS 1078驱动)

CentOS 5.5操作系统本来不支持 Logic MegaRAID SAS 1078驱动,安装UIT ContEx 1800时会找不到小盘安装系统,现特制定支持此raid卡的镜像系统盘,直接在isolinux.cfg中dd=cdrom:/raid驱动.img文件,提示选择设备驱动器,没有达到自动安装的目的,现改变方式来制作镜像盘,总结大致需要二步走,第一步,把驱动导入到initrd.img文件中,第二步,需要编辑ks.cfg的kickstart文件,将驱动文件中的.ko文件导入到/lib/modules/`uname -r`/updates/目录下,,mkinitrd来实现,具体步骤如下:

1、挂载光驱mount /dev/cdrom /mnt

2、创建临时目录mkdir -p /root/iso/CentOS

3、提取需要的RPM包,正常安装好操作系统在/root目录下会有install.log文件,这个就是操作系统安装RPM包的记录,我们从这些记录中,将所需的RPM包从/mnt/CentOS中复制到/root/iso/CentOS里面去#!/bin/bashcd /rootawk ‘/Installing/{print $2}’ install.log | sed ‘s/^[0-9]*://g’ >package.txtDVD=’/mnt/CentOS’ PACKDIR=’/root/package.txt’ NEW_DVD=’/root/iso/CentOS/’ while read LINEdocp ${DVD}/${LINE}*.rpm /${NEW_DVD} || echo “$LINE don’t cp…….”done < package.txtrm -f package.txt

4、把原镜像除了CentOS目录外的文件全部复制至/root/iso目录下rsync -av –exclude=CentOS /mnt/ /root/iso

5、解开initrd.img文件(file /root/iso/isolinux/initrd.img查看是gzip文件)mkdir /tmp/initrdcd /tmp/initrdgzip -dc /root/iso/isolinux/initrd.img | cpio -ivdcd modulesgzip -dc modules.cgz | cpio -ivd

modules子目录中的modules.cgz是经过gzip压缩过的cpio包,将其解开。

6、解压raid卡驱动文件megasr-15.00.0120.2012-1-rhel50-U5-64.img文件(file megasr-15.00.0120.2012-1-rhel50-U5-64.img是dos软盘文件)mkdir /tmp/megasrmount -o loop /root/megasr-15.00.0120.2012-1-rhel50-U5-64.img /mediacp /media/* /tmp/megasrcd /tmp/megasr/gzip -dc modules.cgz | cpio -ivdcp 2.6.18-194.el5/megasr.ko /tmp/initrd/modules/2.6.18-194.el5/x86_64/cat modules.alias >> /tmp/initrd/modules/modules.alias

7、生成新的initrd.img文件就像我们以前所做的,修改了源码包中的内容就势必再次打包恢复,这里我们需要把修改过的内容打包成一个initrd.img文件,不过这里要注意打包时的压缩格式,modules.cgz文件用的是crc格式,而initrd.img文件用的是newc格式,命令参数不要弄错。cd /tmp/initrd/modulesfind 2.6.18-53.el5 | cpio -o -H crc | gzip -9 > modules.cgzrm -rf 2.6.18-53.el5cd ..find . | cpio -o -H newc | gzip -9 > /tmp/initrd.img

8、将打包好的initrd.img文件复制到 /root/iso/isolinux 目录cp /tmp/initrd.img /root/iso/isolinux

9、在/root/iso目录下,并根据自己实际需要修改安装要求编辑ks.cfg文件

# Kickstart file automatically generated by anaconda.

installcdromlang en_US.UTF-8langsupport –default=en_AU.UTF-8 en_US.UTF-8 zh_CN.UTF-8 zh_HK.UTF-8 zh_CN.UTF-8 zh_SG.UTF-8 zh_TW.UTF-8 en_AU.UTF-8keyboard us# Network informationnetwork –device=eth0 –bootproto=dhcp –onboot=on rootpw 123456.authconfig –enableshadow –enablemd5firewall –disabledselinux –disabledtimezone Asia/Shanghaibootloader –location=mbr# The following is the partition information you requested# Note that any partitions you deleted are not expressed# here so unless you clear all partitions first, this is# not guaranteed to workclearpart –all –drives=sda# part /boot –fstype ext3 –size=200# part swap –size=8196# part / –fstype ext3 –size=50000# part /movies –fstype ext3 –size=100 –grow# Reboot after installationreboot%packages@base@chinese-support@core@development-libs@development-tools@dialup@editors@ftp-server@legacy-network-server@legacy-software-development@legacy-software-support@server-cfg@system-tools@text-internetkeyutilstrousersfipscheckdevice-mapper-multipathperl-Convert-ASN1imakelsscsiauditnet-snmp-utilssysstatiptrafdstatexpectMegaCligfs-utilsgfs2-utilsOpenIPMI-tools

%post –nochroot

# Mount CDROMmkdir -p /mnt/cdrommount -r -t iso9660 /tmp/cdrom /mnt/cdrom

# Copy our raid driver filecp /mnt/cdrom/Custom/megasr.ko /mnt/sysimage/lib/modules/2.6.18-194.el5/updates/

# Copy our custom filecp /mnt/cdrom/Custom/nload-0.7.4.tar.gz /mnt/sysimage/tmp/nload-0.7.4.tar.gz > /dev/null

# Uncompress our custom filecd /mnt/sysimage/tmptar -zxvf nload-0.7.4.tar.gz > /dev/null

# Mount CDROMumount /mnt/cdrom

%post

#support megasr driverecho “alias scsi_hostadapter megasr” >> /etc/modprobe.confdepmod -v 2.6.18-194.el5mv /boot/initrd-2.6.18-194.el5.img /boot/initrd-2.6.18-194.el5.img.bakmkinitrd –with=megasr /boot/initrd-2.6.18-194.el5.img 2.6.18-194.el5

# Install custom filecd /tmp/nload-0.7.4./configure > /dev/null 2>&1make > /dev/null 2>&1make install > /dev/null 2>&1rm -rf /tmp/* > /dev/null 2>&1

# System settingecho “alias ipv6 off” >> /etc/modprobe.confecho “alias net-pf-10 off” >> /etc/modprobe.conf

# Stop some not usually use service

for service in NetworkManager NetworkManagerDispatcher acpid anacron apmd atd auditd autofs bluetooth conman cpuspeed cups dc_client dc_server dhcdbd dund firstboot gpm haldaemon hidd ip6tables irda irqbalance lm_sensors lvm2-monitor mcstrans mdmonitor mdmpd messagebus microcode_ctl netconsole netfs netplugd nfslock nscd ntpd pand pcscd portmap psacct rdisc readahead_early readahead_later restorecond rhnsd rpcgssd rpcidmapd rpcsvcgssd saslauthd smartd snmptrapd wpa_supplicant ypbinddo chkconfig –level 35 $service offdone

# Start some ususally use service

for service in ipmi cronddo chkconfig –level 35 $service ondone

eject

生命不息,在任何一种博大的辉煌之后,都掩藏着许多鲜为人知的艰难的奋斗。

定制CentOS 5.5精简版操作系统(支持 Logic MegaRAID SAS 1078驱动)

相关文章:

你感兴趣的文章:

标签云: