Article ID: 114181, created on Jun 22, 2012, last review on Aug 12, 2014

  • Applies to:
  • Virtuozzo containers for Linux

Information

This article describes how to compile an RDAC driver for a PVC kernel which is different from the currently loaded one.

Resolution

1) Download "devel" packages for your kernel (in this example - 2.6.18-028stab099.3), following this KB article:
6732 How to obtain kernel headers on PVC node in order to compile a third-party driver

[root@pvclinux64 ~]# PVC=`awk '{print $NF}' /etc/virtuozzo-release`
[root@pvclinux64 ~]# KERNEL='PUT KERNEL VERSION HERE'
[root@pvclinux64 ~]# ARCH=`uname -m`
[root@pvclinux64 ~]# mkdir drivers
[root@pvclinux64 ~]# cd drivers/
[root@pvclinux64 drivers]# wget -c http://vzup2date.parallels.com/virtuozzo/linux/${ARCH}/${PVC}/CU-${KERNEL}/vzkernel-devel-${KERNEL}.${ARCH}.rpm
[root@pvclinux64 drivers]# wget -c http://vzup2date.parallels.com/virtuozzo/linux/${ARCH}/${PVC}/CU-${KERNEL}/vzmodules-${KERNEL}.${ARCH}.rpm
[root@pvclinux64 drivers]# wget -c http://vzup2date.parallels.com/virtuozzo/linux/${ARCH}/${PVC}/CU-${KERNEL}/vzkernel-${KERNEL}.${ARCH}.rpm

2) Download the latest RDAC driver for your device from this link, or contact the hardware vendor.
[root@pvclinux64 drivers]# wget http://support.netapp.com/NOW/public/apbu/oemcp/09.03.0C05.0638/rdac-LINUX-09.03.0C05.0638-source.tar.gz

3) Create a temporary container based on the CentOS 5 or RHEL 5 OS template and start it:
[root@pvclinux64 drivers]# vzctl create 55 --ostemplate centos-5-x86_64 --config slm.1024MB --hostname rdacdrivers
[root@pvclinux64 ~]# vzctl set 55 --diskspace 10000000 --save
[root@pvclinux64 drivers]# vzctl start 55

4) Install the "devel" template into a container or separate packages (as in the case of an RHEL template):
[root@pvclinux64 drivers]# vzpkg install 55 devel
If there is no devel template installed for the selected OS template, it is possible to install packages in the following way:
[root@pvclinux64 drivers]# vzpkg install 55 -p autoconf213 psutils patchutils rpm-build rpm-python gcc gcc-c++ gcc-gnat gcc-java gcc-objc gdb openjade openssl-perl patch tetex tetex-latex tetex-dvips libtool automake14 automake15 automake16 automake17 cpp cvs passivetex texinfo dejagnu gettext flex dos2unix doxygen distcache bc bison byacc gperf docbook-style-xsl xmlto strace docbook-dtds tetex-latex tetex-dvips xmltex gnutls-devel apr-devel apr-util-devel gd-devel cups-devel curl-devel db4-devel rpm-devel distcache-devel python-devel gettext-devel glib-devel glib2-devel gmp-devel gettext-devel expect-devel bzip2-devel beecrypt-devel httpd-devel kudzu-devel libattr-devel libacl-devel hesiod-devel krb5-devel libselinux-devel libgcrypt-devel libgpg-error-devel audit-libs-devel libusb-devel zlib-devel unixODBC-devel sendmail-devel tcl-devel pam-devel readline-devel slang-devel libtiff-devel libxml2-devel libxslt-devel ncurses-devel net-snmp-devel newt-devel openssl-devel libpng-devel freetype-devel fontconfig-devel libgcj-devel

5) Copy kernel headers and driver sources to the container:
[root@pvclinux64 drivers]# cp ./* /vz/root/55/root

6) Enter the temporary container:
[root@pvclinux64 drivers]# vzctl enter 55
entered into Container 55
-bash-3.2# su -
[root@rdacdrivers ~]#

7) Install kernel headers:
[root@rdacdrivers ~]# rpm -ihv vz*.rpm --nodeps

8) Extract driver sources:
[root@rdacdrivers ~]# tar -xvzf rdac-LINUX-09.03.0C05.0638-source.tar.gz -C /root

9) Edit Makefile for the driver:
[root@rdacdrivers ~]# cd linuxrdac-09.03.0C05.0638/
[root@rdacdrivers linuxrdac-09.03.0C05.0331]# cp Makefile{,.orig}
[root@rdacdrivers linuxrdac-09.03.0C05.0331]# sed 's/OS_VER := $(shell uname -r)/OS_VER := \x272.6.18-028stab099.3\x27/' -i Makefile
[root@rdacdrivers linuxrdac-09.03.0C05.0331]# sed 's/$(shell uname -r)/$(OS_VER)/g' -i Makefile
[root@rdacdrivers linuxrdac-09.03.0C05.0331]# sed '/install_doer/s/all //' -i Makefile
[root@rdacdrivers linuxrdac-09.03.0C05.0331]# sed '/\@\/opt\/mpp\/setupDriver\.\$(DIST)/s/$/ \$(OS_VER)/' -i Makefile

10) The resulting difference between the original file and the modified file should appear similar to the following:
[root@rdacdrivers linuxrdac-09.03.0C05.0638]# diff -pruN Makefile{.orig,}
--- Makefile.orig 2012-06-22 14:58:57.000000000 +0700
+++ Makefile 2012-06-22 15:15:48.000000000 +0700
@@ -25,7 +25,7 @@
 #
 #######################################################################

-OS_VER := $(shell uname -r)
+OS_VER := '2.6.18-028stab099.3'
 HOST_TYPE := $(shell uname -m)
 IS_SMP := $(shell (uname -v | grep -c "SMP"))
 # Kernel Distribution (either REDHAT or SUSE)
@@ -38,7 +38,7 @@ ifeq ("$(KDUMP_FLAG)", "1")
  ifeq ("$(DIST)", "SUSE")
   KDUMP_STATUS := 1
                 ifeq ("$(SLES11_FLAG)", "1")
-                        KERNEL_DUMP_VER := $(shell uname -r)
+                        KERNEL_DUMP_VER := $(OS_VER)
                 else
    KERNEL_DUMP_VER := $(shell (ls -la /boot/vmlinux-kdump 2> /dev/null | sed -e 's/.*vmlinux-//g'))
                 endif
@@ -47,7 +47,7 @@ ifeq ("$(KDUMP_FLAG)", "1")
  else
   KDUMP_STATUS := $(shell echo 1)
   ifeq ("$(KDUMP_STATUS)", "1")
-   KERNEL_DUMP_VER := $(shell uname -r)
+   KERNEL_DUMP_VER := $(OS_VER)
    KERNEL_DUMP_OBJ := /lib/modules/$(KERNEL_DUMP_VER)/build
    KERNEL_DUMP_SRC_CHK_FLAG := $(shell (if [ -f $(KERNEL_DUMP_OBJ)/Makefile ]; then echo 1; else echo 0; fi))
   endif
@@ -58,7 +58,7 @@ else
 endif

 ifeq ("$(KERNEL_OBJ)","")
- KERNEL_OBJ := /lib/modules/$(shell uname -r)/build
+ KERNEL_OBJ := /lib/modules/$(OS_VER)/build
 endif

 #Flag to check if gcc is installed
@@ -94,7 +94,7 @@ CC      =$(CROSS_COMPILE)gcc
 RDAC_RPM_HELPER_DIR=/opt/mpp/.mppLnx_rpm_helpers

 ifeq ("$(KERNEL_OBJ)","")
- KERNEL_OBJ := /lib/modules/$(shell uname -r)/build
+ KERNEL_OBJ := /lib/modules/$(OS_VER)/build
 endif

 INITRD_DIR=/boot
@@ -164,7 +164,7 @@ install :
  @make -f Makefile install_doer 2>&1 |tee install.log
  @if [ -d /opt/mpp ]; then cp install.log /opt/mpp/install.log; fi

-install_doer : all hbacheck copyfiles moduledep setupfiles setupdriver
+install_doer : hbacheck copyfiles moduledep setupfiles setupdriver

 hbacheck :
  @if [ -f /opt/mpp/makefile.saved ]; then echo "The system has old MPP driver package installed." ; echo "Please do \"make uninstall\" in the current directory before installing the new one."; exit 1; fi
@@ -286,7 +286,7 @@ setupfiles :
  fi;

 setupdriver:
- @/opt/mpp/setupDriver.$(DIST)
+ @/opt/mpp/setupDriver.$(DIST) $(OS_VER)
  @if [ "$(DIST)" == "REDHAT" -a $(KDUMP_STATUS) -eq 1 -a $(KERNEL_DUMP_SRC_CHK_FLAG) -eq 1 ]; then \
  if [ -n "$(EXTRA_INITRD_DIR)" ]; then \
   if [ -f /boot/initrd-$(OS_VER)kdump.img ]; then \
11) Install drivers to the node:
[root@rdacdrivers linuxrdac-09.03.0C05.0638]# exit
logout
-bash-3.2# exit
logout
exited from Container 55
[root@pvclinux64 drivers]# cd /vz/root/55/root/linuxrdac-09.03.0C05.0638/
[root@pvclinux64 drivers]# make install
12) Make sure that an appropriate MPP-enabled initrd image is used for the required kernel:
[root@pvclinux64 linuxrdac-09.03.0C05.0638]# grep -B3 mpp  /etc/grub.conf
title Parallels Containers (2.6.18-028stab099.3)
    root (hd0,0)
    kernel /vmlinuz-2.6.18-028stab099.3root=/dev/sda4    resume=/dev/sda2 splash=silent showopts debug max_scsi_luns=8
    initrd /mpp-2.6.18-028stab099.3.img


NOTE: After compiling and installing the driver to the node, you must configure multipathing according to your needs.

Additional information

Also see these related articles:
111113 How to compile custom drivers for PVC kernel
6732 How to install kernel headers on PVC node in order to compile a third-party driver
6731 How to build HP-ILO modules for PVC
 

e8e50b42231236b82df27684e7ec0beb 2897d76d56d2010f4e3a28f864d69223 d02f9caf3e11b191a38179103495106f

Email subscription for changes to this article
Save as PDF