[Devel] [PATCH] ve: Revisit the Makefiles to allow Kpatch-based builds too

Evgenii Shatokhin eshatokhin at odin.com
Wed Sep 30 07:28:33 PDT 2015


When I try to prepare a binary patch for vzkernel 3.10.0-229.7.2* with
Kpatch, the kernel fails to build. Here are the commands and the
relevant part of the output:

--------------------
$kpatch-build \
  --sourcerpm=vzkernel-3.10.0-123.1.2.vz7.4.9.test01.src.rpm \
  e1000-add-dummy-allocator-to-fix-race-condition.patch

  exec gcc -Wp,-MD,kernel/ve/vznetstat/.vznetstat.o.d -nostdinc
  -isystem /usr/lib/gcc/x86_64-redhat-linux/4.8.3/include
<...>
  -I/usr/local/share/kpatch/patch -ffunction-sections -fdata-sections
  -DMODULE '-DKBUILD_STR(s)=#s'
  '-DKBUILD_BASENAME=KBUILD_STR(vznetstat)'
  '-DKBUILD_MODNAME=KBUILD_STR(vznetstat)' -c -o
   kernel/ve/vznetstat/.tmp_vznetstat.o
   /home/user/.kpatch/src/kernel/ve/vznetstat/vznetstat.c
  Assembler messages:
  Fatal error: can't create kernel/ve/vznetstat/.tmp_vznetstat.o:
  No such file or directory
  make[3]: *** [kernel/ve/vznetstat/vznetstat.o] Error 2
  make[2]: *** [kernel/ve] Error 2
  make[1]: *** [kernel] Error
--------------------

The directories kernel/ve/vznetstat/ and kernel/ve/dummy/ were not
created in the build tree automatically in this case. If I create
these directories manually, the build completes successfully.

kpatch-build only provides thin wrappers for the compiler and such
to copy the resulting object files elsewhere. The kernel build
system is then used as is, so the problem is likely not in Kpatch.

kernel/ve/Makefile refers to vznetstat/* and dummy/* directly.

This patch makes sure these directories are explicitly added to the
build system. In my experiments, that was enough for both the normal
kernel builds and the Kpatch-based builds to complete successfully.

Note that *vznetstat*.ko modules will now be built in
kernel/ve/vznetstat/ rather than in kernel/ve/ as before, same for
the modules in kernel/ve/dummy/. As long as these modules are loaded
using modprobe and without explicit paths, it should be OK.

https://jira.sw.ru/browse/PSBM-40069

Signed-off-by: Evgenii Shatokhin <eshatokhin at odin.com>
---
 kernel/ve/Makefile           | 6 ++----
 kernel/ve/dummy/Makefile     | 9 +++++++++
 kernel/ve/vznetstat/Makefile | 7 +++++++
 3 files changed, 18 insertions(+), 4 deletions(-)
 create mode 100644 kernel/ve/dummy/Makefile
 create mode 100644 kernel/ve/vznetstat/Makefile

diff --git a/kernel/ve/Makefile b/kernel/ve/Makefile
index 718cc36..56da930 100644
--- a/kernel/ve/Makefile
+++ b/kernel/ve/Makefile
@@ -13,7 +13,7 @@ vzmon-objs = vecalls.o
 obj-$(CONFIG_VZ_DEV) += vzdev.o
 obj-$(CONFIG_VZ_EVENT) += vzevent.o
 
-obj-$(CONFIG_VE_NETDEV_ACCOUNTING) += vznetstat/vznetstat.o vznetstat/ip_vznetstat.o vznetstat/ip6_vznetstat.o
+obj-$(CONFIG_VE_NETDEV_ACCOUNTING) += vznetstat/
 
 obj-$(CONFIG_VZ_LIST) += vzlist.o
 obj-$(CONFIG_VE_CALLS) += vzstat.o
@@ -22,6 +22,4 @@ obj-$(CONFIG_VZ_IOLIMIT) += vziolimit.o
 
 obj-$(CONFIG_VE_IPTABLES) += ve.o
 
-obj-m += dummy/ip6_vzprivnet.o
-obj-m += dummy/ip_vzprivnet.o
-obj-m += dummy/pio_nfs.o
+obj-y += dummy/
diff --git a/kernel/ve/dummy/Makefile b/kernel/ve/dummy/Makefile
new file mode 100644
index 0000000..8fcdba6
--- /dev/null
+++ b/kernel/ve/dummy/Makefile
@@ -0,0 +1,9 @@
+#
+# kernel/ve/Makefile
+#
+# Copyright (c) 2000-2015 Parallels IP Holdings GmbH
+#
+
+obj-m += ip6_vzprivnet.o
+obj-m += ip_vzprivnet.o
+obj-m += pio_nfs.o
diff --git a/kernel/ve/vznetstat/Makefile b/kernel/ve/vznetstat/Makefile
new file mode 100644
index 0000000..95e4da1
--- /dev/null
+++ b/kernel/ve/vznetstat/Makefile
@@ -0,0 +1,7 @@
+#
+# kernel/ve/Makefile
+#
+# Copyright (c) 2000-2015 Parallels IP Holdings GmbH
+#
+
+obj-$(CONFIG_VE_NETDEV_ACCOUNTING) += vznetstat.o ip_vznetstat.o ip6_vznetstat.o
-- 
2.3.2




More information about the Devel mailing list