Welcome 微信登录

首页 / 操作系统 / Linux / 定制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 /mnt2、创建临时目录
mkdir -p /root/iso/CentOS3、提取需要的RPM包,正常安装好操作系统在/root目录下会有install.log文件,这个就是操作系统安装RPM包的记录,我们从这些记录中,将所需的RPM包从/mnt/CentOS中复制到/root/iso/CentOS里面去
 
#!/bin/bash
cd /root
awk "/Installing/{print $2}" install.log | sed "s/^[0-9]*://g" >package.txt
DVD="/mnt/CentOS"
PACKDIR="/root/package.txt"
NEW_DVD="/root/iso/CentOS/"
while read LINE
do
cp ${DVD}/${LINE}*.rpm /${NEW_DVD} || echo "$LINE don"t cp......."
done < package.txt
rm -f package.txt4、把原镜像除了CentOS目录外的文件全部复制至/root/iso目录下
rsync -av --exclude=CentOS /mnt/  /root/iso5、解开initrd.img文件(file /root/iso/isolinux/initrd.img查看是gzip文件)
mkdir /tmp/initrd
cd /tmp/initrd
gzip -dc /root/iso/isolinux/initrd.img | cpio -ivd
cd modules
gzip -dc modules.cgz | cpio -ivdmodules子目录中的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/megasr
mount -o loop /root/megasr-15.00.0120.2012-1-rhel50-U5-64.img /media
cp /media/*  /tmp/megasr
cd /tmp/megasr/
gzip -dc modules.cgz | cpio -ivd
cp 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/modules
find 2.6.18-53.el5 | cpio -o -H crc | gzip -9 > modules.cgz
rm -rf 2.6.18-53.el5
cd ..
find . | cpio -o -H newc | gzip -9 > /tmp/initrd.img8、将打包好的initrd.img文件复制到 /root/iso/isolinux 目录
cp /tmp/initrd.img /root/iso/isolinux9、在/root/iso目录下,并根据自己实际需要修改安装要求编辑ks.cfg文件# Kickstart file automatically generated by anaconda.install
cdrom
lang en_US.UTF-8
langsupport --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-8
keyboard us
# Network information
network --device=eth0  --bootproto=dhcp  --onboot=on
rootpw 123456.
authconfig --enableshadow --enablemd5
firewall --disabled
selinux --disabled
timezone Asia/Shanghai
bootloader --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 work
clearpart --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 installation
reboot
%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-internet
keyutils
trousers
fipscheck
device-mapper-multipath
perl-Convert-ASN1
imake
lsscsi
audit
net-snmp-utils
sysstat
iptraf
dstat
expect
MegaCli
gfs-utils
gfs2-utils
OpenIPMI-tools%post --nochroot# Mount CDROM
mkdir -p /mnt/cdrom
mount -r -t iso9660 /tmp/cdrom /mnt/cdrom# Copy our raid driver file
cp /mnt/cdrom/Custom/megasr.ko /mnt/sysimage/lib/modules/2.6.18-194.el5/updates/# Copy our custom file
cp /mnt/cdrom/Custom/nload-0.7.4.tar.gz /mnt/sysimage/tmp/nload-0.7.4.tar.gz > /dev/null# Uncompress our custom file
cd /mnt/sysimage/tmp
tar -zxvf nload-0.7.4.tar.gz > /dev/null# Mount CDROM
umount /mnt/cdrom%post#support megasr driver
echo "alias scsi_hostadapter megasr" >> /etc/modprobe.conf
depmod -v 2.6.18-194.el5
mv /boot/initrd-2.6.18-194.el5.img /boot/initrd-2.6.18-194.el5.img.bak
mkinitrd --with=megasr /boot/initrd-2.6.18-194.el5.img 2.6.18-194.el5# Install custom file
cd /tmp/nload-0.7.4
./configure > /dev/null 2>&1
make > /dev/null 2>&1
make install > /dev/null 2>&1
rm -rf /tmp/* > /dev/null 2>&1# System setting
echo "alias ipv6 off" >> /etc/modprobe.conf
echo "alias net-pf-10 off" >> /etc/modprobe.conf# Stop some not usually use servicefor 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 ypbind
do
   chkconfig --level 35 $service off
done# Start some ususally use servicefor service in ipmi crond
do
   chkconfig --level 35 $service on
doneeject
  • 1
  • 2
  • 下一页
Linux中的随机数文件 /dev/random /dev/urandom解决Ubunut下Cacti不出图的问题相关资讯      CentOS教程 
  • CentOS上使用Dropbox  (02/07/2013 09:11:47)
  • CentOS 网络设置修改  (02/04/2013 21:28:42)
  • CentOS如何安装whois命令  (01/20/2013 14:33:29)
  • CentOS 下修改/dev/shm 大小解决  (02/04/2013 21:30:15)
  • CentOS 注销在线用户, Linux 注销  (02/04/2013 21:24:06)
  • CentOS安装完重启后不能进入终端  (01/02/2013 16:04:02)
本文评论 查看全部评论 (0)
表情: 姓名: 字数
版权所有©石家庄振强科技有限公司2024 冀ICP备08103738号-5 网站地图