解压BootOS
mkdir bootos
cd bootos
wget -O - http://你的cloudboot地址//bootos/initrd.img | xz -d | cpio -id
cd ../
安装编译依赖环境&DNS&修改yum源&编译mellanox网卡驱动&安装驱动
chroot bootos
修DNS为公网DNS
vi /etc/resolv.conf
nameserver 114.114.114.114
修改yum源为163 CentOS 6.7 (别的也行)
安装编译mellanox网卡驱动的依赖yum install vim rpm-build gcc -y
rpm -ivh https://vault.centos.org/6.7/os/x86_64/Packages/kernel-devel-2.6.32-573.el6.x86_64.rpm
下载CentOS 6的mellanox驱动mellanox en驱动可以在这找(https://www.mellanox.com/products/ethernet-drivers/linux/mlnx_en)
wget http://www.mellanox.com/downloads/ofed/MLNX_EN-5.0-1.0.0.0/MLNX_EN_SRC-5.0-1.0.0.0.tgz
tar -zxf MLNX_EN_SRC-5.0-1.0.0.0.tgz
cd MLNX_EN_SRC-5.0-1.0.0.0/SRPMS
rpmbuild --rebuild mlnx-en-5.0-1.0.0.0.0.g34c46d3.src.rpm
cd /root/rpmbuild/RPMS/x86_64lsmlnx_en-5.0-1.0.0.0.0.g34c46d3.kver.2.6.32_573.el6.x86_64.x86_64.rpm
mlnx-en-debuginfo-5.0-1.0.0.0.0.g34c46d3.x86_64.rpm
mlnx-en-doc-5.0-1.0.0.0.0.g34c46d3.x86_64.rpm
mlnx-en-sources-5.0-1.0.0.0.0.g34c46d3.x86_64.rpm
mlnx-en-utils-5.0-1.0.0.0.0.g34c46d3.x86_64.rpm
rpm -ivh mlnx-en-utils-5.0-1.0.0.0.0.g34c46d3.x86_64.rpm
rpm -ivh mlnx_en-5.0-1.0.0.0.0.g34c46d3.kver.2.6.32_573.el6.x86_64.x86_64.rpm
#至此驱动安装完成
解决安装驱动网卡不识别问题
#因为mlx5_core依赖ipv6模块,不加载ipv6模块就无法识别到mellanox网卡,但加载ipv6模块后,ip a后会多出弋航inet 6 ip地址,多出的地址会导致cloudboot_agent获取SN等信息失败,所以需要加载ipv6,但不自动获取ipv6地址。
vim etc/rc.local
#添加以下内容
sleep 5
echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.nic0.disable_ipv6 = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.nicN.disable_ipv6 = 1" >> /etc/sysctl.conf
echo "ipv6.disable_ipv6 = 1" >> /etc/sysctl.conf
sysctl -p
service cloudboot-agent start
重新打包BootOS并替换
按ctrl+d退出chroot
cd bootos
find . | cpio -co | xz -9 --format=lzma > /tmp/initrd.img
拷贝新的BootOS 替换旧BootOS(注意备份)
scp /tmp/initrd.img 你的cloudboot地址:/opt/cloudboot/home/www/bootos