0
点赞
收藏
分享

微信扫一扫

Centos7.3编译RAID驱动(一)

本次实验,通过使用安装了自定义内核4.18.202的​Centos7.3系统在Lenovo SR650服务器,RAID阵列卡为940-8i中测试兼容性,进入安装界面发现找不到磁盘。

Centos7.3编译RAID驱动(一)_centos

解决方法

我们就需要下载940-8i的驱动,首先查一下lenovo 940-8i的芯片型号,然后在Broadcom官网查询和哪一个相同,下载芯片相同的RAID驱动。​

Centos7.3编译RAID驱动(一)_linux_02

解压MR_LINUX_DRIVER_7.20-07.720.04.00-1.tgz,然后解压megaraid_sas_components.tgz,

进入kmod_srpm目录,yum安装”Development Tools”组和一些常用工具。

[root@localhost kmod_srpm]# yum groupinstall "Development Tools"
[root@localhost kmod_srpm]# yum -y install libelf-dev libelf-devel elfutils-libelf-devel

安装kernel-headers,注意!kernel-headers尽可能从镜像安装,因为kernel-headers要和kernel版本一致。

[root@localhost kmod_srpm]# yum -y install kernel-headers-`uname -r`

下面开始重新编译一个和当前系统版本兼容的RAID驱动:

[root@localhost kmod_srpm]# rpmbuild --rebuild kmod-megaraid_sas-07.720.04.00-1.src.rpm

Centos7.3编译RAID驱动(一)_centos_03

进入~/rpmbuild/RPMS/x86_64目录,

找到这个文件kmod-megaraid_sas-07.720.04.00-1.x86_64.rpm。找到之后先保留。我们下一步要将该rpm包打包成dd.iso文件。

[root@localhost ~]# cd ~/rpmbuild/RPMS/x86_64

Centos7.3编译RAID驱动(一)_linux_04

在官网下载的压缩包里面有一些其他操作系统的raid驱动。我们找这个目录

rhel7_oel7_centos7/disks-1里面的这个文件

megaraid_sas-07.720.04.00_el7.7-1.x86_64.iso.gz

首先使用gunzip解压它,解压为.iso文件

[root@localhost generic_srpm]# gunzip /root/rhel7_oel7_centos7/disks-1/megaraid_sas-07.720.04.00_el7.7-1.x86_64.iso.gz

Centos7.3编译RAID驱动(一)_linux_05

将megaraid_sas-07.720.04.00_el7.7-1.x86_64.iso文件挂载到目录,然后将里面的内容复制到一个新建的文件夹里面:

[root@localhost ~]# mount rhel7_oel7_centos7/disks-1/megaraid_sas-07.720.04.00_el7.7-1.x86_64.iso /mnt/
[root@localhost ~]# mkdir test && cp -r /mnt/* test/

如下是复制出来的文件目录结构:

Centos7.3编译RAID驱动(一)_centos_06

将test/rpms/x86_64/*下面的东西删掉。将编译好的kmod-megaraid_sas-07.720.04.00-1.x86_64.rpm文件复制到x86_64目录下。

[root@localhost ~]# rm -rf test/rpms/x86_64/*
[root@localhost ~]# cp -p rpmbuild/RPMS/x86_64/kmod-megaraid_sas-07.720.04.00-1.x86_64.rpm test/rpms/x86_64/

安装createrepo安装包

[root@localhost ~]# yum -y install createrepo

进入test/rpms/x86_64/目录

在当前目录执行createrepo,为该目录生repo metadata.

[root@localhost x86_64]# createrepo .

Centos7.3编译RAID驱动(一)_centos_07

然后想办法将test目录制作成iso,就可以在Linux dd里面加载驱动了。

下面是使用mkisofs命令来制作iso文件。

[root@localhost test]# yum -y install genisoimage
[root@localhost test]# cd ~/test
[root@localhost test]# mkisofs -o dd.iso -r .

进入grub boot option时,选择Install CentOS Linux 7

Centos7.3编译RAID驱动(一)_centos_08

按一下tab键,在后面加入linux dd选项,回车,就可安装raid驱动了。(如果是使用58的这个定制镜像,不要忘记修改前面LABEL名称)

Centos7.3编译RAID驱动(一)_so文件_09

下图第一个红圈,选择存放raid驱动的存储器。第二个红圈搜索到dd.iso文件,是否挂载。三个红圈选择对应的rpm包格式的raid驱动。第四个圈输入c,继续。

Centos7.3编译RAID驱动(一)_so文件_10

再次输入c ,并回车,进入安装界面

Centos7.3编译RAID驱动(一)_centos_11

安装界面,可以看到识别硬盘了。

Centos7.3编译RAID驱动(一)_centos_12

安装完系统,发现无法进入系统,进入了emerency模式。

启动到安装界面时使用的内核版本为3.10.0.514版本:

Centos7.3编译RAID驱动(一)_so文件_13

还是因为没有加载RAID驱动的问题,因为系统里面的内核为4.18.202版本,所以需要加载一个4.18.202匹配的raid驱动。

Centos7.3编译RAID驱动(一)_centos_14

Centos7.3编译RAID驱动(一)_centos_15


举报

相关推荐

0 条评论