1 拷贝/home/initramfs-3.10.0-123.el7.x86_64.img到/home/images下
/usr/lib/dracut/skipcpio /home/images/initramfs-3.10.0-123.el7.x86_64.img | gunzip -c | cpio -i -d
2 解压后的目录情况
bin dev etc init lib lib64 proc root run sbin shutdown sys sysroot tmp usr var
3 查看modules.dep文件
cat usr/lib/modules/3.10.0-123.el7.x86_64/modules.dep
kernel/fs/xfs/xfs.ko: kernel/lib/libcrc32c.ko
kernel/crypto/crct10dif_common.ko:
kernel/drivers/video/sysfillrect.ko:
kernel/drivers/video/syscopyarea.ko:
kernel/drivers/video/sysimgblt.ko:
kernel/drivers/gpu/drm/drm_kms_helper.ko: kernel/drivers/gpu/drm/drm.ko kernel/drivers/i2c/i2c-core.ko
kernel/drivers/gpu/drm/drm.ko: kernel/drivers/i2c/i2c-core.ko
kernel/drivers/gpu/drm/ttm/ttm.ko: kernel/drivers/gpu/drm/drm.ko kernel/drivers/i2c/i2c-core.ko
kernel/drivers/gpu/drm/mgag200/mgag200.ko: kernel/drivers/video/syscopyarea.ko kernel/drivers/video/sysfillrect.ko kernel/drivers/video/sysimgblt.ko kernel/drivers/i2c/algos/i2c-algo-bit.ko kernel/drivers/gpu/drm/drm_kms_helper.ko kernel/drivers/gpu/drm/ttm/ttm.ko kernel/drivers/gpu/drm/drm.ko kernel/drivers/i2c/i2c-core.ko
kernel/drivers/scsi/raid_class.ko:
kernel/drivers/scsi/scsi_transport_sas.ko:
kernel/drivers/scsi/mpt2sas/mpt2sas.ko: kernel/drivers/scsi/raid_class.ko kernel/drivers/scsi/scsi_transport_sas.ko
kernel/drivers/scsi/sd_mod.ko: kernel/lib/crc-t10dif.ko kernel/crypto/crct10dif_common.ko
kernel/drivers/scsi/sr_mod.ko: kernel/drivers/cdrom/cdrom.ko
kernel/drivers/net/ethernet/intel/e1000e/e1000e.ko: kernel/drivers/ptp/ptp.ko kernel/drivers/pps/pps_core.ko
kernel/drivers/net/tun.ko:
kernel/drivers/cdrom/cdrom.ko:
kernel/drivers/i2c/algos/i2c-algo-bit.ko: kernel/drivers/i2c/i2c-core.ko
kernel/drivers/i2c/i2c-core.ko:
kernel/drivers/md/dm-mod.ko:
kernel/drivers/ata/libata.ko:
kernel/drivers/ata/ahci.ko: kernel/drivers/ata/libahci.ko kernel/drivers/ata/libata.ko
kernel/drivers/ata/libahci.ko: kernel/drivers/ata/libata.ko
kernel/drivers/ata/ata_piix.ko: kernel/drivers/ata/libata.ko
kernel/drivers/pps/pps_core.ko:
kernel/drivers/ptp/ptp.ko: kernel/drivers/pps/pps_core.kokernel/drivers/net/ethernet/intel/e1000e/e1000e.ko: kernel/drivers/ptp/ptp.ko kernel/drivers/pps/pps_core.ko
kernel/net/802/stp.ko: kernel/net/llc/llc.ko
kernel/net/llc/llc.ko:
kernel/net/bridge/bridge.ko: kernel/net/802/stp.ko kernel/net/llc/llc.ko
kernel/lib/crc-t10dif.ko: kernel/crypto/crct10dif_common.ko
kernel/lib/libcrc32c.ko:
在usr/lib/modules/3.10.0-123.el7.x86_64/modules.dep文件中有e1000e驱动的加载
4 删除kernel/drivers/net/ethernet/intel/e1000e/e1000e.ko: kernel/drivers/ptp/ptp.ko kernel/drivers/pps/pps_core.ko这一行
5 删除e1000e 驱动
rm -rf usr/lib/modules/3.10.0-123.el7.x86_64/kernel/drivers/net/ethernet/intel/e1000e/e1000e.ko
6 增加igb驱动
把kernel/drivers/net/ethernet/intel/igb/igb.ko: kernel/drivers/ptp/ptp.ko kernel/drivers/pps/pps_core.ko kernel/drivers/i2c/algos/i2c-algo-bit.ko kernel/drivers/dca/dca.ko kernel/drivers/i2c/i2c-core.ko
这一行添加到usr/lib/modules/3.10.0-123.el7.x86_64/modules.dep
cat usr/lib/modules/3.10.0-123.el7.x86_64/modules.dep
kernel/fs/xfs/xfs.ko: kernel/lib/libcrc32c.ko
kernel/crypto/crct10dif_common.ko:
kernel/drivers/video/sysfillrect.ko:
kernel/drivers/video/syscopyarea.ko:
kernel/drivers/video/sysimgblt.ko:
kernel/drivers/gpu/drm/drm_kms_helper.ko: kernel/drivers/gpu/drm/drm.ko kernel/drivers/i2c/i2c-core.ko
kernel/drivers/gpu/drm/drm.ko: kernel/drivers/i2c/i2c-core.ko
kernel/drivers/gpu/drm/ttm/ttm.ko: kernel/drivers/gpu/drm/drm.ko kernel/drivers/i2c/i2c-core.ko
kernel/drivers/gpu/drm/mgag200/mgag200.ko: kernel/drivers/video/syscopyarea.ko kernel/drivers/video/sysfillrect.ko kernel/drivers/video/sysimgblt.ko kernel/drivers/i2c/algos/i2c-algo-bit.ko kernel/drivers/gpu/drm/drm_kms_helper.ko kernel/drivers/gpu/drm/ttm/ttm.ko kernel/drivers/gpu/drm/drm.ko kernel/drivers/i2c/i2c-core.ko
kernel/drivers/scsi/raid_class.ko:
kernel/drivers/scsi/scsi_transport_sas.ko:
kernel/drivers/scsi/mpt2sas/mpt2sas.ko: kernel/drivers/scsi/raid_class.ko kernel/drivers/scsi/scsi_transport_sas.ko
kernel/drivers/scsi/sd_mod.ko: kernel/lib/crc-t10dif.ko kernel/crypto/crct10dif_common.ko
kernel/drivers/scsi/sr_mod.ko: kernel/drivers/cdrom/cdrom.ko
kernel/drivers/net/ethernet/intel/igb/igb.ko: kernel/drivers/ptp/ptp.ko kernel/drivers/pps/pps_core.ko kernel/drivers/i2c/algos/i2c-algo-bit.ko kernel/drivers/dca/dca.ko kernel/drivers/i2c/i2c-core.ko
kernel/drivers/net/tun.ko:
kernel/drivers/cdrom/cdrom.ko:
kernel/drivers/i2c/algos/i2c-algo-bit.ko: kernel/drivers/i2c/i2c-core.ko
kernel/drivers/i2c/i2c-core.ko:
kernel/drivers/md/dm-mod.ko:
kernel/drivers/ata/libata.ko:
kernel/drivers/ata/ahci.ko: kernel/drivers/ata/libahci.ko kernel/drivers/ata/libata.ko
kernel/drivers/ata/libahci.ko: kernel/drivers/ata/libata.ko
kernel/drivers/ata/ata_piix.ko: kernel/drivers/ata/libata.ko
kernel/drivers/pps/pps_core.ko:
kernel/drivers/ptp/ptp.ko: kernel/drivers/pps/pps_core.ko
kernel/net/802/stp.ko: kernel/net/llc/llc.ko
kernel/net/llc/llc.ko:
kernel/net/bridge/bridge.ko: kernel/net/802/stp.ko kernel/net/llc/llc.ko
kernel/lib/crc-t10dif.ko: kernel/crypto/crct10dif_common.ko
kernel/lib/libcrc32c.ko:
把igb.ko 和dca.ko 分别添加到
usr/lib/modules/3.10.0-123.el7.x86_64/kernel/drivers/net/ethernet/intel/igb/
usr/lib/modules/3.10.0-123.el7.x86_64/kernel/drivers/dca/
这两个文件中
7 重新压缩img文件
find . | cpio -o -H newc | gzip -9 > /home/initramfs-3.10.0-123.el7.x86_64.img
8 把initramfs-3.10.0-123.el7.x86_64.img拷贝到/boot目录
9 重新生成grub文件
grub2-mkconfig -o /boot/grub2/grub.cfg