Welcome! Log In Create A New Profile

Advanced

Installing realtek r8152 driver

Posted by Erik 
Installing realtek r8152 driver
May 13, 2017 02:56AM
Hi Bodhi,

I want to install a new realtek-driver for an usb-ethernetcard
It is not in firmware-realtek

It's the realtek 8152 driver
# lsusb
Bus 001 Device 004: ID aaaa:8816
Bus 001 Device 005: ID 0bda:8152 Realtek Semiconductor Corp.
Bus 001 Device 003: ID 1a40:0101 Terminus Technology Inc. 4-Port HUB
Bus 001 Device 002: ID 1a40:0101 Terminus Technology Inc. 4-Port HUB
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

I downloaded it from: http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1&PNid=55&PFid=55&Level=5&Conn=4&DownTypeID=3&GetDown=false#RTL8152B(N) --> 0007-r8152.53-2.08.0.bz2

unpacked it in /root with: tar -xvjf 0007-r8152.53-2.08.0.bz2

Did instal a buiding enviroment: apt-get install build-essentials

Tryed to do a make:
cd /root/r8152-2.08.0
./make

root@Stora2:~/r8152-2.08.0# make
make -C /lib/modules/4.10.9-kirkwood-tld-1/build SUBDIRS=/root/r8152-2.08.0 modules
make[1]: *** /lib/modules/4.10.9-kirkwood-tld-1/build: No such file or directory.  Stop.
Makefile:18: recipe for target 'modules' failed
make: *** [modules] Error 2

Are missing build dir. So i thougt i install linux-source essentials

apt-get -s install linux-source
root@Stora2:~/r8152-2.08.0# apt-get -s install  linux-source
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  linux-source-3.16
Suggested packages:
  libncurses-dev ncurses-dev libqt4-dev pkg-config
Recommended packages:
  bc
The following NEW packages will be installed:
  linux-source linux-source-3.16
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Inst linux-source-3.16 (3.16.43-2 Debian:8.8/stable [all])
Inst linux-source (3.16+63 Debian:8.8/stable [all])
Conf linux-source-3.16 (3.16.43-2 Debian:8.8/stable [all])
Conf linux-source (3.16+63 Debian:8.8/stable [all])

It looks at linux source 3.16; the kernel is 4.10.9,



If i try apt-get -s install linux-source-4.10.9


root@Stora2:/usr/share/doc# apt-get -s install  linux-source-4.10.9
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'linux-source-4.10.9-kirkwood-tld-1' for regex 'linux-source-4.10.9'
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Can you tell me where to find package with 4.10.9 build dir:

/lib/modules/4.10.9-kirkwood-tld-1/build

Thanks

Erik
Re: Installing realtek r8152 driver
May 13, 2017 06:44AM
The package linux-headers-4.10.9-kirkwood-tld-1 is installed.


Package 'linux-headers-generic' has no installation candidate
root@Stora2:~/r8152-2.08.0#

I think i need a source package but if i try i get this
root@Stora2:~/r8152-2.08.0# apt-get source linux-image-$(uname -r)
Reading package lists... Done
Building dependency tree
Reading state information... Done
Picking 'linux-source-4.10.9-kirkwood-tld-1' as source package instead of 'linux-image-4.10.9-kirkwood-tld-1'
E: Unable to find a source package for linux-source-4.10.9-kirkwood-tld-1
root@Stora2:~/r8152-2.08.0#

Re: Installing realtek r8152 driver
May 13, 2017 11:58AM
Erik,

> The package linux-headers-4.10.9-kirkwood-tld-1 is
> installed.

This headers package is what you need to start compiling the RTL8152 module in the mainline source tree:
./linux/drivers/net/usb/r8152.c

I dont think you need to download anything else.

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner
Re: Installing realtek r8152 driver
May 13, 2017 11:28PM
Re: Installing realtek r8152 driver
May 18, 2017 08:50AM
Hi Bodhi,

Thanks in advance.

I have made some steps:
Created 2 links:
ln -s /usr/src/linux-headers-4.10.9-kirkwood-tld1 /usr/src/linux
ln -s /usr/src/linux-headers-4.10.9-kirkwood-tld1/ /lib/modules/linux-headers-4.10.9-kirkwood-tld1/build

included in Makefile
CFLAGS=-I/usr/src/linux-headers-4.10.9-kirkwood-tld-1/include -I/usr/include

But still have a file not found:
root@Stora2:~/r8152-2.08.0# make r8152
cc -I/usr/src/linux-headers-4.10.9-kirkwood-tld-1/include -I/usr/include    r8152.c   -o r8152
In file included from /usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/kernel.h:6:0,
                 from /usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/list.h:8,
                 from /usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/signal.h:4,
                 from r8152.c:12:
/usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/linkage.h:7:25: fatal error: asm/linkage.h: No such file or directory
 #include <asm/linkage.h>
                         ^
compilation terminated.
<builtin>: recipe for target 'r8152' failed
make: *** [r8152] Error 1
root@Stora2:~/r8152-2.08.0#

file asm/linkage.h is in asm-generic/linkage.h
If i copy that file to asm, i an error asm/bitops
If i copy that ...
if i copy the hole asm-generic to asm, i get a bunch of errors:

root@Stora2:~/r8152-2.08.0# make r8152
cc -I/usr/src/linux-headers-4.10.9-kirkwood-tld-1/include -I/usr/include    r8152.c   -o r8152
In file included from /usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/printk.h:5:0,
                 from /usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/kernel.h:13,
                 from /usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/list.h:8,
                 from /usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/signal.h:4,
                 from r8152.c:12:
/usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/init.h:126:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'load_default_modules'
 void __init load_default_modules(void);
             ^
/usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/init.h:127:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'init_rootfs'
 int __init init_rootfs(void);
            ^
/usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/init.h:260:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'parse_early_param'
 void __init parse_early_param(void);
             ^
....



....
/usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/signal.h:271:33: error: expected declaration specifiers or '...' before 'sigset_t'
 extern void set_current_blocked(sigset_t *);
                                 ^
/usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/signal.h:272:50: error: expected ';', ',' or ')' before '*' token
 extern void __set_current_blocked(const sigset_t *);
                                                  ^
/usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/signal.h:273:12: error: storage class specified for parameter 'show_unhandled_signals'
 extern int show_unhandled_signals;
            ^
/usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/signal.h:275:8: error: redefinition of 'struct sigaction'
 struct sigaction {
        ^
In file included from /usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/asm/signal.h:4:0,
                 from /usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/uapi/linux/signal.h:4,
                 from /usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/signal.h:6,
                 from r8152.c:12:
/usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/uapi/asm-generic/signal.h:103:8: note: originally defined here
 struct sigaction {
        ^
In file included from r8152.c:12:0:
/usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/signal.h:277:2: error: unknown type name '__sighandler_t'
  __sighandler_t sa_handler;
  ^
/usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/signal.h:286:2: error: expected specifier-qualifier-list before 'sigset_t'
  sigset_t sa_mask; /* mask last for extensibility */
  ^
/usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/signal.h:275:1: warning: empty declaration
 struct sigaction {
 ^
/usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/signal.h:289:1: warning: empty declaration
 struct k_sigaction {
 ^
/usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/signal.h:307:2: error: expected specifier-qualifier-list before 'siginfo_t'
  siginfo_t info;
  ^
/usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/signal.h:305:1: warning: empty declaration
 struct ksignal {
 ^
/usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/signal.h:311:12: error: storage class specified for parameter 'get_signal'
 extern int get_signal(struct ksignal *ksig);
            ^
/usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/signal.h:312:13: error: storage class specified for parameter 'signal_setup_done'
 extern void signal_setup_done(int failed, struct ksignal *ksig, int stepping);
             ^
/usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/signal.h:313:13: error: storage class specified for parameter 'exit_signals'
 extern void exit_signals(struct task_struct *tsk);
             ^
/usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/signal.h:314:35: error: unknown type name '__sighandler_t'
 extern void kernel_sigaction(int, __sighandler_t);
                                   ^
/usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/signal.h:317:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 {
 ^
/usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/signal.h:327:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 {
 ^
/usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/signal.h:331:27: error: storage class specified for parameter 'sighand_cachep'
 extern struct kmem_cache *sighand_cachep;
                           ^
/usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/signal.h:458:43: error: expected ';', ',' or ')' before '*' token
 int restore_altstack(const stack_t __user *);
                                           ^
/usr/src/linux-headers-4.10.9-kirkwood-tld-1/include/linux/signal.h:459:21: error: expected declaration specifiers or '...' before 'stack_t'
 int __save_altstack(stack_t __user *, unsigned long);
                     ^
r8152.c:13:25: fatal error: linux/slab.h: No such file or directory
 #include <linux/slab.h> 
                         ^
compilation terminated.
<builtin>: recipe for target 'r8152' failed
make: *** [r8152] Error 1
root@Stora2:~/r8152-2.08.0#

So i think i have to search any futher....
Think i do something wrong
Attachments:
open | download - putty.log (97.6 KB)
Re: Installing realtek r8152 driver
May 19, 2017 07:15AM
Erik,

I'm not at home, so it would not be easy for me to advise why you have this error. If you could, wait for another 1-2 weeks and I will compile that module for you.

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: