[PATCHv2 2/2] uxen-guest-tools: fix -DMODULE not working when building uxenhc module


Martin Jansa
 

* undo the unnecessary and incomplete changes from 0001-vm-support-fix-buil=
d-for-kernel-s-5.4.patch
because with 5.15 it was still failing with:
ERROR: modpost: missing MODULE_LICENSE() in uxen-guest-tools/4.1.8-r0/uxe=
n-4.1.8-72a4af9/vm-support/linux/uxenhc/uxenhc.o

fix it properly in 0004-uxenhc-fix-DMODULE-not-working-on-module-build-co=
mma.patch

Signed-off-by: Martin Jansa <Martin.Jansa@...>
---
...m-support-fix-build-for-kernel-s-5.4.patch | 13 -----
...LE-not-working-on-module-build-comma.patch | 56 +++++++++++++++++++
.../uxen/uxen-guest-tools_4.1.8.bb | 1 +
3 files changed, 57 insertions(+), 13 deletions(-)
create mode 100644 recipes-extended/uxen/uxen-guest-tools/0004-uxenhc-fix-=
DMODULE-not-working-on-module-build-comma.patch

diff --git a/recipes-extended/uxen/uxen-guest-tools/0001-vm-support-fix-bui=
ld-for-kernel-s-5.4.patch b/recipes-extended/uxen/uxen-guest-tools/0001-vm-=
support-fix-build-for-kernel-s-5.4.patch
index a3325ce..287170c 100644
--- a/recipes-extended/uxen/uxen-guest-tools/0001-vm-support-fix-build-for-=
kernel-s-5.4.patch
+++ b/recipes-extended/uxen/uxen-guest-tools/0001-vm-support-fix-build-for-=
kernel-s-5.4.patch
@@ -34,19 +34,6 @@ index 0b9ef3f..04957a8 100644
if (!uxen_hcbase) {
ret =3D -ENOMEM;
goto out;
-@@ -149,8 +154,11 @@ static void __exit uxen_hypercall_exit(void)
- {
- }
-=20
-+
-+#define KBUILD_MODFILE "uxenhc"
-+
- module_init(uxen_hypercall_init);
- module_exit(uxen_hypercall_exit);
-+MODULE_LICENSE("GPL");
- MODULE_AUTHOR("paulian.marinca@...");
- MODULE_DESCRIPTION("uXen hypercall support");
--MODULE_LICENSE("GPL");
diff --git a/v4vvsock/v4v_vsock.c b/v4vvsock/v4v_vsock.c
index 8d80d7d..cd7e8ce 100644
--- a/v4vvsock/v4v_vsock.c
diff --git a/recipes-extended/uxen/uxen-guest-tools/0004-uxenhc-fix-DMODULE=
-not-working-on-module-build-comma.patch b/recipes-extended/uxen/uxen-guest=
-tools/0004-uxenhc-fix-DMODULE-not-working-on-module-build-comma.patch
new file mode 100644
index 0000000..60018f0
--- /dev/null
+++ b/recipes-extended/uxen/uxen-guest-tools/0004-uxenhc-fix-DMODULE-not-wo=
rking-on-module-build-comma.patch
@@ -0,0 +1,56 @@
+From 732791cb353289e37448d84503a7d62ca156f29f Mon Sep 17 00:00:00 2001
+From: Martin Jansa <Martin.Jansa@...>
+Date: Tue, 30 Nov 2021 16:33:14 +0000
+Subject: [PATCH] uxenhc: fix -DMODULE not working on module build command =
line
+
+* ATTOXEN_API_INC isn't defined anywhere in our OE builds, so the command =
line ends like this:
+
+ x86_64-oe-linux-gcc -fuse-ld=3Dbfd -fmacro-prefix-map=3D/OE/work/qemux8=
6_64-oe-linux/uxen-guest-tools/4.1.8-r0=3D/usr/src/debug/uxen-guest-tools/4=
.1.8-r0 -fdebug-prefix-map=3D/OE/work/qemux86_64-oe-li=
nux/uxen-guest-tools/4.1.8-r0=3D/usr/src/debug/uxen-guest-tools/4.1.8-r0 =
-fdebug-prefix-map=3D/OE/work/qemux86_64-oe-linux/uxen-g=
uest-tools/4.1.8-r0/recipe-sysroot=3D -fdebug-prefix-m=
ap=3D/OE/work/qemux86_64-oe-linux/uxen-guest-tools/4.1.8-r0/recipe-sysroot-=
native=3D -fdebug-prefix-map=3D/OE/work-shared/qemux86-64/kernel-source=3D=
/usr/src/kernel -Wp,-MMD,/OE/work/qemux86_64-oe-linux/uxen-guest-tools/4.1.=
8-r0/uxen-4.1.8-72a4af9/vm-support/linux/uxenhc/.hypercall.o.d -I/OE/work/q=
emux86_64-oe-linux/uxen-guest-tools/4.1.8-r0/uxen-4.1.8-72a4af9/vm-support/=
linux/include/ -I/OE/work/qemux86_64-oe-linux/uxen-guest-tools/4.1.8-r0/uxe=
n-4.1.8-72a4af9/vm-support/linux/include/uxen -I/OE/work/qemux86_64-oe-linu=
x/uxen-guest-tools/4.1.8-r0/uxen-4.1.8-72a4af9/vm-support/linux/include/uxe=
n/xen -I/OE/work-shared/qemux86-64/kernel-source/arch/x86/include -I./arch/=
x86/include/generated -I/OE/work-shared/qemux86-64/kernel-source/include -I=
./include -I/OE/work-shared/qemux86-64/kernel-source/arch/x86/include/uapi =
-I./arch/x86/include/generated/uapi -I/OE/work-shared/qemux86-64/kernel-sou=
rce/include/uapi -I./include/generated/uapi -include /OE/work-shared/qemux8=
6-64/kernel-source/include/linux/compiler-version.h -include /OE/work-share=
d/qemux86-64/kernel-source/include/linux/kconfig.h -include /OE/work-shared=
/qemux86-64/kernel-source/include/linux/compiler_types.h -D__KERNEL__ -fmac=
ro-prefix-map=3D/OE/work-shared/qemux86-64/kernel-source/=3D -Wall -Wundef =
-Werror=3Dstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common=
-fshort-wchar -fno-PIE -Werror=3Dimplicit-function-declaration -Werror=3Di=
mplicit-int -Werror=3Dreturn-type -Wno-format-security -std=3Dgnu89 -mno-ss=
e -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=3Dnone -m64 -falig=
n-jumps=3D1 -falign-loops=3D1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-sta=
ck-boundary=3D3 -mskip-rax-setup -march=3Dcore2 -mno-red-zone -mcmodel=3Dke=
rnel -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=3D=
thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-p=
ointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflo=
w -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -Wframe-lar=
ger-than=3D2048 -fstack-protector-strong -Wimplicit-fallthrough=3D5 -Wno-ma=
in -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-omit-frame-=
pointer -fno-optimize-sibling-calls -fno-stack-clash-protection -pg -mrecor=
d-mcount -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wvla -Wn=
o-pointer-sign -Wno-stringop-truncation -Wno-zero-length-bounds -Wno-array-=
bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -fno-s=
trict-overflow -fno-stack-check -fconserve-stack -Werror=3Ddate-time -Werro=
r=3Dincompatible-pointer-types -Werror=3Ddesignated-init -Wno-packed-not-al=
igned -DLX_TARGET_STANDARDVM -g -Wall -I -DMODULE -DKBUILD_BASENAME=3D'"h=
ypercall"' -DKBUILD_MODNAME=3D'"uxenhc"' -D__KBUILD_MODNAME=3Dkmod_uxenhc -=
c -o /OE/work/qemux86_64-oe-linux/uxen-guest-tools/4.1.8-r0/uxen-4.1.8-72a4=
af9/vm-support/linux/uxenhc/hypercall.o /OE/work/qemux86_64-oe-linux/uxen-g=
uest-tools/4.1.8-r0/uxen-4.1.8-72a4af9/vm-support/linux/uxenhc/hypercall.c
+
+ the important part is "-I -DMODULE" which breaks include/linux/module.h=
behavior:
+
+ /*
+ * MODULE_FILE is used for generating modules.builtin
+ * So, make it no-op when this is being built as a module
+ */
+ #ifdef MODULE
+ #define MODULE_FILE
+ #else
+ #define MODULE_FILE MODULE_INFO(file, KBUILD_MODFILE);
+ #endif
+
+ resulting in:
+
+ In file included from /OE/work-shared/qemux86-64/kernel-source/include/l=
inux/module.h:22,
+ from /OE/work/qemux86_64-oe-linux/uxen-guest-tools/4.1.=
8-r0/uxen-4.1.8-72a4af9/vm-support/linux/uxenhc/hypercall.c:3:
+ /OE/work-shared/qemux86-64/kernel-source/include/linux/module.h:183:43: =
error: expected ',' or ';' before 'KBUILD_MODFILE'
+ 183 | #define MODULE_FILE MODULE_INFO(file, KBUILD_MODFILE);
+ | ^~~~~~~~~~~~~~
+ /OE/work-shared/qemux86-64/kernel-source/include/linux/moduleparam.h:26:=
61: note: in definition of macro '__MODULE_INFO'
+ 26 | =3D __MODULE_INFO_PREFIX __stringify(tag) "=3D" =
info
+ | ^~~~
+ /OE/work-shared/qemux86-64/kernel-source/include/linux/module.h:183:25: =
note: in expansion of macro 'MODULE_INFO'
+ 183 | #define MODULE_FILE MODULE_INFO(file, KBUILD_MODFILE);
+ | ^~~~~~~~~~~
+ /OE/work-shared/qemux86-64/kernel-source/include/linux/module.h:230:34: =
note: in expansion of macro 'MODULE_FILE'
+ 230 | #define MODULE_LICENSE(_license) MODULE_FILE MODULE_INFO(license=
, _license)
+ | ^~~~~~~~~~~
+ /OE/work/qemux86_64-oe-linux/uxen-guest-tools/4.1.8-r0/uxen-4.1.8-72a4af=
9/vm-support/linux/uxenhc/hypercall.c:161:1: note: in expansion of macro 'M=
ODULE_LICENSE'
+ 161 | MODULE_LICENSE("GPL");
+ | ^~~~~~~~~~~~~~
+
+Signed-off-by: Martin Jansa <Martin.Jansa@...>
+---
+ uxenhc/Kbuild | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/uxenhc/Kbuild b/uxenhc/Kbuild
+index e418096..ef1b145 100644
+--- a/uxenhc/Kbuild
++++ b/uxenhc/Kbuild
+@@ -1,4 +1,3 @@
+ obj-m +=3D uxenhc.o
+=20
+ uxenhc-y :=3D hypercall.o
+-CFLAGS_hypercall.o :=3D -I$(ATTOXEN_API_INC)
+\ No newline at end of file
diff --git a/recipes-extended/uxen/uxen-guest-tools_4.1.8.bb b/recipes-exte=
nded/uxen/uxen-guest-tools_4.1.8.bb
index 841c71a..529efdb 100644
--- a/recipes-extended/uxen/uxen-guest-tools_4.1.8.bb
+++ b/recipes-extended/uxen/uxen-guest-tools_4.1.8.bb
@@ -12,6 +12,7 @@ SRC_URI =3D " \
file://0001-vm-support-fix-build-for-kernel-s-5.4.patch \
file://0002-vm-support-fix-build-for-kernel-s-5.15.patch \
file://0003-vm-support-fix-build-for-kernel-s-5.14.patch \
+ file://0004-uxenhc-fix-DMODULE-not-working-on-module-build-comma.patch=
\
"
=20
SRC_URI[uxen.sha384sum] =3D "be2233bc6506a23350d76c03ac28ea7ea381e1dc6ed5c=
e996e8ac71e6a3316fcaa2ed070c622618bd226f43a4d6db5d4"
--=20
2.32.0

Join meta-virtualization@lists.yoctoproject.org to automatically receive all group messages.