====== 50 CentOS5.7 ドライバ組み込み ======
CentOS 5.7 のインストールCDにBCM57810 10 Gigabit Ethernetのドライバを組み込んだ時のメモ
===== CDの内容をコピーする =====
# mkdir /mnt/work/old_cdrom
# mkdir /tmp/work/new_cdrom
# mount t iso9660 -o loop CentOS-5.7-x86_64-netinstall.iso /mnt/work/old_cdrom
# rsync -av /mnt/work/old_cdrom/ /tmp/work/new_cdrom/
# umount /mnt/work/old_cdrom/
===== initrb.imgを展開 =====
# cp /tmp/work/new_cdrom/isolinux/
# mkdir initrd_work
# cd initrd_work
# gunzip -c ../initrd.img |cpio -i
# ll /tmp/work/new_cdrom/isolinux/initrd_work
total 36
lrwxrwxrwx 1 root root 4 May 17 13:29 bin -> sbin
drwxr-xr-x 2 root root 4096 May 17 13:29 dev
drwxr-xr-x 3 root root 4096 May 17 13:29 etc
lrwxrwxrwx 1 root root 10 May 17 13:29 init -> /sbin/init
drwxr-xr-x 2 root root 4096 May 17 13:29 modules
drwxr-xr-x 2 root root 4096 May 17 13:29 proc
drwxr-xr-x 2 root root 4096 May 17 13:29 sbin
drwxr-xr-x 2 root root 4096 May 17 13:29 selinux
drwxr-xr-x 2 root root 4096 May 17 13:29 sys
drwxr-xr-x 2 root root 4096 May 17 13:29 tmp
drwxr-xr-x 6 root root 4096 May 17 13:29 var
===== rpmからドライバを取り出す =====
# mkdir /tmp/work_driver
# cd /tmp/work_driver
# rpm2cpio ../kmod-hp-netxtreme2-7.4.25-2.x86_64.rpm |cpio -i
# ll /tmp/work_driver/lib/modules/2.6.18-274.el5/extra/hp-netxtreme2/bnx2x.ko
-rw-r--r-- 1 root root 7033068 May 17 13:39 /tmp/work_driver/lib/modules/2.6.18-274.el5/extra/hp-netxtreme2/bnx2x.ko
===== ドライバモジュールをフォルダに入れて、再度固める =====
# cd /tmp/work/new_cdrom/isolinux/initrd_work/modules
# mkdir unpacked
# cd unpacked
# gunzip -c ../modules.cgz |cpio -id
# cp /tmp/work_driver/lib/modules/2.6.18-274.el5/extra/hp-netxtreme2/bnx2x.ko /tmp/work/new_cdrom/isolinux/initrd_work/modules/2.6.18-274.el5/x86_64/bnx2x.ko
# find 2.6.18-274.el5 | cpio -ov -H crc | gzip > ../modules.cgz
# cd .. && rm -rf unpacked
===== modules.aliasを修正 =====
# modinfo /tmp/work/new_cdrom/isolinux/initrd_work/modules/2.6.18-274.el5/x86_64/bnx2x.ko
alias: pci:v000014E4d000016ABsv*sd*bc*sc*i*
alias: pci:v000014E4d0000168Dsv*sd*bc*sc*i*
alias: pci:v000014E4d000016AEsv*sd*bc*sc*i*
alias: pci:v000014E4d0000168Esv*sd*bc*sc*i*
alias: pci:v000014E4d000016A5sv*sd*bc*sc*i*
alias: pci:v000014E4d0000168Asv*sd*bc*sc*i*
alias: pci:v000014E4d00001663sv*sd*bc*sc*i*
alias: pci:v000014E4d00001662sv*sd*bc*sc*i*
alias: pci:v000014E4d00001650sv*sd*bc*sc*i*
alias: pci:v000014E4d0000164Fsv*sd*bc*sc*i*
alias: pci:v000014E4d0000164Esv*sd*bc*sc*i*
# cd /tmp/work/new_cdrom/isolinux/initrd_work/modules/
# vi modules.alias
-------- 下記のようにして一番したに記述する ---------
alias pci:v000014E4d000016ABsv*sd*bc*sc*i* bnx2x
alias pci:v000014E4d0000168Dsv*sd*bc*sc*i* bnx2x
alias pci:v000014E4d000016AEsv*sd*bc*sc*i* bnx2x
alias pci:v000014E4d0000168Esv*sd*bc*sc*i* bnx2x
alias pci:v000014E4d000016A5sv*sd*bc*sc*i* bnx2x
alias pci:v000014E4d0000168Asv*sd*bc*sc*i* bnx2x
alias pci:v000014E4d00001663sv*sd*bc*sc*i* bnx2x
alias pci:v000014E4d00001662sv*sd*bc*sc*i* bnx2x
alias pci:v000014E4d00001650sv*sd*bc*sc*i* bnx2x
alias pci:v000014E4d0000164Fsv*sd*bc*sc*i* bnx2x
alias pci:v000014E4d0000164Esv*sd*bc*sc*i* bnx2x
===== modules.depa入って無ければ、下記追加 =====
bnx2x: 8021q mdio
===== initrd.imgをまた固める =====
# cd /tmp/work/new_cdrom/isolinux/initrd_work
# (find . | cpio --quiet -c -o) > ../initrd.img
# cd .. && rm -rf initrd_work
# gzip initrd.img && mv initrd.img.gz initrd.img
===== isoイメージにする。 =====
# cd /tmp/work/new_cdrom/
# mkisofs -o ../CentOS-5.7-x86_64_NEW.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -R -T .