Open main menu

OpenVZ Virtuozzo Containers Wiki β

Changes

Building external kernel modules

2,103 bytes added, 12:20, 22 March 2017
Building a kernel module using Dynamic Kernel Module Support (DKMS): small and simplistic example of using DKMS with Virtuozzo 7.0.1
== Building a kernel module using Dynamic Kernel Module Support (DKMS) ==
TBD(draft : this is a small example of adding back the support of an old network card just after the installation of Virtuozzo 7.0.1 on a bare metal server) First, you need to figure out which kernel source files are welcome needed to put build your modules. Here, what we needed wasn't in the description heresource package https://download.openvz.org/virtuozzo/releases/openvz-7.0.1-554/source/SRPMS/v/vzkernel-3.10.0-327.36.1.vz7.18.7.src.rpm but we were lucky and needed only one file : <tt>3c59x.c</tt> from https://src.openvz.org/projects/OVZ/repos/vzkernel/browse/drivers/net/ethernet/3com (beware of branch and/or tag). Note : if network is unavailable on the target host, download these packets (lookup /etc/yum.repos.d/ for the EPEL and Virtuozzo URL). Adapt the version numbers to your release : cpp-4.8.5-11.vl7.x86_64 dkms-2.3-2.20161202gitde1dca9.vl7.noarch gcc-4.8.5-11.vl7.x86_64 U glibc-2.17-157.vl7.2.x86_64 U glibc-common-2.17-157.vl7.2.x86_64 glibc-devel-2.17-157.vl7.2.x86_64 glibc-headers-2.17-157. vl7.2.x86_64 U libgcc-4.8.5-11.vl7.x86_64 U libgomp-4.8.5-11.vl7.x86_64 libmpc-1.0.1-3.vl7.x86_64 mpfr-3.1.1-4.vl7.x86_64 vzkernel-devel-3.10.0-327.36.1.vz7.18.7.x86_64 vzkernel-headers-3.10.0-327.36.1.vz7.18.7.x86_64 (U = already present but seems to require an update) The rest of this doc is heavily inspired from https://wiki.centos.org/HowTos/BuildingKernelModules Install dkms and vzkernel-devel. Create a <tt>/usr/src</tt> subdirectory named like this <tt>modulename-buildversion</tt> and place your file(s)there : mkdir /usr/src/3c59x-0.1 cd /usr/src/3c59x-0.1 cp 3c59x.c /usr/src/3c59x-0.1 echo "obj-m += 3c59x.o" >/usr/src/3c59x-0.1/Makefile Create the /usr/src/3c59x-0.1/dkms.conf file : PACKAGE_NAME="3c59x" PACKAGE_VERSION="0.1" BUILT_MODULE_NAME[0]="3c59x" DEST_MODULE_LOCATION[0]="/kernel/drivers/net/ethernet/3com/" AUTOINSTALL="yes" Then add dkms support : dkms add -m 3c59x -v 0.1 dkms build -m 3c59x -v 0.1 dkms install -m 3c59x -v 0.1 For each kernel update, dkms should rebuild the module for you.There is an option in dkms to build a RPM and maybe allow to do all that work remotely, but not tested, sorry.
== Building a kernel module rpm package (kmod) ==
2
edits