Construction du paquet RPM OFED driver pour Xeon Phi
Rédigé par Nicolas Sulek
Aucun commentaire
Classé dans : Logiciel
Fort heureusement, Intel fournit également le src.rpm du paquet permettant une reconstruction.
Mais si on tente un
rpmbuild --rebuild ofed-driver-3.1-0.1.build0.fc13.src.rpm
Ce dernier échoue si le système fonctionne avec un kernel à jour (comme le 2.6.32-358.23.2) :
make[2]: *** [/home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/drivers/net/mlx4] Error 2 set -e ; perl /usr/src/kernels/2.6.32-358.23.2.el6.x86_64/scripts/recordmcount.pl "x86_64" "64" "objdump" "objcopy" "gcc" "ld" "nm" "" "" "1" "/home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/driv; set -e ; perl /usr/src/kernels/2.6.32-358.23.2.el6.x86_64/scripts/recordmcount.pl "x86_64" "64" "objdump" "objcopy" "gcc" "ld" "nm" "" "" "1" "/home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/driv; make[3]: *** [/home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/drivers/infiniband/hw/qib] Error 2 make[2]: *** [/home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/drivers/infiniband] Error 2 make[1]: *** [_module_/home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1] Error 2 make[1]: Leaving directory `/usr/src/kernels/2.6.32-358.23.2.el6.x86_64' make: *** [kernel] Error 2 error: Bad exit status from /var/tmp/rpm-tmp.LeLtOY (%build) RPM build errors: user build does not exist - using root group build does not exist - using root user build does not exist - using root group build does not exist - using root Bad exit status from /var/tmp/rpm-tmp.LeLtOY (%build)En lançant la compilation avec
Building kernel modules Kernel version: 2.6.32-358.23.2.el6.x86_64 Modules directory: //lib/modules/2.6.32-358.23.2.el6.x86_64/updates Kernel sources: /lib/modules/2.6.32-358.23.2.el6.x86_64/build env CWD=/home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1 BACKPORT_INCLUDES=-I/home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/kernel_addons/backport/2.6.32-EL6.1/include/ \ /usr/bin/make -C /lib/modules/2.6.32-358.23.2.el6.x86_64/build SUBDIRS="/home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1" \ V=1 CONFIG_IBP_SERVER=m CONFIG_INFINIBAND_SCIF=m KBUILD_EXTRA_SYMBOLS=/lib/modules/2.6.32-358.23.2.el6.x86_64/scif.symvers \ CONFIG_MEMTRACK= \ CONFIG_DEBUG_INFO=y \ CONFIG_INFINIBAND=m \ CONFIG_INFINIBAND_IPOIB=m \ CONFIG_INFINIBAND_IPOIB_CM=y \ CONFIG_INFINIBAND_SDP=m \ CONFIG_INFINIBAND_SRP=m \ CONFIG_INFINIBAND_SRPT=m \ CONFIG_INFINIBAND_USER_MAD=m \ CONFIG_INFINIBAND_USER_ACCESS=m \ CONFIG_INFINIBAND_USER_MEM=y \ CONFIG_INFINIBAND_ADDR_TRANS=y \ CONFIG_INFINIBAND_MTHCA=m \ CONFIG_INFINIBAND_IPOIB_DEBUG=y \ CONFIG_INFINIBAND_ISER= \ CONFIG_SCSI_ISCSI_ATTRS= \ CONFIG_ISCSI_TCP= \ CONFIG_INFINIBAND_EHCA= \ CONFIG_INFINIBAND_EHCA_SCALING= \ CONFIG_RDS=m \ CONFIG_RDS_RDMA=m \ CONFIG_RDS_TCP=m \ CONFIG_RDS_DEBUG= \ CONFIG_INFINIBAND_IPOIB_DEBUG_DATA= \ CONFIG_INFINIBAND_SDP_SEND_ZCOPY= \ CONFIG_INFINIBAND_SDP_RECV_ZCOPY= \ CONFIG_INFINIBAND_SDP_DEBUG=y \ CONFIG_INFINIBAND_SDP_DEBUG_DATA= \ CONFIG_INFINIBAND_IPATH= \ CONFIG_INFINIBAND_QIB=m \ CONFIG_INFINIBAND_MTHCA_DEBUG=y \ CONFIG_INFINIBAND_MADEYE=m \ CONFIG_INFINIBAND_QLGC_VNIC= \ CONFIG_INFINIBAND_QLGC_VNIC_DEBUG= \ CONFIG_INFINIBAND_QLGC_VNIC_STATS= \ CONFIG_CHELSIO_T3=m \ CONFIG_INFINIBAND_CXGB3=m \ CONFIG_INFINIBAND_CXGB3_DEBUG= \ CONFIG_CHELSIO_T4=m \ CONFIG_INFINIBAND_CXGB4=m \ CONFIG_INFINIBAND_NES=m \ CONFIG_INFINIBAND_NES_DEBUG= \ CONFIG_MLX4_CORE=m \ CONFIG_MLX4_EN=m \ CONFIG_MLX4_INFINIBAND=m \ CONFIG_MLX4_ETHERNET= \ CONFIG_MLX4_DEBUG=y \ CONFIG_INFINIBAND_AMSO1100= \ CONFIG_SUNRPC_XPRT_RDMA= \ CONFIG_NFSD_RDMA= \ LINUXINCLUDE=' \ -D__OFED_BUILD__ \ -include /lib/modules/2.6.32-358.23.2.el6.x86_64/build/include/linux/autoconf.h \ -include /home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/include/linux/autoconf.h \ -I/home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/kernel_addons/backport/2.6.32-EL6.1/include/ \ \ \ -I/usr/src/kernels/2.6.32-358.23.2.el6.x86_64/include/modules/ \ -I/home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/include \ -I/home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/drivers/infiniband/debug \ -I/usr/local/include/scst \ -I/home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/drivers/infiniband/ulp/srpt \ $(if $(CONFIG_XEN),-D__XEN_INTERFACE_VERSION__=$(CONFIG_XEN_INTERFACE_VERSION)) \ $(if $(CONFIG_XEN),-I$(srctree)/arch/x86/include/mach-xen) \ -I$(srctree)/arch/$(hdr-arch)/include \ -Iinclude \ $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) \ -I$(srctree)/arch/$(SRCARCH)/include \ ' \ modules make[1]: Entering directory `/usr/src/kernels/2.6.32-358.23.2.el6.x86_64' test -e include/linux/autoconf.h -a -e include/config/auto.conf || ( \ echo; \ echo " ERROR: Kernel configuration is invalid."; \ echo " include/linux/autoconf.h or include/config/auto.conf are missing."; \ echo " Run 'make oldconfig && make prepare' on kernel src to fix it."; \ echo; \ /bin/false) mkdir -p /home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/.tmp_versions ; rm -f /home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/.tmp_versions/* /usr/bin/make -f scripts/Makefile.build obj=/home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1 /usr/bin/make -f scripts/Makefile.build obj=/home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/drivers/infiniband /usr/bin/make -f scripts/Makefile.build obj=/home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/drivers/infiniband/core gcc -Wp,-MD,/home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/drivers/infiniband/core/.addr.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.4.7/include \ -D__OFED_BUILD__ \ -include /lib/modules/2.6.32-358.23.2.el6.x86_64/build/include/linux/autoconf.h \ -include /home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/include/linux/autoconf.h \ -I/home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/kernel_addons/backport/2.6.32-EL6.1/include/ \ \ \ -I/usr/src/kernels/2.6.32-358.23.2.el6.x86_64/include/modules/ \ -I/home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/include \ -I/home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/drivers/infiniband/debug \ -I/usr/local/include/scst \ -I/home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/drivers/infiniband/ulp/srpt \ -D__XEN_INTERFACE_VERSION__= \ -I/usr/src/kernels/2.6.32-358.23.2.el6.x86_64/arch/x86/include/mach-xen \ -I/usr/src/kernels/2.6.32-358.23.2.el6.x86_64/arch//include \ -Iinclude \ \ -I/usr/src/kernels/2.6.32-358.23.2.el6.x86_64/arch/x86/include \ -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -O2 -m64 -mtune=genericc In file included from include/linux/tracepoint.h:18, from include/linux/module.h:18, from include/linux/textsearch.h:7, from include/linux/skbuff.h:27, from include/linux/if_ether.h:126, from include/linux/netdevice.h:29, from /home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/kernel_addons/backport/2.6.32-EL6.1/include/linux/netdevice.h:4, from include/linux/inetdevice.h:8, from /home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/drivers/infiniband/core/addr.c:37: /home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/kernel_addons/backport/2.6.32-EL6.1/include/linux/rcupdate.h:6:1: warning: "RCU_INIT_POINTER" redefined In file included from /home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/kernel_addons/backport/2.6.32-EL6.1/include/linux/rcupdate.h:4, from include/linux/tracepoint.h:18, from include/linux/module.h:18, from include/linux/textsearch.h:7, from include/linux/skbuff.h:27, from include/linux/if_ether.h:126, from include/linux/netdevice.h:29, from /home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/kernel_addons/backport/2.6.32-EL6.1/include/linux/netdevice.h:4, from include/linux/inetdevice.h:8, from /home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/drivers/infiniband/core/addr.c:37: include/linux/rcupdate.h:288:1: warning: this is the location of the previous definition In file included from include/linux/netdevice.h:47, from /home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/kernel_addons/backport/2.6.32-EL6.1/include/linux/netdevice.h:4, from include/linux/inetdevice.h:8, from /home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/drivers/infiniband/core/addr.c:37: /home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/kernel_addons/backport/2.6.32-EL6.1/include/linux/ethtool.h:15: error: nested redefinition of 'enum ethtool_phys_id_state' /home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/kernel_addons/backport/2.6.32-EL6.1/include/linux/ethtool.h:15: error: redeclaration of 'enum ethtool_phys_id_state' /home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/kernel_addons/backport/2.6.32-EL6.1/include/linux/ethtool.h:16: error: redeclaration of enumerator 'ETHTOOL_ID_INACTIVE' include/linux/ethtool.h:558: note: previous definition of 'ETHTOOL_ID_INACTIVE' was here /home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/kernel_addons/backport/2.6.32-EL6.1/include/linux/ethtool.h:17: error: redeclaration of enumerator 'ETHTOOL_ID_ACTIVE' include/linux/ethtool.h:559: note: previous definition of 'ETHTOOL_ID_ACTIVE' was here /home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/kernel_addons/backport/2.6.32-EL6.1/include/linux/ethtool.h:18: error: redeclaration of enumerator 'ETHTOOL_ID_ON' include/linux/ethtool.h:560: note: previous definition of 'ETHTOOL_ID_ON' was here /home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/kernel_addons/backport/2.6.32-EL6.1/include/linux/ethtool.h:20: error: redeclaration of enumerator 'ETHTOOL_ID_OFF' include/linux/ethtool.h:562: note: previous definition of 'ETHTOOL_ID_OFF' was here In file included from include/linux/inetdevice.h:8, from /home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/drivers/infiniband/core/addr.c:37: /home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/kernel_addons/backport/2.6.32-EL6.1/include/linux/netdevice.h:26: error: static declaration of 'netif_set_real_num_rx_queues' follows non-static decln include/linux/netdevice.h:1826: note: previous declaration of 'netif_set_real_num_rx_queues' was here make[4]: *** [/home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/drivers/infiniband/core/addr.o] Error 1 make[3]: *** [/home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/drivers/infiniband/core] Error 2 make[2]: *** [/home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1/drivers/infiniband] Error 2 make[1]: *** [_module_/home/nicolas/rpmbuild/BUILD/ofed-driver-3.1/ofa_kernel-1.5.4.1] Error 2 make[1]: Leaving directory `/usr/src/kernels/2.6.32-358.23.2.el6.x86_64' make: *** [kernel] Error 2
On remarque des redéclarations de fonctions et d'objets dans les en-têtes qui provoquent des erreurs de compilation.
En fait, les en-têtes du kernel standard (2.6.32-358) de la RHEL/CentOS 6.4 ne contiennent pas ces définitions, alors que les en-têtes d'un kernel mis à jour (2.6.32-358.23.2 par exemple) les contiennent et entrent en conflit avec celles du pilote OFED...
Il va donc falloir patcher les pilotes OFED contenus dans le src.rpm pour supprimer ces erreurs.
Voici comment procéder.
Préparation du système
- Mettre à jour sa RHEL et sa CentOS
yum update
- Vérifier que le système utilise bien une version à jour du kernel
uname -a
- Installer les paquets nécessaires
yum install rpm-build redhat-lsb kernel-devel gcc
Modification de ofed-driver.src.rpm
Installation des en-têtes de mpss-modules pour un kernel à jour
- Télécharger la dernière version du MPSS, l'extraire avec tar, puis aller dans mpss/src et reconstruire le paquet mpss-modules pour avoir les fichiers de développement de mpss-modules pour le kernel mis à jour
rpmbuild --rebuild mpss-modules-3.1-0.1.build0.el6.src.rpm
- Installer le paquet mpss-modules-dev résultant
yum install ~/rpmbuild/RPMS/x86_64/mpss-modules-dev-2.6.32-358.23.2.el6.x86_64-3.1-0.1.build0.el6.x86_64.rpm
Patchage de ofed-driver
- Dans le répertoire mpss/src, extraire le fichier ofed-driver-3.1-0.1.build0.fc13.src.rpm
rpm2cpio ofed-driver-3.1-0.1.build0.fc13.src.rpm | cpio -idmv
- On obtient le fichier ofed-driver-3.1.tgz à extraire :
tar xfz ofed-driver-3.1.tgz
- Aller dans ofed-driver-3.1/src/patches/2.6.32-EL6.1 et créer un 1er fichier patch pour ethtool.h :
cat << 'EOF' > ethtool.h.patch
diff -Naur a/kernel_addons/backport/2.6.32-EL6.1/include/linux/ethtool.h b/kernel_addons/backport/2.6.32-EL6.1/include/linux/ethtool.h
--- a/kernel_addons/backport/2.6.32-EL6.1/include/linux/ethtool.h2013-11-28 15:07:36.182722948 +0100
+++ b/kernel_addons/backport/2.6.32-EL6.1/include/linux/ethtool.h2013-11-28 15:08:54.000726177 +0100
@@ -12,12 +12,12 @@
* @ETHTOOL_ID_OFF: LED should be turned off (used iff %ETHTOOL_ID_ACTIVE
* is not supported)
*/
-enum ethtool_phys_id_state {
+/** enum ethtool_phys_id_state {
ETHTOOL_ID_INACTIVE,
ETHTOOL_ID_ACTIVE,
ETHTOOL_ID_ON,
ETHTOOL_ID_OFF
-};
+}; **/
/* boolean flags controlling per-interface behavior characteristics.
* When reading, the flag indicates whether or not a certain behavior
EOF
- Créer un 2ème fichier patch pour netdevice.h
cat << 'EOF' > netdevice.h.patch
diff -Naur a/kernel_addons/backport/2.6.32-EL6.1/include/linux/netdevice.h b/kernel_addons/backport/2.6.32-EL6.1/include/linux/netdevice.h
--- a/kernel_addons/backport/2.6.32-EL6.1/include/linux/netdevice.h2013-11-28 15:10:12.476725726 +0100
+++ b/kernel_addons/backport/2.6.32-EL6.1/include/linux/netdevice.h2013-11-28 15:11:39.591743584 +0100
@@ -23,11 +23,11 @@
* possible. Hence adding this function to avoid changes in driver source
* code and making this function to always return success.
*/
-static inline int netif_set_real_num_rx_queues(struct net_device *dev,
+/** static inline int netif_set_real_num_rx_queues(struct net_device *dev,
unsigned int rxq)
{
return 0;
-}
+} **/
#define NETIF_F_RXHASH (1 < < 28) /* Receive hashing offload */
EOF
- Retourner dans mpss/src et récréer une archive de ofed-driver
tar cpfz ofed-driver-3.1.tgz ofed-driver-3.1
Construction du paquet RPM ofed-driver
- Créer le répertoire pour la reconstruction du paquet RPM
mkdir -p ~/rpmbuild/SOURCES
- Copier les fichiers nécessaires
cp intel-mic-ofed-kmod.spec ~/rpmbuild/
cp ofed-driver-3.1.tgz ~/rpmbuild/SOURCES/
- Aller dans ~/rpmbuild et lancer la reconstruction du paquet
rpmbuild -ba intel-mic-ofed-kmod.spec
On obtient les RPM du pilote OFED pour la version à jour du kernel dans ~/rpmbuild/RPMS/x86_64.