From c89a2d83aa3e9af136c198daa368e3edee85c1cd Mon Sep 17 00:00:00 2001 From: Michael Haberler Date: Wed, 1 Jun 2016 22:26:50 +0200 Subject: [PATCH] address https://github.com/machinekit/machinekit-dkms/issues/3 --- README.md | 69 ------------------------------------------------------- 1 file changed, 69 deletions(-) diff --git a/README.md b/README.md index 7dee2f3..46aa796 100644 --- a/README.md +++ b/README.md @@ -106,75 +106,6 @@ apt-get update apt-get install adcreg-dkms hm2reg-uio-dkms ````` -# Note on cross-built kernels - -Out-of-tree module buils require the matching `linux-headers` package to be installed into -`/usr/src/linux-headers-`. This tree contains not only headers but several binaries -which are required for module building. - -If the kernel was cross-built typically these binaries are compiled for the build host architecture (say amd64), and -distributed to a target of say arm architecture. This causes module builds to fail with weird error messages, see [this post] (http://lists.openembedded.org/pipermail/openembedded-core/2012-June/063380.html) for a description. - -You can diagnose the issue by looking at the architecture of some binaries under `/usr/src/linux-headers-` like so: - -````bash -# we're on an arm host -root@raspberrypi:/usr/src# arch -armv7l - -# inspect important binaries -cd `/usr/src/linux-headers-`/scripts - -# these look good - note ARM architecture: -root@raspberrypi:/usr/src/linux-headers-4.1.18-rt17-v7+/scripts# file basic/bin2c basic/fixdep kallsyms recordmcount -basic/bin2c: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.32, BuildID[sha1]=d3832724ec76f419b6ef4eaaa1be41f66de480b1, not stripped -basic/fixdep: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.32, BuildID[sha1]=53c156943bdb20f3802bb91643b5d8668a490636, not stripped -kallsyms: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=517fea36cfe40942c2cff44433a2d3caef711657, not stripped -recordmcount: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.32, BuildID[sha1]=a86949572904fc070ce9291a1ffb1f850c017aba, not stripped - -# something like this hints the binaries are for the wrong architecture (note x86-64): -# file basic/fixdep kallsyms recordmcount -basic/fixdep: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=1d3b83c509da6d6365d4990becfaa421b96fe56a, stripped -kallsyms: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=161872353bf7ec325a716b54499ce5b93e8abe6b, stripped -recordmcount: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=e2fbf2e1360e0a06eb46a51f7cd2f70ebe403fe1, stripped -````` - -The issue can be fixed as follows (ugly but works): -````bash -cd `/usr/src/linux-headers- - ^ -compilation terminated. -scripts/Makefile.host:91: recipe for target 'scripts/sortextable' failed -make[1]: *** [scripts/sortextable] Error 1 -Makefile:555: recipe for target 'scripts' failed -make: *** [scripts] Error 2 -````` - -a patch over the kernel headers is needed: - -````bash -wget https://raw.githubusercontent.com/igorpecovnik/lib/next/patch/headers-debian-byteshift.patch -patch -p1 < headers-debian-byteshift.patch -make scripts -```` - -After this building out-of-tree modules should work even with cross-built kernels. - -I realize this fix is super-ugly - happy to take recommendations - -Inspired-by: https://github.com/izaakschroeder/uio_pruss -