Results 1 to 14 of 14

Thread: linux-headers problem compiling drivers on RasPI 2 w/ Kali 2.01

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    2015-Aug
    Posts
    15

    [SOLVED] linux-headers problem compiling drivers on RasPI 2 w/ Kali 2.01

    Hi all, to natively build wifi drivers and other nice things I need the linux-headers matching the current kernel.
    Kali 2.01 ARM for RasPI 2 uses kernel 3.18.16-v7 but repos include 4.0.0-kali1-armmp
    Someone already found some quick workaround?
    Thanks,
    OS

    Code:
    # uname -r
    3.18.16-v7
    
    # apt-cache search linux-headers
    linux-headers-4.0.0-kali1-all - All header files for Linux 4.0 (meta-package)
    linux-headers-4.0.0-kali1-all-armhf - All header files for Linux 4.0 (meta-package)
    linux-headers-4.0.0-kali1-armmp - Header files for Linux 4.0.0-kali1-armmp
    linux-headers-4.0.0-kali1-armmp-lpae - Header files for Linux 4.0.0-kali1-armmp-lpae
    linux-headers-4.0.0-kali1-common - Common header files for Linux 4.0.0-kali1
    linux-headers-armmp - Header files for Linux armmp configuration (meta-package)
    linux-headers-armmp-lpae - Header files for Linux armmp-lpae configuration (meta-package)
    
    # apt-cache show linux-headers-armmp
    Package: linux-headers-armmp
    Source: linux-latest (65+kali1)
    Version: 4.0+65+kali1
    Architecture: armhf
    Maintainer: Debian Kernel Team <[email protected]>
    Installed-Size: 29
    Depends: linux-headers-4.0.0-kali1-armmp
    Priority: optional
    Section: kernel
    Filename: pool/main/l/linux-latest/linux-headers-armmp_4.0+65+kali1_armhf.deb
    Size: 5416
    SHA256: 27e2b1f0440315669a4da26287d407b2fb551f4f0fd72a2fbf2d8584d076be5b
    SHA1: c24694aae705c3c55441e8fc83c435de4fe5c017
    MD5sum: 98db35f08a805f7637691f35df3e2e36
    Description: Header files for Linux armmp configuration (meta-package)
     This package depends on the architecture-specific header files for the
     latest Linux kernel armmp configuration.
    Description-md5: 259e27743bc84596a626e7a27da2136a
    Code:
    # git clone https://github.com/dz0ny/rt8192cu.git
    # cd rt8192cu
    # make
    make ARCH=armv7l CROSS_COMPILE= -C /lib/modules/3.18.16-v7/build M=/root/Downloads/rt8192cu  modules
    make[1]: *** /lib/modules/3.18.16-v7/build: No such file or directory.  Stop.
    Makefile:584: recipe for target 'modules' failed
    make: *** [modules] Error 2
    Last edited by ovosodo; 2015-08-25 at 18:23. Reason: Marked SOLVED

  2. #2
    would like to know this as well

    Thanks !

  3. #3
    Join Date
    2014-Feb
    Posts
    309
    Due to the way the image is created, there's an issue with the lib/modules/$(uname -r)/{build,source} directories - they point to my home directory instead of the place in the actual system.

    What you want to do is 'rm /lib/modules/$(uname -r)/{build,source}'; ln -s /usr/src/kernel /lib/modules/$(uname -r)/{build,source}

  4. #4
    Join Date
    2015-Aug
    Posts
    15
    Quote Originally Posted by steev View Post
    Due to the way the image is created, there's an issue with the lib/modules/$(uname -r)/{build,source} directories - they point to my home directory instead of the place in the actual system.

    What you want to do is 'rm /lib/modules/$(uname -r)/{build,source}'; ln -s /usr/src/kernel /lib/modules/$(uname -r)/{build,source}
    Great steev, I didn't notice wrong $(uname -r)/{build,source} symlinks.

    Well, this is a step forward, but still doesn't solve my driver build issue, maybe linux-headers aren't enough:
    Code:
    root@kali:~/Downloads# cd rt8192cu/
    root@kali:~/Downloads/rt8192cu# make
    make ARCH=armv7l CROSS_COMPILE= -C /lib/modules/3.18.16-v7/build M=/root/Downloads/rt8192cu  modules
    make[1]: Entering directory '/usr/src/kernel'
    Makefile:610: 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/kernel'
    Makefile:584: recipe for target 'modules' failed
    make: *** [modules] Error 2

  5. #5
    Join Date
    2014-Feb
    Posts
    309
    try with ARCH=arm - armv7l is an Arch Linux thing.

    That said - what's wrong with the rtl8192cu driver that's already part of the kernel?

  6. #6
    Join Date
    2015-Aug
    Posts
    15
    Quote Originally Posted by steev View Post
    try with ARCH=arm - armv7l is an Arch Linux thing.

    That said - what's wrong with the rtl8192cu driver that's already part of the kernel?
    Thanks steev, ARCH=arm solves the problem, however none of the 8188cus git repos I tryed builds successfully on Rpi Kali2, so I gived up on this way and found an alternative solution which doesn't require builds or linux-headers.
    I'm sure having solved the linux-headers issue will be useful anyway sooner or later

    My goal is to build some headless, cableless, portable Rpi2 using Kali2. This seems a hot topic, but none of the solutions I found are satisfying.
    I would like to use my 3G tablet or smartphone to connect to the Rpi using ssh, while being able to use the 3G internet connection both from the tablet/phone and the Rpi.

    As a poor man temporary solution, I activated an ad-hoc connection on the Rpi, it's simple but has security and connectivity problems.
    In the next spare time I will activate on the Rpi a wpa2 client which connects to the mobile hotspot, so I will solve my goals of ssh access to Rpi and internet connectivity on both devices.

    Maybe it's better to open a new topic on this.
    Thank you,
    OS

  7. #7
    Join Date
    2014-Feb
    Posts
    309
    I would suggest using a better wifi card for that case. the rtl8188 cards are **** for anything more than just connecting to a wireless network.

  8. #8
    Join Date
    2015-Sep
    Posts
    8
    @ovosodo Where is the solution (though it is marked as solved) ??

    I recently installed Kali 2.0.1 on RPi2 which has kernel version 3.18.16-v7.
    I need the linux-headers to 'make' the wifi dongle drivers.
    But the original repos have headers for kernel 4+.

    Alternatively, I found a repo for headers here
    http://www.niksula.hut.fi/~mhiienka/...x-headers-rpi/
    But unable to install due to unmet dependencies.

    Please help @g0tmi1k

  9. #9
    Join Date
    2014-Feb
    Posts
    309
    The 2.0 images have the kernel sources available in /usr/src/kernel - you need to go into /lib/modules/3.18.16-v7/ and correct the build and source symlinks to point to /usr/src/kernel

    The first response from me in the thread says as much (thus solved)

  10. #10
    Join Date
    2015-Sep
    Posts
    8
    Thanks for the clarification @steev
    My doubt was that @ovosodo still reports errors during compiling.
    Is that a specific bug for the chipset wifi cards ?

    So as per your post (#3) the linux-header modules/files/dependencies for 'make' are already available but is pointing to the wrong path.
    The two commands to be run to correct this are

    rm /lib/modules/$(uname -r)/{build,source}

    ln -s /usr/src/kernel /lib/modules/$(uname -r)/{build,source}

  11. #11
    Join Date
    2014-Feb
    Posts
    309
    He's saying that none of the drivers that he found work - honestly, I have no idea what repos he's tried/trying, and that card is a piece of ****. There's a reason why people don't recommend those cards over something with an atheros or rt3070 chipset in them.

  12. #12
    Join Date
    2015-Aug
    Posts
    15
    Quote Originally Posted by steev View Post
    He's saying that none of the drivers that he found work - honestly, I have no idea what repos he's tried/trying, and that card is a piece of ****. There's a reason why people don't recommend those cards over something with an atheros or rt3070 chipset in them.
    Sorry for my absence.
    The repo I tried was https://github.com/dz0ny/rt8192cu.git
    The focus of the thread (linux-headers problem) was solved thanks to steev's hint (wrong symlinks in the Kali image).
    As I said I turned to a workaround solution which doesn't require a wifi driver rebuild, so I didn't solve the RTL81* specific wifi driver rebuild issue.
    I have a dozen of different RTL8188* and RTL8192* adapters laying around. They are nice, small and low-power. However due to chipset and antenna limitations the only acceptable use I found is on a portable headless Rpi2, to connect nearby to a tethering smartphone.
    OS

  13. #13
    Join Date
    2015-Sep
    Posts
    8
    Still no luck for me.
    Here is what I did. Trying to compile drivers for MT7601U chipset wifi usb dongle on Kali2.0.1 on RPi2

    Code:
    root@kali:~/Downloads# rm /lib/modules/$(uname -r)/build
    root@kali:~/Downloads# rm /lib/modules/$(uname -r)/source
    root@kali:~/Downloads# ln -s /usr/src/kernel /lib/modules/$(uname -r)/build
    root@kali:~/Downloads# ln -s /usr/src/kernel /lib/modules/$(uname -r)/source
    Code:
    root@kali:~/Downloads# git clone https://github.com/porjo/mt7601.git
    Cloning into 'mt7601'...
    remote: Counting objects: 449, done.
    remote: Compressing objects: 100% (3/3), done.
    remote: Total 449 (delta 0), reused 0 (delta 0), pack-reused 446
    Receiving objects: 100% (449/449), 1.58 MiB | 316.00 KiB/s, done.
    Resolving deltas: 100% (173/173), done.
    Checking connectivity... done.
    root@kali:~/Downloads# cd mt7601/src
    root@kali:~/Downloads/mt7601/src# make
    make -C tools
    make[1]: Entering directory '/root/Downloads/mt7601/src/tools'
    gcc -g bin2h.c -o bin2h
    make[1]: Leaving directory '/root/Downloads/mt7601/src/tools'
    /root/Downloads/mt7601/src/tools/bin2h
    cp -f os/linux/Makefile.6 /root/Downloads/mt7601/src/os/linux/Makefile
    make -C /lib/modules/3.18.16-v7/build SUBDIRS=/root/Downloads/mt7601/src/os/linux modules
    make[1]: Entering directory '/usr/src/kernel'

    WARNING: Symbol version dump ./Module.symvers
    is missing; modules will have no dependencies and modversions.

    CC [M] /root/Downloads/mt7601/src/os/linux/../../os/linux/rt_profile.o
    ./scripts/recordmcount: 1: ./scripts/recordmcount: Syntax error: "(" unexpected
    scripts/Makefile.build:257: recipe for target '/root/Downloads/mt7601/src/os/linux/../../os/linux/rt_profile.o' failed
    make[2]: *** [/root/Downloads/mt7601/src/os/linux/../../os/linux/rt_profile.o] Error 2
    Makefile:1381: recipe for target '_module_/root/Downloads/mt7601/src/os/linux' failed
    make[1]: *** [_module_/root/Downloads/mt7601/src/os/linux] Error 2
    make[1]: Leaving directory '/usr/src/kernel'
    Makefile:394: recipe for target 'LINUX' failed
    make: *** [LINUX] Error 2

  14. #14
    Join Date
    2016-Jan
    Posts
    2
    Hi!
    I have totally same problem, but unfortunately i can't solve it.
    After i type:

    rm /lib/modules/$(uname -r)/{build,source}
    ln -s /usr/src/kernel /lib/modules/$(uname -r)/{build,source}
    apt-get install linux-headers-$(uname -r)

    i get:
    E: Unable to locate package linux-headers-3.18.16-v7
    E: couldn't find any package by regex 'linux-headers-3.18.16-v7'

    after reboot:
    uname -r
    3.18.16-v7

    Could you please help me in the case?
    Last edited by chindjer; 2016-01-26 at 16:08.

Similar Threads

  1. Linux Headers problems and wifi problem
    By Husko in forum TroubleShooting Archive
    Replies: 0
    Last Post: 2020-06-09, 20:51
  2. Linux Headers problem-Kali Rolling
    By Jongla in forum TroubleShooting Archive
    Replies: 0
    Last Post: 2016-05-04, 05:53
  3. Replies: 1
    Last Post: 2013-12-11, 20:12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •