[Solved] Need Help Installing Driver Topic is solved

Having issues with your DietPi installation, or, found a bug? Post it here.
sledwards
Posts: 13
Joined: Fri Jan 18, 2019 6:26 pm

[Solved] Need Help Installing Driver

Post by sledwards »

I am running DietPi on an Allo Sparky and am trying to load a driver for the Anker USB 3.0 to Gigabit adapter because it did not link up after plugging into my network. Anker provided a link to Realtek and got a set of files from them. I put them in the /mnt/dietpi_userdata directory:

50-usb-realtek-net.rules compatibility.h Makefile r8152.c ReadMe.txt

After a little research about makefiles, I realized I needed to install 'make'. I managed to install 'make' after downloading this package: make_4.1-9.1_armhf.deb

After running the command 'make', I get the following:

make -C /lib/modules/3.10.38/build SUBDIRS=/mnt/dietpi_userdata/r8152-2.11.0 modules
make[1]: *** /lib/modules/3.10.38/build: No such file or directory. Stop.
Makefile:19: recipe for target 'modules' failed
make: *** [modules] Error 2

At this point and my limited amount of Linux knowledge, I ask for help.

Thanks,
Steve
Last edited by sledwards on Mon Jan 28, 2019 4:20 am, edited 1 time in total.
sledwards
Posts: 13
Joined: Fri Jan 18, 2019 6:26 pm

Re: Need Help Installing Driver

Post by sledwards »

A little bit more info. I changed to the /lib/modules/3.10.38 directory and found this (in red font) after ls -al:

lrwxrwxrwx 1 root root 66 Dec 11 2017 build -> /imxhdd/opt/1301TAG/sparky_volumio/owl/out/sparky_sd_ubuntu/kernel
User avatar
MichaIng
Site Admin
Posts: 2261
Joined: Sat Nov 18, 2017 6:21 pm

Re: Need Help Installing Driver

Post by MichaIng »

@sledwards
Btw.: You should install make from the APT repo:

Code: Select all

apt install make
You need the kernel headers to build the kernel module.

There seems to be an obsolete symlink in place (build -> /imxhdd/opt/1301TAG/sparky_volumio/owl/out/sparky_sd_ubuntu/kernel) that was most likely used to build the image from scratch, which the actual kernel headers on an external drive.

Here is how to do install them freshly on SparkySBC: https://github.com/sparkysbc/Module_build

I adjusted the steps a bid to work around the not required Git client:

Code: Select all

cd /usr/src
wget https://github.com/sparkysbc/Linux/archive/master.zip
unzip master.zip
rm master.zip
mv Linux-master Linux
rm -R /lib/modules/$(uname -r)/build
rm -R /lib/modules/$(uname -r)/source
ln -s /usr/src/Linux /lib/modules/$(uname -r)/build
cd Linux
make mrproper
wget https://raw.githubusercontent.com/sparkysbc/Module_build/master/Module.symvers
make modules_prepare
Then retry to build your driver module according to it's ReadMe.txt.
sledwards
Posts: 13
Joined: Fri Jan 18, 2019 6:26 pm

Re: Need Help Installing Driver

Post by sledwards »

@MichaIng

I ran all the commands you gave me, and when I ran the last line, I got these errors:

/usr/src/Linux/scripts/kconfig/Makefile:36: recipe for target 'silentoldconfig' failed
make[2]: *** [silentoldconfig] Error 1
/usr/src/Linux/Makefile:519: recipe for target 'silentoldconfig' failed
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target 'modules_prepare'. Stop.


Steve
sledwards
Posts: 13
Joined: Fri Jan 18, 2019 6:26 pm

Re: Need Help Installing Driver

Post by sledwards »

@MichaIng

I forgot this warning:

scripts/kconfig/conf --silentoldconfig Kconfig
***
*** Configuration file ".config" not found!
***
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
***
User avatar
MichaIng
Site Admin
Posts: 2261
Joined: Sat Nov 18, 2017 6:21 pm

Re: Need Help Installing Driver

Post by MichaIng »

Do you have the output of make mrproper still there? That should create the requested .config file, if I understood correctly.

But perhaps this is not even required, please retry the make command within your Ethernet driver dir, before going on with below.

Check find /boot -name '.config' if the boot dir has the currently active .config file. Not sure how this is on Sparky SBC, this is just what I got from the instructions.

The instructions from the link above suggest to otherwise download the default .config file (from within the Linux source dir):

Code: Select all

cd /usr/src/Linux
wget https://raw.githubusercontent.com/sparkysbc/Module_build/master/.config
sledwards
Posts: 13
Joined: Fri Jan 18, 2019 6:26 pm

Re: Need Help Installing Driver

Post by sledwards »

@MichaIng

I started from scratch from a clean DietPi install. I added the .config file and the make modules_prepare got a lot farther along until this:

include/linux/compiler-gcc.h:103:30: fatal error: linux/compiler-gcc6.h: No such file or directory
#include gcc_header(__GNUC__)
^
compilation terminated.
/usr/src/Linux/./Kbuild:35: recipe for target 'kernel/bounds.s' failed
make[1]: *** [kernel/bounds.s] Error 1
Makefile:851: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2

Steve
sledwards
Posts: 13
Joined: Fri Jan 18, 2019 6:26 pm

Re: Need Help Installing Driver

Post by sledwards »

@MichaIng

I found this in a Readme file for the driver instructions of another device using the same ax88179 chipset:

Prepare to build the driver, you need the Linux kernel sources installed on the
build machine, and make sure that the version of the running kernel must match
the installed kernel sources. If you don't have the kernel sources, you can get
it from www.kernel.org or contact to your Linux distributor. If you don't know
how to do, please refer to KERNEL-HOWTO.

Note: Please make sure the kernel is built with one of the "Support for
Host-side, EHCI, OHCI, or UHCI" option support.
sledwards
Posts: 13
Joined: Fri Jan 18, 2019 6:26 pm

Re: Need Help Installing Driver

Post by sledwards »

@MichaIng

I managed to resolve the latest error by creating a symlink :

ln -s compiler-gcc4.h compiler-gcc6.h (created it in the linux directory /usr/src/Linux/include/linux)

The make modules_prepare worked, and I was able to create the driver file r8152.ko without errors. When I try to install it using these commands:

modprob usbnet
insmod r8152.ko

This error comes back:

insmod: ERROR: could not insert module r8152.ko: Unknown symbol in module

At this point I am clueless on how to proceed, Your help so far has been great.

Steve
User avatar
MichaIng
Site Admin
Posts: 2261
Joined: Sat Nov 18, 2017 6:21 pm

Re: Need Help Installing Driver

Post by MichaIng »

Does the readme contain some pre-req modules? I found a similar error, where another module needed to be enabled first to resolve it: https://github.com/kuba-moo/mt7601u/issues/2

Perhaps modinfo r8152.ko also gives a clue.

Ahh, type dmesg directly after trying insmod r8152.ko and copy paste the last lines which should contain the Unknown symbol error(s).
Post Reply