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

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.

Related

Build custom driver for linux

I am new to building C lib and have mostly worked with python. My goal is to take the source code from https://github.com/torvalds/linux and build a custom driver for USB/IP (https://github.com/torvalds/linux/tree/master/drivers/usb/usbip) module (some modification).
I copied only /tool/usbip/ assuming that USB and USB-IP are already present in the alpine.
I have set up a docker Image:
FROM alpine
COPY . .
RUN apk add build-base autoconf automake libtool eudev-dev libusb-dev
WORKDIR /tool/usbip/
RUN ./autogen.sh
RUN ./configure
RUN make install
I am getting the following error for make install:
Step 7/7 : RUN make install
---> Running in 48f53c225a99
Making install in libsrc
make[1]: Entering directory '/tool/usbip/libsrc'
CC libusbip_la-names.lo
In file included from names.c:23:
usbip_common.h:18:10: fatal error: linux/usb/ch9.h: No such file or directory
18 | #include <linux/usb/ch9.h>
| ^~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [Makefile:459: libusbip_la-names.lo] Error 1
make[1]: Leaving directory '/tool/usbip/libsrc'
make: *** [Makefile:500: install-recursive] Error 1
This could mean that alpine doesn't have a USB drive. How do I compile and install the driver in that docker?
Another solution can be to build the entire Linux code from the repo, but can I use alpine and add a USB-IP driver there, as I can see that alpine is very lightweight?
I see some Kconfig and Makefile, but I need guidance on building the required driver, as my task also requires modifying drivers/USB/usbip code and building the driver for usbip.
Some blog links or youtube videos on build drivers will also help, but I was not able to find any good resources online.
Updated docker file:
FROM alpine:latest
COPY . /linux
RUN apk add build-base autoconf \
automake libtool eudev-dev \
linux-headers flex bison gmp-dev \
mpc1-dev mpfr-dev
WORKDIR /linux
RUN zcat /proc/config.gz > .config
RUN make olddefconfig
RUN make modules_prepare
RUN make M=drivers/usb/usbip modules
WORKDIR /linux/tools/usb/usbip/
RUN ./autogen.sh
RUN ./configure
RUN make install
Download kernel sources and go to its root.
Copy .config for system you want to build for. E.g. if it is your running system and it provides /proc/config.gz then zcat /proc/config.gz > .config
make olddefconfig
Ensure CONFIG_USBIP and other modules are enabled as a modules:
$ grep CONFIG_USBIP .config
CONFIG_USBIP_CORE=m
CONFIG_USBIP_VHCI_HCD=m
CONFIG_USBIP_VHCI_HC_PORTS=8
CONFIG_USBIP_VHCI_NR_HCS=1
CONFIG_USBIP_HOST=m
# CONFIG_USBIP_DEBUG is not set
If not, run make nconfig (or make menuconfig), navigate to Device Drivers->USB support->USB/IP support and enable it as a module (<M>); save configuration.
make modules_prepare
make M=drivers/usb/usbip modules
Your modules are in drivers/usb/usbip/

make ARCH=x86_64 CROSS_COMPILE ....... Error 2 while installing rtl8723de wifi drivers

I was trying to install rtl8712de wifi drivers in my Debian 10 PC.
I tried the following code:
sudo apt update
git clone https://github.com/smlinux/rtl8723de.git
cd rtl8723de
make
After I ran the make command, I got the following error:
make ARCH=x86_64 CROSS_COMPILE= -C /lib/modules//build M=/home/dantu/Downloads/rtl8723de modules
make[1]: *** /lib/modules//build: No such file or directory. Stop.
make: *** [Makefile:1886: modules] Error 2
I tried so many steps online. I installed gcc build tools, updated all my packages, tried other repositories for the wifi drivers. But nothing seems to help.
It might solve the problem to change all occurrences of /lib/modules//build inside the Makefile with /lib/modules/build or /lib/modules/your_kernel_version/build. //build seem like a typo.

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.

Build mozilla JSS

I followed NSS build instructions and built NSS successfully.
Then I follow JSS build instructions and building fails with error:
In file included from CryptoManager.c:6:0:
../../../../dist/public/nss/secitem.h:15:21: fatal error: plarena.h: No such file or directory
compilation terminated.
This result is on Ubuntu 16.04 LTS.
On WIndows I get:
All directories (dist, jss, nspr and nss) are on the same level.
What am I doing wrong?
Check my post here. Basically it's due to missing packages. If not working, this file is somewhere under nspr. Copy it and place it beside the .c file which needs it.
EDIT:
To sum it up:
1. Install build-essential and gcc with g++.
2. Try to install zlib1g-dev and libc6-dev, if they are absent.
3. And, install zlib1g-dev.
4. cd into the nss directory, and run the build like this:
gmake nss_build_all NSS_SSL_ENABLE_ZLIB=
if you are under a x64 environment, add USE_64=1, too.
It should work.

installing QODBC driver for linux

I am trying to install QODBC drivers on ubuntu 13.10 for Qt 5.0.2. I have followed the official documentation (see http://qt-project.org/doc/qt-5/sql-driver.html#qodbc) but am stuck at one of the steps. When I try to do
qmake "INCLUDEPATH+=/usr/local/unixODBC/include" "LIBS+=-L/usr/local/unixODBC/lib -lodbc"
it just shows me the help manual for qmake and does nothing.
So I tried to make an empty Makefile and then passed it as an argument
qmake "INCLUDEPATH+=/usr/local/unixODBC/include" "LIBS+=-L/usr/local/unixODBC/lib -lodbc" Makefile
when I try to "make" the generated Makefile, it shows the following errors:
Makefile:183: warning: overriding commands for target `Makefile'
Makefile:130: warning: ignoring old commands for target `Makefile'
make: Circular Makefile <- Makefile dependency dropped.
make: Circular Makefile <- Makefile dependency dropped.
make: Nothing to be done for `first'.
I have just managed to make the odbc driver installation. The main problem here seems to be that you are not including the "pro" target file.
Here all the steps are:
Go to odbc pluggin path. In my case: cd ~/Qt/5.3/Src/qtbase/src/plugins/sqldrivers/odbc
Run qmake including the target LIB paths and also the pro file:
~/Qt/5.3/gcc_64/bin/qmake -makefile "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lodbc" odbc.pro
make and then sudo make install
I hope it will be usefull.
Regards,

Resources