Skip to contentSkip to conversation

package/openvmtools: enable openvmtools kernel modules

PATCH New Romain Naour 3 participants 5 messages Feb 19, 2015 – Jul 10, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/openvmtools: enable openvmtools kernel modules

This allow to build openvmtools's vmsync, vmci, vsock, vmxnet, vmblock and vmhgfs kernel modules.

Tested with a 3.2.64 kernel but the build is broken for newer kernel (3.14+ at least).

---
 ...on-t-append-build-directory-to-LINUXINCLU.patch | 31 ++++++++++++++++++++++
 ...gure-fix-modules-install-to-target-rootfs.patch | 28 +++++++++++++++++++
 package/openvmtools/Config.in                      |  9 +++++++
 package/openvmtools/openvmtools.mk                 | 16 ++++++++++-
 4 files changed, 83 insertions(+), 1 deletion(-)
 create mode 100644 package/openvmtools/0008-configure-don-t-append-build-directory-to-LINUXINCLU.patch
 create mode 100644 package/openvmtools/0009-configure-fix-modules-install-to-target-rootfs.patch
package/openvmtools/0008-configure-don-t-append-build-directory-to-LINUXINCLU.patch new file +31 -0
new file mode 100644
index 0000000..5d18d9f
@@ -0,0 +1,31 @@
+From 796296f35c6992b4c685b7926a2aff9cd3bcac81 Mon Sep 17 00:00:00 2001
+From: Romain Naour <[email protected]>
+Date: Mon, 16 Feb 2015 11:30:23 +0100
+Subject: [PATCH 8/8] configure: don't append build directory to LINUXINCLUDE.
+
+This break the build when LINUXDIR point to the kernel linux sources
+(ie not from /lib/module/uname -r/build/include)
+
+Use directly --with-linuxdir=$(LINUX_DIR)/build if necessary.
+
+Signed-off-by: Romain Naour <[email protected]>
+---
+ configure.ac |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 549736f..6c97785 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -148,7 +148,7 @@ if test "$with_kernel_modules" = "yes"; then
+          if test ! -d "$LINUXDIR/kernel/"; then
+              AC_MSG_ERROR([$LINUXDIR/kernel does not exist])
+          fi
+-         LINUXINCLUDE="$LINUXDIR/build/include"
++         LINUXINCLUDE="$LINUXDIR/include"
+          if test ! -d "$LINUXINCLUDE"; then
+             AC_MSG_ERROR([Can't find include dir under $LINUXDIR])
+          fi
+-- 
+1.7.10.4
+
package/openvmtools/0009-configure-fix-modules-install-to-target-rootfs.patch new file +28 -0
new file mode 100644
index 0000000..b9cefb0
@@ -0,0 +1,28 @@
+From bfcf1483da376ff417473588eb35c66fd730f386 Mon Sep 17 00:00:00 2001
+From: Romain Naour <[email protected]>
+Date: Wed, 18 Feb 2015 23:26:10 +0100
+Subject: [PATCH] configure: fix modules install to target rootfs
+
+Signed-off-by: Romain Naour <[email protected]>
+---
+ configure.ac | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 549736f..a03c662 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -932,7 +932,9 @@ if test "$have_glib_2_14" = "yes"; then
+ fi
+ 
+ if test "$os" = "linux"; then
+-   MODULES_DIR="$LINUXDIR/kernel/"
++   # MODULES_DIR is used to install vmware modules to the target
++   # Use DESTDIR to define the target rootfs when installing
++   MODULES_DIR="/lib/modules/$KERNEL_RELEASE/kernel/"
+ 
+    CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64"
+    CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
+-- 
+1.9.3
+
package/openvmtools/Config.in +9 -0
index 5fc6977..0c2cfda 100644
@@ -52,6 +52,15 @@ config BR2_PACKAGE_OPENVMTOOLS_PAM
 comment "PAM support needs a toolchain w/ dynamic library"
 	depends on BR2_STATIC_LIBS
 
+config BR2_PACKAGE_OPENVMTOOLS_KERNEL_MODULES
+	bool "Openvmtools Linux Kernel Modules"
+	depends on BR2_LINUX_KERNEL
+	help
+	  Build openvmtools's Linux kernel modules.
+
+comment "Openvmtools's Linux kernel modules needs a Linux kernel to be built"
+	depends on !BR2_LINUX_KERNEL
+
 endif
 
 comment "openvmtools needs a toolchain w/ wchar, threads, RPC, largefile, locale"
package/openvmtools/openvmtools.mk +15 -1
index e0ec6d6..853d21f 100644
@@ -12,9 +12,23 @@ OPENVMTOOLS_LICENSE_FILES = COPYING
 # Autoreconf needed because package is distributed without a configure script
 # See http://sourceforge.net/p/open-vm-tools/mailman/message/32550385/
 OPENVMTOOLS_AUTORECONF = YES
-OPENVMTOOLS_CONF_OPTS = --without-icu --without-x --without-gtk2 --without-gtkmm --without-kernel-modules
+# Add --without-root-privileges in order to not run depmod -a on the host.
+OPENVMTOOLS_CONF_OPTS = --without-icu --without-x --without-gtk2 --without-gtkmm --without-root-privileges
 OPENVMTOOLS_DEPENDENCIES = libglib2
 
+ifeq ($(BR2_PACKAGE_OPENVMTOOLS_KERNEL_MODULES),y)
+# Specify the Linux version from the kernel build by Buildroot otherwise the
+# the host Linux version will be used.
+# Use LINUX_VERSION_PROBED (aka the real Linux version), which tells us where
+# kernel modules are going to be installed in the target filesystem.
+OPENVMTOOLS_CONF_OPTS += --with-kernel-modules \
+	--with-kernel-release=$(LINUX_VERSION_PROBED) \
+	--with-linuxdir=$(LINUX_DIR)
+OPENVMTOOLS_DEPENDENCIES += linux
+else
+OPENVMTOOLS_CONF_OPTS += --without-kernel-modules
+endif
+
 # When libfuse is available, openvmtools can build vmblock-fuse, so
 # make sure that libfuse gets built first
 ifeq ($(BR2_PACKAGE_LIBFUSE),y)
Signature · 1 line
1.9.3
#1 lore raw

PATCH 1/1 package/openvmtools: enable openvmtools kernel modules

Dear Romain Naour,

Quoted 21 lines · Romain Naour
package/openvmtools/0008-configure-don-t-append-build-directory-to-LINUXINCLU.patch new file +15 -0
new file mode 100644
index 0000000..5d18d9f
@@ -0,0 +1,31 @@
+From 796296f35c6992b4c685b7926a2aff9cd3bcac81 Mon Sep 17 00:00:00 2001
+From: Romain Naour <[email protected]>
+Date: Mon, 16 Feb 2015 11:30:23 +0100
+Subject: [PATCH 8/8] configure: don't append build directory to LINUXINCLUDE.
+
+This break the build when LINUXDIR point to the kernel linux sources
+(ie not from /lib/module/uname -r/build/include)
+
+Use directly --with-linuxdir=$(LINUX_DIR)/build if necessary.
+
+Signed-off-by: Romain Naour <[email protected]>
+---
+ configure.ac |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+

package/openvmtools/0008-configure-don-t-append-build-directory-to-LINUXINCLU.patch line 25

Quoted 10 lines
package/openvmtools/0008-configure-don-t-append-build-directory-to-LINUXINCLU.patch new file +10 -0
+diff --git a/configure.ac b/configure.ac
+index 549736f..6c97785 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -148,7 +148,7 @@ if test "$with_kernel_modules" = "yes"; then
+          if test ! -d "$LINUXDIR/kernel/"; then
+              AC_MSG_ERROR([$LINUXDIR/kernel does not exist])
+          fi
+-         LINUXINCLUDE="$LINUXDIR/build/include"
++         LINUXINCLUDE="$LINUXDIR/include"

I believe this patch may not be needed. The idea of the original code is that $LINUXDIR should be set to /lib/modules/<kernelversion>/. In a normal system, this directory contains a "build" symbolic link, which points back to the kernel source directory, or the kernel headers directory.

thomas at skate:/lib/modules/3.16.0-31-generic$ ls -l total 4052
lrwxrwxrwx 1 root root 40 f?vr. 10 17:36 build -> /usr/src/linux-headers-3.16.0-31-generic
[...]

package/openvmtools/0008-configure-don-t-append-build-directory-to-LINUXINCLU.patch line 30

Quoted 5 lines
package/openvmtools/0008-configure-don-t-append-build-directory-to-LINUXINCLU.patch new file +5 -0
+ if test "$os" = "linux"; then
+-   MODULES_DIR="$LINUXDIR/kernel/"
++   # MODULES_DIR is used to install vmware modules to the target
++   # Use DESTDIR to define the target rootfs when installing
++   MODULES_DIR="/lib/modules/$KERNEL_RELEASE/kernel/"

Same here: LINUXDIR is expected to point
at /lib/modules/<kernelversion>/, and the "kernel" subdirectory in here is where kernel modules are installed. So if you point LINUXDIR to /lib/modules/<kernelversion>/, this patch should not be needed.

Now, there is one trick: in the current Buildroot, the kernel modules are only installed to $(TARGET_DIR), and when installed, the 'build' symbolic link is removed, because it points to a non-nonsensical location since the kernel sources (or kernel headers) are not installed in $(TARGET_DIR).

So either we need to keep your patches (but they have no chance of being upstreamed), or we install kernel modules to $(STAGING_DIR). I'm not sure if we want to do that just for the sake of openvmtools, though.

So in the end, maybe what you did is the best approach.

package/openvmtools/0008-configure-don-t-append-build-directory-to-LINUXINCLU.patch

Quoted 7 lines
package/openvmtools/0008-configure-don-t-append-build-directory-to-LINUXINCLU.patch new file +7 -0
+config BR2_PACKAGE_OPENVMTOOLS_KERNEL_MODULES
+	bool "Openvmtools Linux Kernel Modules"
+	depends on BR2_LINUX_KERNEL
+	help
+	  Build openvmtools's Linux kernel modules.
+
+comment "Openvmtools's Linux kernel modules needs a Linux kernel to be built"

needs -> need

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 package/openvmtools: enable openvmtools kernel modules

Hi Romain, Thomas,

AFAIK all openvmtools kernel modules are upstreamed into recent vanilla Linux kernels (except HGFS, which shall come into fuse in the near future), so I think this patch should contain a warning, to only build the kernel modules if you are building an old kernel. This is the reason why I didn't bother with this when I first sent in the package.
See a very recent conversation on
http://sourceforge.net/p/open-vm-tools/mailman/message/33471984/

Kind regards,
Karoly
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20150220/f25bf8cd/attachment.html>

#3 lore raw

PATCH 1/1 package/openvmtools: enable openvmtools kernel modules

In reply to Thomas Petazzoni

Hi Thomas, Karoly, All

Le 20/02/2015 09:22, Thomas Petazzoni a ?crit :

Quoted 42 lines

Dear Romain Naour,

Quoted 21 lines · Romain Naour
package/openvmtools/0008-configure-don-t-append-build-directory-to-LINUXINCLU.patch new file +15 -0
new file mode 100644
index 0000000..5d18d9f
@@ -0,0 +1,31 @@
+From 796296f35c6992b4c685b7926a2aff9cd3bcac81 Mon Sep 17 00:00:00 2001
+From: Romain Naour <[email protected]>
+Date: Mon, 16 Feb 2015 11:30:23 +0100
+Subject: [PATCH 8/8] configure: don't append build directory to LINUXINCLUDE.
+
+This break the build when LINUXDIR point to the kernel linux sources
+(ie not from /lib/module/uname -r/build/include)
+
+Use directly --with-linuxdir=$(LINUX_DIR)/build if necessary.
+
+Signed-off-by: Romain Naour <[email protected]>
+---
+ configure.ac |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+

package/openvmtools/0008-configure-don-t-append-build-directory-to-LINUXINCLU.patch line 25

Quoted 10 lines
package/openvmtools/0008-configure-don-t-append-build-directory-to-LINUXINCLU.patch new file +10 -0
+diff --git a/configure.ac b/configure.ac
+index 549736f..6c97785 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -148,7 +148,7 @@ if test "$with_kernel_modules" = "yes"; then
+          if test ! -d "$LINUXDIR/kernel/"; then
+              AC_MSG_ERROR([$LINUXDIR/kernel does not exist])
+          fi
+-         LINUXINCLUDE="$LINUXDIR/build/include"
++         LINUXINCLUDE="$LINUXDIR/include"

I believe this patch may not be needed. The idea of the original code is that $LINUXDIR should be set to /lib/modules/<kernelversion>/. In a normal system, this directory contains a "build" symbolic link, which points back to the kernel source directory, or the kernel headers directory.

Quoted 5 lines

thomas at skate:/lib/modules/3.16.0-31-generic$ ls -l total 4052
lrwxrwxrwx 1 root root 40 f?vr. 10 17:36 build -> /usr/src/linux-headers-3.16.0-31-generic
[...]

Thanks for the review,

The --with-linuxdir option is confusing because one can understand (like me) that we can use directly the kernel source directory.

Quoted 18 lines

package/openvmtools/0008-configure-don-t-append-build-directory-to-LINUXINCLU.patch line 30

Quoted 6 lines
package/openvmtools/0008-configure-don-t-append-build-directory-to-LINUXINCLU.patch new file +5 -0
+ if test "$os" = "linux"; then
+-   MODULES_DIR="$LINUXDIR/kernel/"
++   # MODULES_DIR is used to install vmware modules to the target
++   # Use DESTDIR to define the target rootfs when installing
++   MODULES_DIR="/lib/modules/$KERNEL_RELEASE/kernel/"

Same here: LINUXDIR is expected to point
at /lib/modules/<kernelversion>/, and the "kernel" subdirectory in here is where kernel modules are installed. So if you point LINUXDIR to /lib/modules/<kernelversion>/, this patch should not be needed.

Now, there is one trick: in the current Buildroot, the kernel modules are only installed to $(TARGET_DIR), and when installed, the 'build' symbolic link is removed, because it points to a non-nonsensical location since the kernel sources (or kernel headers) are not installed in $(TARGET_DIR).

Quoted 5 lines

So either we need to keep your patches (but they have no chance of being upstreamed), or we install kernel modules to $(STAGING_DIR). I'm not sure if we want to do that just for the sake of openvmtools, though.

So in the end, maybe what you did is the best approach.

The open-vm-tools kernel module build system is not very cross-compilation friendly and as Karoly said in his reply [1], most of the kernel modules has been upstreamed.

Not sure upstream will work on this in near future. But those modules are still needed for "older" kernel.

I need to check when the vmware modules have been merged.

[1] http://lists.busybox.net/pipermail/buildroot/2015-February/119751.html

Best regards,
Romain

Quoted 13 lines

package/openvmtools/0008-configure-don-t-append-build-directory-to-LINUXINCLU.patch

Quoted 8 lines
package/openvmtools/0008-configure-don-t-append-build-directory-to-LINUXINCLU.patch new file +7 -0
+config BR2_PACKAGE_OPENVMTOOLS_KERNEL_MODULES
+	bool "Openvmtools Linux Kernel Modules"
+	depends on BR2_LINUX_KERNEL
+	help
+	  Build openvmtools's Linux kernel modules.
+
+comment "Openvmtools's Linux kernel modules needs a Linux kernel to be built"

needs -> need

Thomas

#4 lore raw

PATCH 1/1 package/openvmtools: enable openvmtools kernel modules

Hi Thomas, Karoly, All

Le 21/02/2015 14:07, Romain Naour a ?crit :

Quoted 84 lines

Hi Thomas, Karoly, All

Le 20/02/2015 09:22, Thomas Petazzoni a ?crit :

Quoted 42 lines

Dear Romain Naour,

Quoted 21 lines · Romain Naour
package/openvmtools/0008-configure-don-t-append-build-directory-to-LINUXINCLU.patch new file +15 -0
new file mode 100644
index 0000000..5d18d9f
@@ -0,0 +1,31 @@
+From 796296f35c6992b4c685b7926a2aff9cd3bcac81 Mon Sep 17 00:00:00 2001
+From: Romain Naour <[email protected]>
+Date: Mon, 16 Feb 2015 11:30:23 +0100
+Subject: [PATCH 8/8] configure: don't append build directory to LINUXINCLUDE.
+
+This break the build when LINUXDIR point to the kernel linux sources
+(ie not from /lib/module/uname -r/build/include)
+
+Use directly --with-linuxdir=$(LINUX_DIR)/build if necessary.
+
+Signed-off-by: Romain Naour <[email protected]>
+---
+ configure.ac |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+

package/openvmtools/0008-configure-don-t-append-build-directory-to-LINUXINCLU.patch line 25

Quoted 10 lines
package/openvmtools/0008-configure-don-t-append-build-directory-to-LINUXINCLU.patch new file +10 -0
+diff --git a/configure.ac b/configure.ac
+index 549736f..6c97785 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -148,7 +148,7 @@ if test "$with_kernel_modules" = "yes"; then
+          if test ! -d "$LINUXDIR/kernel/"; then
+              AC_MSG_ERROR([$LINUXDIR/kernel does not exist])
+          fi
+-         LINUXINCLUDE="$LINUXDIR/build/include"
++         LINUXINCLUDE="$LINUXDIR/include"

I believe this patch may not be needed. The idea of the original code is that $LINUXDIR should be set to /lib/modules/<kernelversion>/. In a normal system, this directory contains a "build" symbolic link, which points back to the kernel source directory, or the kernel headers directory.

Quoted 5 lines

thomas at skate:/lib/modules/3.16.0-31-generic$ ls -l total 4052
lrwxrwxrwx 1 root root 40 f?vr. 10 17:36 build -> /usr/src/linux-headers-3.16.0-31-generic
[...]

Thanks for the review,

The --with-linuxdir option is confusing because one can understand (like me) that we can use directly the kernel source directory.

Quoted 18 lines

package/openvmtools/0008-configure-don-t-append-build-directory-to-LINUXINCLU.patch line 30

Quoted 6 lines
package/openvmtools/0008-configure-don-t-append-build-directory-to-LINUXINCLU.patch new file +5 -0
+ if test "$os" = "linux"; then
+-   MODULES_DIR="$LINUXDIR/kernel/"
++   # MODULES_DIR is used to install vmware modules to the target
++   # Use DESTDIR to define the target rootfs when installing
++   MODULES_DIR="/lib/modules/$KERNEL_RELEASE/kernel/"

Same here: LINUXDIR is expected to point
at /lib/modules/<kernelversion>/, and the "kernel" subdirectory in here is where kernel modules are installed. So if you point LINUXDIR to /lib/modules/<kernelversion>/, this patch should not be needed.

Now, there is one trick: in the current Buildroot, the kernel modules are only installed to $(TARGET_DIR), and when installed, the 'build' symbolic link is removed, because it points to a non-nonsensical location since the kernel sources (or kernel headers) are not installed in $(TARGET_DIR).

Quoted 5 lines

So either we need to keep your patches (but they have no chance of being upstreamed), or we install kernel modules to $(STAGING_DIR). I'm not sure if we want to do that just for the sake of openvmtools, though.

So in the end, maybe what you did is the best approach.

The open-vm-tools kernel module build system is not very cross-compilation friendly and as Karoly said in his reply [1], most of the kernel modules has been upstreamed.

Quoted 6 lines

Not sure upstream will work on this in near future. But those modules are still needed for "older" kernel.

I need to check when the vmware modules have been merged.

[1] http://lists.busybox.net/pipermail/buildroot/2015-February/119751.html

I'm not motivated anymore to add this option since openvmtools package was updated and these kernel modules are likely to break with latest stable Linux kernel...

I tried to fixes some build failures for 3.2.68 and 3.4.x but it require some invasive fixes...

So let this option disabled and recommend users to use a recent kernel with upstreamed vmware modules.

I've marked this patch as rejected in patchwork.

Thanks Karoly for the review.

Best regards,
Romain Naour

Quoted 23 lines

Best regards,
Romain

Quoted 11 lines

package/openvmtools/0008-configure-don-t-append-build-directory-to-LINUXINCLU.patch

Quoted 8 lines
package/openvmtools/0008-configure-don-t-append-build-directory-to-LINUXINCLU.patch new file +7 -0
+config BR2_PACKAGE_OPENVMTOOLS_KERNEL_MODULES
+	bool "Openvmtools Linux Kernel Modules"
+	depends on BR2_LINUX_KERNEL
+	help
+	  Build openvmtools's Linux kernel modules.
+
+comment "Openvmtools's Linux kernel modules needs a Linux kernel to be built"

needs -> need

Quoted 2 lines

Thomas

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot