How to make DKMS pass the right ARCH to 'make'? - linux

I'm trying to use DKMS to build a module. My problem is that I cannot seem to make DKMS pass the right ARCH to 'make'. It keeps using the architecture of the my OS's kernel which is armv7l. But there's no map
/usr/src/linux/arch/armv7l
It needs to look inside
/usr/src/linux/arch/arm
I have tried passing -a arm, -k 4.4.21-v7+/arm as arguments to 'dkms build', but it doesn't pass that down to 'make'. Adding BUILD_EXCLUSIVE_ARCH="arm" to /usr/src/rtl8812AU-4.3.14/dkms.conf also makes no difference.
sudo dkms build -m ${DRV_NAME} -v ${DRV_VERSION} -k 4.4.21-v7+/arm
Kernel preparation unnecessary for this kernel. Skipping...
Building module:
cleaning build area....
'make'....(bad exit status: 2)
Error! Bad return status for module build on kernel: 4.4.21-v7+ (arm)
Consult /var/lib/dkms/rtl8812AU/4.3.14/build/make.log for more information.
cat /var/lib/dkms/rtl8812AU/4.3.14/build/make.log
DKMS make.log for rtl8812AU-4.3.14 for kernel 4.4.21-v7+ (arm)
Thu Sep 29 16:36:07 UTC 2016
make ARCH=armv7l CROSS_COMPILE= -C /lib/modules/4.4.21-v7+/build M=/var/lib/dkms/rtl8812AU/4.3.14/build modules
make[1]: Entering directory '/usr/src/linux'
Makefile:606: arch/armv7l/Makefile: No such file or directory
make[1]: No rule to make target 'arch/armv7l/Makefile'. Stop.
make[1]: Leaving directory '/usr/src/linux'
Makefile:1576: recipe for target 'modules' failed
make: [modules] Error 2
How to solve this?
Thank you already

I solved this problem on a Raspberry Pi 2 with Ubuntu Mate (16.04) by symlinking the arm directory:
sudo ln -s arm armv7l
Dirty hack, but it works :)

You can pass arch by -a, --arch like this:
dkms install rtl8188fu/1.0 -j 4-a arm
Read more on man page by running man dkms or find it here:
http://manpages.ubuntu.com/manpages/bionic/man8/dkms.8.html

Related

Trying to compile adxl345 as a module in 4.4.54-ti-r93 kernel but get error

I have downloaded below debian image from latest images site
Debian 8.7 2017-03-19 4GB SD LXQT
I have attached a adxl345 accelerometer, and with user space tools its working fine.
Now I am trying to attach a kernel driver i.e in adxl345. I put the source files in
/home/debian/Desktop/adxl345
and issued make.
I get this error
root#beaglebone:/home/debian/Desktop/adxl345# make
make -C /lib/modules/4.4.54-ti-r93/build M=/home/debian/Desktop/adxl345 modules
make[1]: *** /lib/modules/4.4.54-ti-r93/build: No such file or directory. Stop.
Makefile:13: recipe for target 'default' failed
make: *** [default] Error 2
I checked
root#beaglebone:/lib/modules/4.4.54-ti-r93# ls
extra modules.builtin modules.devname modules.symbols.bin
kernel modules.builtin.bin modules.order
modules.alias modules.dep modules.softdep
modules.alias.bin modules.dep.bin modules.symbols
there is no build directory. I tried to update kernel headers
sudo apt-get install linux-headers-linux-headers-4.4.54-ti-r93
but it says
E: Unable to locate package linux-headers-linux-headers-4.4.54-ti-r93
How I am going to build the drivers?
I did not updated cache
sudo apt-get update
Once updated we can check at /lib/modules
there will be a build directory.
Now it should be building.

Arch Linux: make - no such file or directory

I have a problem by compiling a driver (WLAN-dongle Edimax ac600).
I´m using an Archlinux on my raspberry-pi and want to install my dongle for 5Ghz. During comiling the driver I get this message. I tried to install the linux-headers without success. (in other threads it will be a solution)
Here is my output of make:
[root#raspberry_pi_1 rtl8812AU]# make make ARCH=arm CROSS_COMPILE= -C
/lib/modules/4.9.43-1-ARCH/build M=/root/rtl8812AU modules make[1]:
*** /lib/modules/4.9.43-1-ARCH/build: No such file or directory. Stop. make: *** [Makefile:1576: modules] Error 2
I found out that my pi has a two-arch...-directories:
4.9.43-1-ARCH/
4.9.51-1-ARCH/
Only the second one has the build directory...
How can I fix the problem?!
thanks a lot,
a Linux noob...
[Reputation is too low to post comment]
Use uname -r to make sure which version of the kernel you use.
If it's 4.9.43 : you have newer version of the kernel and this confuse your installer. You should reboot on the 51 one
If it's 4.9.51 : You messed up your installation step and are trying to compile for an old target. You should review the compilation process and change every mention of the 4.9.43 to 4.9.51 since it's the version you use.
If you upgrade your kernel, you may have to rebuild the thing again (You may like to have script in the future ;) ) with the new kernel version.

fmem compile error with make

I am a beginner in the Linux world and I'm trying to figure out how to run the make command. I'm trying to make use of fmem (memory dump tool), and it is said that "make" must be run from a terminal in the folder.
However I get this:
root#bakie:/root/Desktop/fmem/fmem_1.6-0# make
rm -f *.o *.ko *.mod.c Module.symvers Module.markers modules.order \.*.o.cmd \.*.ko.cmd \.*.o.d
rm -rf \.tmp_versions
make -C /lib/modules/`uname -r`/build SUBDIRS=`pwd` modules
make: *** /lib/modules/3.10-3-686-pae/build: No such file or directory. Stop.
make: *** [fmem] Error 2
I used Debian (Kali ) 3.10-3-686-pae
How can i solved this error to compile ?
fmem is a module that get inserted into the kernel and through which you can access the /dev/fmem (substitute for /dev/mem which was discountinued from linux kernel 2.6 for security reasons).
Like any other kernel driver module, to compile it, you need to have the kernel headers which seem to be missing on your linux. See this link on how to install kernel headers. Once you have the kernel headers, it should compile fine.
make command works if your current directory contains Makefile named file

How to install Kernel Modules from Source Code. Error while make process

I want to install the kernel modules to lib/modules/ . Actually there has to be created a folder in lib/modules/(uname-r) after doing make modules , but there are only created 3 folders called "build", "kernel" and "source". I also get an error after make modules:
DEPMOD 3.4.79
WARNING: COULDN't open directory /lib/modules/3.4.79: No such file or direcoty
FATAL: Could not open /lib/modules/3.4.79/modules.dep.temp for writing: No suhc file or directory
make: *** [_modinst_post] Error 1
Indeed there is no directory called that, but how can I add it?
Did you try \"make modules_install\"?
to install modules
make modules_install
to install kernel
make install
Out-of-tree modules
For the benefit of future Googlers, this is what Buildroot 2018.05 does to install out-of-tree modules for LInux v4.19:
cd linux_kernel_source
mkdir -p /build/dir/default/x86_64/target/lib/modules/4.19.0/extra
/usr/bin/make -f ./scripts/Makefile.modinst
mkdir -p /build/dir/default/x86_64/target/lib/modules/4.19.0/extra
cp /build/dir/default/x86_64/build/kernel_modules-1.0/./buildroot_dep.ko /build/dir/default/x86_64/target/lib/modules/4.19.0/extra
/build/dir/default/x86_64/host/bin/x86_64-buildroot-linux-uclibc-strip --strip-debug /build/dir/default/x86_64/target/lib/modules/4.19.0/extra/buildroot_dep.ko
/bin/bash ./scripts/depmod.sh /build/dir/default/x86_64/host/sbin/depmod 4.19.0
So we can see that it uses the ./scripts/Makefile.modinst and ./scripts/depmod.sh in tree scripts, plus some ugly manual copying of the modules.
Found by building a package that contains kernel modules with V=1 and kernel_modules_package_name-reconfigure and simplifying the output commands, works every time :-).
The only missing question is how depmod was obtained, so we do another verbose build with host-kmod-reconfigure, and basically obtain:
./configure
--prefix="/build/dir/default/x86_64/host"
--sysconfdir="/build/dir/default/x86_64/host/etc"
--localstatedir="/build/dir/default/x86_64/host/var"
where the source is obtained from: https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git
In tree modules are installed with make modules_install as mentioned at: How to install Kernel Modules from Source Code. Error while make process

How do I build the ManDVD package from compressed source on Linux?

When I try to install any compressed file into Linux I never can, because:
When I execute ./configure the system says bash: ./configure: No such file or directory.
When I execute sudo ./configure the system says sudo: ./configure: command not found.
Worst , when I execute make the system says make: *** No rule to make target '/usr/lib64/qt-3.3/mkspecs/default/qmake.conf', needed by 'Makefile'. Stop.
With make install the system says make: *** No rule to make target '/usr/lib64/qt-3.3/mkspecs/default/qmake.conf', needed by 'Makefile'. Stop.
Completion: I can't install nothing that is not in the repository into my system.
Note: I use Linux Mint XFCE 13 (Maya).
What can I do to solve this unpleasant problem?
As ManDVD's Makefile says:
#############################################################################
# Makefile for building: mandvd
# Generated by qmake (1.07a) (Qt 3.3.8b) on: Sun Mar 8 18:32:50 2009
# Project: mandvd.pro
# Template: app
# Command: $(QMAKE) -o Makefile mandvd.pro
#############################################################################
Makefile was autogenerated by qmake.
I'm no expert at using qmake, but I think executing qmake will re-generate Makefile, so then you can run make && sudo make install as INSTALL file says.
You should've already discovered project is kind of messy (if not discontinued at all), so take care, and may the force be with you :)

Resources