Closed DeX77 closed 4 years ago
There are more issues. I can post a patch if someone is willing to test it.
Hi @abucodonosor, If you have a patch for kernel 5.4 I can take a look at it :)
@displaylink-dkurek
Sure, this version doesn't have all ifdef's I just made it for @DeX77 to test.
Tested and works.
From the patch: +#if KERNEL_VERSION(5, 4, 0) < LINUX_VERSION_CODE
+#else +#include <linux/dma-resv.h> +#endif
But, for linux 5.4.1: $ ls /usr/include/linux/dma-resv.h /bin/ls: cannot access '/usr/include/linux/dma-resv.h': No such file or directory
I didn't look at kernel 5.4.1 yet, but it would be strange f they changed that again.
I cannot find any patch touching these files in 5.4.1, at least not from what Greg posted there:
Hmm - I'm confused a bit. I still have linux 5.3.11, from Arch Linux, on one machine, and it also does not have a "/usr/include/linux/dma-resv.h". But, the patch was tested on linux 5.4.0, which did have the dma_resv.h? Something else must be going on here.
Do you have your kernel source ( or whatever is called in Arch Linux ) installed on your machine?
No, but I could get it. What would you like to search?
Well install that package and your build should work. You cannot build custom kernel modules without it anyway.
I may post some proper version of the patch with proper ifdef's but that is something for tomorrow.
Hmm - the Arch "linux-headers" package - as far as I know - is suppose to have everything that might be required to build kernel modules. If you believe that dma-resv.h is a reasonable build requirement for this evdi module, I will file a bug report with Arch.
That would be strange and a packaging problem I assume.
You should not have <linux/reservation.h> in your kernel-headers packages either but again I have no idea how Arch Linux package.
@displaylink-dkurek @thx1111 @DeX77
There a new version of the patch:
https://crazy.dev.frugalware.org/evdi-1.6.4-kernel-5.4.x.patch
@thx1111
The header file seems to exist in usr/lib/modules/5.4.1-arch1-1/build/include/linux/dma-resv.h but the system kernel headers are linux-api-headers which is version 5.3.1
Thanks for clarifying that. Apparently, I was looking in the wrong place. I may not be helping much.
With the new or old patch, and running $ sudo dkms install evdi/1.6.2 -k 5.4.1-arch1-1
I get an error, and have: $ cat /var/lib/dkms/evdi/1.6.2/build/make.log
DKMS make.log for evdi-1.6.2 for kernel 5.4.1-arch1-1 (x86_64)
Fri 29 Nov 2019 09:47:40 PM MST
make KBUILD_VERBOSE=1 SUBDIRS=/var/lib/dkms/evdi/1.6.2/build SRCROOT=/var/lib/dkms/evdi/1.6.2/build CONFIG_MODULE_SIG= -C /lib/modules/5.4.1-arch1-1/build modules
make[1]: Entering directory '/usr/lib/modules/5.4.1-arch1-1/build'
make -f ./scripts/Makefile.build obj=arch/x86/entry/syscalls all
make -f ./scripts/Makefile.build obj=scripts/basic
scripts/Makefile.build:42: arch/x86/entry/syscalls/Makefile: No such file or directory
make[2]: *** No rule to make target 'arch/x86/entry/syscalls/Makefile'. Stop.
make[1]: *** [arch/x86/Makefile:238: archheaders] Error 2
make[1]: *** Waiting for unfinished jobs....
rm -f .tmp_quiet_recordmcount
make[1]: Leaving directory '/usr/lib/modules/5.4.1-arch1-1/build'
make: *** [Makefile:22: all] Error 2
The lead-up to, and the line 42, are:
# The filename Kbuild has precedence over Makefile
kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile)
include $(kbuild-file)
The lines 237 and 238 are:
archheaders:
$(Q)$(MAKE) $(build)=arch/x86/entry/syscalls all
This log file is the same file as '/var/lib/dkms/evdi/1.6.2/build/make.log', where the directory holds the same set of files as '/usr/src/evdi-1.6.2/', which is "owned" by the package 'evdi-git'. The Makefile is: https://github.com/DisplayLink/evdi/blob/devel/module/Makefile
Does the dkms Makefile need to change?
@thx1111
I have no idea about dkms also I never tested the patch against evdi-1.6.2. From the error, there seems to be something wrong with your kernel source.
Just download evdi-1.6.4, patch the source and run make.
Hi @abucodonosor
Would you be interested in creating github PR for this? You could also add
an entry in travis.yml
.
I've looked at the patch. There are some things to fix.
Could you please check this:
https://github.com/DisplayLink/evdi/blob/devel/.github/PULL_REQUEST_TEMPLATE.md?
The ci/build_against_kernel
can help with compatibility with different kernels
and ci/run_style_check
with kernel-style.
They will be also checked by travis if you create a PR.
@displaylink-dkurek
Basically yes but can't do that right now, I'm sorry. I'm in the hospital and wrote the patch from my phone.
@abucodonosor, sure thing. Please take your time :)
@displaylink-dkurek
probably @DeX77 will do the PR, however, we cannot test compile these old 4.x kernels here, all broken with gcc9. I also added 5.3 to the list since it worked fine here.
building with dkms fails consistently as described by @thx1111, even with your patch applied to the latest version.
Since there's no guide to people relatively unfamiliar with kernel modules (like me) on how to install the module without dkms, I'll try to describe what I did to get it working.
download the latest repo, apply the patch from @abucodonosor and do a regular make
the build should run without errors. The kernel module should be in modules/evdi.ko
.
To insert the module into the kernel you can use insmod modules/evdi.ko
. This will be removed upon restarting the system.
To insert this module on every boot create a systemd unit file or initv script that inserts the module for you. Caution: I believe insmod bypasses version checks and if you change your kernel but try to load this module, your kernel may crash. use with caution
Disclaimer: This is merely what is working for me, and I don't really know what I'm doing so please be careful with this "advice".
Edit: if you use the displaylink.service unitfile, you need to comment out ExecStartPre=/sbin/modprobe evdi
@d3rrial
I don't and never will use dkms. So no idea what is wrong with it.
@displaylink-dkurek
is there any reason why a regular 'make install' target doesn't exist?
BTW while looking at that I found the versioning of the library is broken as well the kernel modules version is out-of-sync, want PR's for these too?
Eg these: https://dpaste.de/XGBd/raw https://dpaste.de/LPYG/raw
@d3rrial
Being bored here in hospital I've added install/uninstall & fixed versioning.
There an all-in-one patch, including the kernel 5.4 fixes: https://crazy.dev.frugalware.org/evdi-all-in-one-fixes.patch
The patch is against the latest git, but may work for 1.6.4. The following options to make have been added:
PREFIX defaults to /usr/local LIBDIR defaults to $PREFIX/lib DESTDIR defaults to nothing ( for packagers ) RUN_DEPMOD disabled by default RUN_DEPMOD=1 or =true will run depmod -a INSTALL defaults to install RM defaults to rm LN defaults to ln
HOWTO use:
1) clone the git source git clone https://github.com/DisplayLink/evdi.git 2) get the patch wget https://crazy.dev.frugalware.org/evdi-all-in-one-fixes.patch 3) patch the source cd location_you_cloned_evdi patch -Np1 <full_path_to_the_patch 4) run make 5) sudo make PREFIX=/usr RUN_DEPMOD=1 install , to install system wide. if you want to test what is doing first do something like this: make PREFIX=/usr DESTDIR=$(pwd)/TEST_DIR install , and have a look into $PWD/TEST_DIR.
I hope that helps you and @thx1111 to test the patch.
@displaylink-dkurek
That patch nothing for you in this form, it contains like 4 PR's, just a help for the users are willing to test around but have broken dkms for whatever reason.
This fixes the DKMS build.
# Fix build for kernel 5.4
sed -E -e 's:SUBDIRS=([^ ]+) :M=\1 &:g' -i 'module/Makefile'
@abucodonosor
There is no particular reason why install
target does not exist, simply no one
has added it... yet.
Sure, PR for versioning would be also nice :+1:
What is the reasoning behind reordering $(CC)
parameters? man gcc
says in
most cases, the order doesn't matter. Are we hitting the case when it actually
matters or is that just a convention?
How will the depmod
cooperate with dkms
? Will e.g. two versions of library
be handled properly by the tools themselves? Or is it simply conscious decision
to use one or another?
I would have some notes on the code changes but it will be easier to do the 'review' with the PR.
@severach Thanks! Is this something new or are we missing it from the very beginning?
Up to kernel 5.3 SUBDIRS=$(PWD) generates a warning. As of Kernel 5.4 SUBDIRS=$(PWD) is ignored and only M=$(PWD) is used. M= is being supplied for the standard make. The DKMS make is still supplying SUBDIRS=, not M=. This fix adds M= to the DKMS make. I suspect that some other M= can be removed.
depmod
is performed by dkms
where specified. It's all managed by the package managers and dkms.
There is no particular reason why
install
target does not exist, simply no one has added it... yet.
Ok, so a PR for install part too.
Sure, PR for versioning would be also nice
Sure.
What is the reasoning behind reordering
$(CC)
parameters?man gcc
says in most cases, the order doesn't matter. Are we hitting the case when it actually matters or is that just a convention?
I can let it as is should work too, however since we are missing LDFLAGS in the link I reordered everything to look sane.
How will the
depmod
cooperate withdkms
? Will e.g. two versions of library be handled properly by the tools themselves? Or is it simply conscious decision to use one or another?
In my patch, depmod is within the !dkms block. Basically packagers do not want to run depmod that is done by the package manager.
I am not sure but DKMS should take care of depmod by itself. Also, I don't use DKMS so I have not really an idea what DKMS is really doing.
I would have some notes on the code changes but it will be easier to do the 'review' with the PR.
Like I've said, this need be like 4 PR's, I made it that way for now bc I am limited in what I can do from here and to help the users to test around.
@severach
Does M= work with kernels as old as 4.2? If not we may need to add some helper function to get the kernel version.
M= without SUBDIRS= works on 3.16. In many of my kernel packages I specify both because I use SUBDIRS to detect if running regular or kernel make.
@abucodonosor Thank you for the patch. I am running evdi and evdi-kernel (repackaged via SlackBuild script) on Slackware64-current with kernel 5.4.2 and evdi 1.6.4. Your patch worked without any issues. I will test my USB 3.0 docking station tomorrow and may post if there are any issues
Same issue:
Mon 06 Jan 2020 08:38:38 AM CET
make: Entering directory '/usr/src/linux-headers-5.4.0-1-amd64'
AR /var/lib/dkms/evdi/1.6.4+dfsg/build/built-in.a
CC [M] /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_drv.o
CC [M] /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_modeset.o
CC [M] /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_connector.o
CC [M] /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_encoder.o
CC [M] /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_main.o
CC [M] /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_fb.o
CC [M] /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_gem.o
CC [M] /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_painter.o
CC [M] /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_params.o
CC [M] /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_cursor.o
CC [M] /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_debug.o
CC [M] /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_ioc32.o
In file included from /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_fb.c:28:
/var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_drv.h:23:10: fatal error: linux/reservation.h: No such file or directory
23 | #include <linux/reservation.h>
| ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [/usr/src/linux-headers-5.4.0-1-common/scripts/Makefile.build:270: /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_fb.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_encoder.c:18:
/var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_drv.h:23:10: fatal error: linux/reservation.h: No such file or directory
23 | #include <linux/reservation.h>
| ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_gem.c:12:
/var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_drv.h:23:10: fatal error: linux/reservation.h: No such file or directory
23 | #include <linux/reservation.h>
| ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_connector.c:20:
/var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_drv.h:23:10: fatal error: linux/reservation.h: No such file or directory
23 | #include <linux/reservation.h>
| ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_drv.c:16:
/var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_drv.h:23:10: fatal error: linux/reservation.h: No such file or directory
23 | #include <linux/reservation.h>
| ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [/usr/src/linux-headers-5.4.0-1-common/scripts/Makefile.build:270: /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_encoder.o] Error 1
make[2]: *** [/usr/src/linux-headers-5.4.0-1-common/scripts/Makefile.build:270: /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_gem.o] Error 1
make[2]: *** [/usr/src/linux-headers-5.4.0-1-common/scripts/Makefile.build:270: /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_connector.o] Error 1
make[2]: *** [/usr/src/linux-headers-5.4.0-1-common/scripts/Makefile.build:270: /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_drv.o] Error 1
In file included from /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_painter.c:15:
/var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_drv.h:23:10: fatal error: linux/reservation.h: No such file or directory
23 | #include <linux/reservation.h>
| ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_cursor.c:28:
/var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_drv.h:23:10: fatal error: linux/reservation.h: No such file or directory
23 | #include <linux/reservation.h>
| ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_modeset.c:22:
/var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_drv.h:23:10: fatal error: linux/reservation.h: No such file or directory
23 | #include <linux/reservation.h>
| ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [/usr/src/linux-headers-5.4.0-1-common/scripts/Makefile.build:270: /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_painter.o] Error 1
make[2]: *** [/usr/src/linux-headers-5.4.0-1-common/scripts/Makefile.build:270: /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_cursor.o] Error 1
In file included from /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_main.c:16:
/var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_drv.h:23:10: fatal error: linux/reservation.h: No such file or directory
23 | #include <linux/reservation.h>
| ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [/usr/src/linux-headers-5.4.0-1-common/scripts/Makefile.build:270: /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_modeset.o] Error 1
make[2]: *** [/usr/src/linux-headers-5.4.0-1-common/scripts/Makefile.build:270: /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_main.o] Error 1
In file included from /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_ioc32.c:28:
/var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_drv.h:23:10: fatal error: linux/reservation.h: No such file or directory
23 | #include <linux/reservation.h>
| ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [/usr/src/linux-headers-5.4.0-1-common/scripts/Makefile.build:270: /var/lib/dkms/evdi/1.6.4+dfsg/build/evdi_ioc32.o] Error 1
make[1]: *** [/usr/src/linux-headers-5.4.0-1-common/Makefile:1665: /var/lib/dkms/evdi/1.6.4+dfsg/build] Error 2
make: *** [/usr/src/linux-headers-5.4.0-1-common/Makefile:179: sub-make] Error 2
make: Leaving directory '/usr/src/linux-headers-5.4.0-1-amd64'
@BramFr
use patch from https://github.com/DisplayLink/evdi/issues/172#issuecomment-561394805
Thanks @abucodonosor! I had to install the libdrm-devel package to fix a libdrm/drm.h dependency. Aside from that, your instructions in https://github.com/DisplayLink/evdi/issues/172#issuecomment-561394805 worked for me with kernel-5.4.8-200.fc31.x86_64.
@djschaap
The naming of these packages is a distro thing. Its why I didn't add that to the small howto.
Fedora 31 5.4.7-200.fc31 rpm install and dkms install with all the patches applied fails : error below C&P make.log make -f ./scripts/Makefile.modbuiltin obj=kernel/livepatch make -f ./scripts/Makefile.modbuiltin obj=drivers/accessibility scripts/Kbuild.include:120: Recursive variable 'CC_OPTION_CFLAGS' references itself (eventually). Stop. make[1]: [Makefile:1300: _modbuiltin_arch/x86] Error 2
@teutonius
for DKMS see https://github.com/DisplayLink/evdi/issues/172#issuecomment-561964789
@abucodonosor How are you? Hope you are well :) Do you think we are ready to transform this patch into PRs?
@displaylink-dkurek
I just got home from the hospital today. I'm better now. I can try to do a PR(s) this week.
How to split?
Kernel modules PR Kernel modules install part Lib install part Lib versioning Kernel module versioning And shall I do this DKMS stuff too?
Glad to hear that.
Yes, this sounds reasonable. DKMS too, if you are willing to :) Lets split them and we can review them more easily one by one. Thanks!
Hi all, I'd like to know if it's possible to build the module in 5.4.0-9-generic
?
I'm getting:
./displaylink-driver-5.2.14.run
Verifying archive integrity... 100% All good.
Uncompressing DisplayLink Linux Driver 5.2.14 100%
DisplayLink Linux Software 5.2.14 install script called: install
Distribution discovered: Ubuntu Focal Fossa (development branch)
Installing
Configuring EVDI DKMS module
Registering EVDI kernel module with DKMS
Building EVDI kernel module with DKMS
ERROR (code 3): Failed to build evdi/5.2.14. Consult /var/lib/dkms/evdi/5.2.14/build/make.log for details..
where the error section is:
make -f ./scripts/Makefile.modbuiltin obj=drivers/acpi/apei
make -f ./scripts/Makefile.modbuiltin obj=drivers/acpi/dptf
make -C /usr/src/linux-headers-5.4.0-9-generic/tools/build CFLAGS= LDFLAGS= /usr/src/linux-headers-5.4.0-9-generic/tools/objtool/fixdep
(for m in ; do echo $m; done; \
cat /dev/null samples/vfio-mdev/modules.builtin) > samples/modules.builtin
make -f ./scripts/Makefile.modbuiltin obj=drivers/acpi/hmat
(for m in ; do echo $m; done; \
cat /dev/null ) > drivers/android/modules.builtin
(for m in ; do echo $m; done; \
cat /dev/null ) > security/integrity/evm/modules.builtin
(for m in ; do echo $m; done; \
cat /dev/null ) > fs/debugfs/modules.builtin
make -f ./scripts/Makefile.modbuiltin obj=crypto/asymmetric_keys
make -f ./scripts/Makefile.modbuiltin obj=arch/x86/entry
make -f ./scripts/Makefile.modbuiltin obj=drivers/auxdisplay
make -f ./scripts/Makefile.modbuiltin obj=fs/devpts
(for m in drivers/ata/libata.ko drivers/ata/ata_piix.ko drivers/ata/pata_sis.ko drivers/ata/ata_generic.ko; do echo $m; done; \
cat /dev/null ) > drivers/ata/modules.builtin
(for m in ; do echo $m; done; \
cat /dev/null ) > security/integrity/ima/modules.builtin
make -f ./scripts/Makefile.modbuiltin obj=kernel/debug/kdb
(for m in ; do echo $m; done; \
cat /dev/null ) > drivers/acpi/apei/modules.builtin
(for m in ; do echo $m; done; \
cat /dev/null ) > drivers/acpi/dptf/modules.builtin
/usr/src/linux-headers-5.4.0-9-generic/tools/build/Makefile.build:37: /usr/src/linux-headers-5.4.0-9-generic/tools/build/Build.include: No such file or directory
make[5]: *** No rule to make target '/usr/src/linux-headers-5.4.0-9-generic/tools/build/Build.include'. Stop.
make[4]: *** [Makefile:43: /usr/src/linux-headers-5.4.0-9-generic/tools/objtool/fixdep-in.o] Error 2
make[3]: *** [/usr/src/linux-headers-5.4.0-9-generic/tools/build/Makefile.include:5: fixdep] Error 2
make[2]: *** [Makefile:67: objtool] Error 2
make[1]: *** [Makefile:1783: tools/objtool] Error 2
thanks for any tip and keep it up!
@matheo that error goes away when you add the M= parameter as https://github.com/DisplayLink/evdi/issues/172#issuecomment-561964789 suggests.
Hi @abucodonosor, kernel 5.5 is out, we are getting a bit behind. Would you mind if we took you patch and integrate into EVDI?
@displaylink-dkurek
no, feel free to use the patch.
( btw 5.5 need another round of fixes but is just a matter of includes soring and a small code fix )
OK, so update for kernel 5.4, 5.5 and changes for DKMS build landed on devel. Hopefully I haven't missed anything :)
@displaylink-dkurek
Thank you.
( PS: On missing stuff, you can always blame me :D )
@abucodonosor thanks for the patch :) Closing.
For the people like me who out of the loop a bit. What do I need to do to install on Kernel 5.4 the latest DisplayLink package downloaded from the DisplayLink website?
@nikodll
either the patches posted in this issue against released code, or you clone the git repository and compile from there.
evdi 1.6.4 fails to build on kernel 5.4:
module/evdi_drv.h:23:10: fatal error: linux/reservation.h: No such file or directory