Welcome! Log In Create A New Profile

Advanced

How to build module on 4.4.0-kirkwood-tld-1?

Posted by lcg 
lcg
How to build module on 4.4.0-kirkwood-tld-1?
January 18, 2017 06:34AM
Dear all,

can someone be so kind to enlighten me what I need to build kernel modules?

I use the jessie rootfs along with

# uname -r
4.4.0-kirkwood-tld-1

and I need a realtek r8153 kernel module (actually it is a r8152) for a usb-to-ethernet adapter which is recognized but the kernel module is missing.

# lsusb
Bus 001 Device 004: ID 0bda:8153 Realtek Semiconductor Corp.
...
[ 4.033301] usb 1-1.4: new high-speed USB device number 4 using orion-ehci
[ 4.154908] usb 1-1.4: New USB device found, idVendor=0bda, idProduct=8153
[ 4.161849] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=6
[ 4.183175] usb 1-1.4: Product: USB 10/100/1000 LAN
[ 4.192086] usb 1-1.4: Manufacturer: Realtek
[ 4.203445] usb 1-1.4: SerialNumber: 000001000000
...
[ 29.412015] usbcore: registered new interface driver cdc_ether

error message is:

make -C /lib/modules/4.4.0-kirkwood-tld-1/build SUBDIRS=/home/XXX/r8152-2.00.00 modules
make[1]: *** /lib/modules/4.4.0-kirkwood-tld-1/build: Datei oder Verzeichnis nicht gefunden. Schluss.
Makefile:13: recipe for target 'modules' failed
make: *** [modules] Error 2

thanks and best



Edited 1 time(s). Last edit at 01/18/2017 03:17PM by bodhi.
Re: How to build module on 4.4.0-kirkwood-tld-1?
January 18, 2017 07:28PM
I can't really tell you what you need, but the error message is telling you that the '/lib/modules/4.4.0-kirkwood-tld-1/build' directory doesn't exist.

-JT
lcg
Re: How to build module on 4.4.0-kirkwood-tld-1?
January 19, 2017 06:57AM
...yes yes that's clear, but kernel-headers are installed. So what is missing?

LCG

renojim Wrote:
-------------------------------------------------------
> I can't really tell you what you need, but the
> error message is telling you that the
> '/lib/modules/4.4.0-kirkwood-tld-1/build'
> directory doesn't exist.
>
> -JT
Re: How to build module on 4.4.0-kirkwood-tld-1?
January 19, 2017 04:51PM
Someday I hope to be able to build a kernel and/or modules myself, but I haven't tried so far. This might sound stupid, but what happens if you create the '/lib/modules/4.4.0-kirkwood-tld-1/build' directory before you run make? I guess the question is: What, if anything, goes in that 'build' directory before you run make?

What happens if you leave out the '-C /lib/modules/4.4.0-kirkwood-tld-1/build' and just run:
make SUBDIRS=/home/XXX/r8152-2.00.00 modules

I'd think the output of make after doing either of those things would give you a clue as to what may be missing.

-JT
Re: How to build module on 4.4.0-kirkwood-tld-1?
January 19, 2017 05:09PM
renojim Wrote:
-------------------------------------------------------
> Someday I hope to be able to build a kernel and/or
> modules myself, but I haven't tried so far. This
> might sound stupid, but what happens if you create
> the '/lib/modules/4.4.0-kirkwood-tld-1/build'
> directory before you run make? I guess the
> question is: What, if anything, goes in that
> 'build' directory before you run make?
>
> What happens if you leave out the '-C
> /lib/modules/4.4.0-kirkwood-tld-1/build' and just
> run:
> make SUBDIRS=/home/XXX/r8152-2.00.00 modules
>
> I'd think the output of make after doing either of
> those things would give you a clue as to what may
> be missing.
>
> -JT

Yes, create the "build" sub directory before compiling.

@lcg, it is probably easier if I compile that module into my kernel and upload the binary.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
lcg
Re: How to build module on 4.4.0-kirkwood-tld-1?
January 20, 2017 05:52AM
Thanks - I managed to get it working:

In another thread on http://forum.doozan.com/read.php?2,26114 I found

# ln -s /usr/src/linux-headers-4.4.0-kirkwood-tld-1/ /lib/modules/4.4.0-kirkwood-tld-1/build

ie. it is not sufficient to just create the directory.
Then take from http://www.realtek.com.tw/Downloads/downloadsView.aspx?Langid=1&PNid=13&PFid=56&Level=5&Conn=4&DownTypeID=3&GetDown=false the latest realtek module (I used an older one which failed to be built, so it should be the newest one) and run

# make modules
# modprobe r8152

within the extracted folder. It builds and installs the module automatically. Plugin the usb-to-ethernet adapter and watch the log:

Jan 20 12:38:45 XXX kernel: [ 2814.531483] usbcore: registered new interface driver r8152
Jan 20 12:39:22 XXX kernel: [ 2851.733309] usb 1-1.4: new high-speed USB device number 4 using orion-ehci
Jan 20 12:39:22 XXX kernel: [ 2851.844782] usb 1-1.4: New USB device found, idVendor=0bda, idProduct=8153
Jan 20 12:39:22 XXX kernel: [ 2851.851713] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=6
Jan 20 12:39:22 XXX kernel: [ 2851.861101] usb 1-1.4: Product: USB 10/100/1000 LAN
Jan 20 12:39:22 XXX kernel: [ 2851.867381] usb 1-1.4: Manufacturer: Realtek
Jan 20 12:39:22 XXX kernel: [ 2851.871762] usb 1-1.4: SerialNumber: 000001000000
Jan 20 12:39:22 XXX kernel: [ 2851.973347] usb 1-1.4: reset high-speed USB device number 4 using orion-ehci
Jan 20 12:39:22 XXX kernel: [ 2852.146028] r8152 1-1.4:1.0 eth1: v2.08.0 (2016/12/09)
Jan 20 12:39:22 XXX kernel: [ 2852.151567] r8152 1-1.4:1.0 eth1: This product is covered by one or more of the following patents:
Jan 20 12:39:22 XXX kernel: [ 2852.151567] US6,570,884, US6,115,776, and US6,327,625.
Jan 20 12:39:22 XXX kernel: [ 2852.151567]
Jan 20 12:39:23 XXX kernel: [ 2852.617431] usbcore: registered new interface driver cdc_ether

But maybe it makes sense to add it to the kernel permanently if others try something similar.

@Bodhi - it may be even better to add to your rootfs/kernel description a short note that if someone wants to build a kernel module, it requires:

- build-essential
- kernel headers
- create link (adjusted to kernel version):

# ln -s /usr/src/linux-headers-4.4.0-kirkwood-tld-1/ /lib/modules/4.4.0-kirkwood-tld-1/build

best
lcg

bodhi Wrote:
-------------------------------------------------------

>
> Yes, create the "build" sub directory before
> compiling.
>
> @lcg, it is probably easier if I compile that
> module into my kernel and upload the binary.
Re: How to build module on 4.4.0-kirkwood-tld-1?
January 31, 2017 04:22PM
Thanks for the info lcg! good that you've figured it out. I'll do some adjustment in the build and see if I can make it a little better for people who want to compile new modules.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
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: