Please select To the mobile version | Continue to access the desktop computer version

OrangePi

 Login            
 Register            
Search
Hot search: orangepi
View: 9168|Reply: 6

How to properly compile device drivers for OrangePi?

[Copy link]

1

Threads

2

Posts

28

Credits

Novice

Rank: 1

Credits
28
Post time 2015-11-13 07:05:12 | Show all posts |Read mode
Dear moderators and colleagues,
Please tell me right step-by-step instruction how to compile device drivers for OrangePi from sources.

I have a particular task now - to make my usb wifi dongle with RTL8188CUS chipset working in OrangePi (Ubuntu Mate distributive)
I've downloaded needed driver from Realtek website, made some changes in makefile accodring target architecture, installed build-essential and started to compile the driver on OrangePi, but got the error:
  1. orangepi@OrangePI:~/rtl8188C$ make
  2. make ARCH=armv7l CROSS_COMPILE= -C /lib/modules/3.4.39/build M=/home/orangepi/rtl8188C  modules
  3. make[1]: *** /lib/modules/3.4.39/build: No such file or directory.  Stop.
  4. Makefile:584: recipe for target 'modules' failed
  5. make: *** [modules] Error 2
Copy the Code
I found that /lib/modules/3.4.39/build it a symlink that lead to non-existent directory /home/LoBo2_Razno/OrangePI/kernel_3.4.9/linux-3.4. Seem like it was a path to kernel sources at OrangePi developer's machine, so I substitute it with linux-3.4 from Github.

However finally I still got the error:

  1. ERROR: Kernel configuration is invalid.
  2.          include/generated/autoconf.h or include/config/auto.conf are missing.
  3.          Run 'make oldconfig && make prepare' on kernel src to fix it.
Copy the Code
(full error log here)

I assumed that I need to build kernel previously and started to do at my desktop machine.  But during kernel build I again got the error:
  1. pavel@pavel-IdeaPad-U310T:/drive_d/OrangePI-Kernel-master$ sudo ./build_linux_kernel.sh 2
  2. Building kernel for OPI-2 () ...
  3.   Configuring ...
  4.   Building kernel & modules ...
  5.   Error: KERNEL NOT BUILT.
Copy the Code
Full content of kbuild_2_.log is here.

What was I doing wrong and what is a right sequence of compiling drivers from sources for OrangePi?

18

Threads

303

Posts

6658

Credits

Moderator

Rank: 7Rank: 7Rank: 7

Credits
6658
Post time 2015-11-13 12:14:07 | Show all posts
Use Debian jessie or Ubuntu 14.04 instead, it shall work. Ubuntu 15.04 and 15.10 won`t work. B.t.w, you should post it to the Troubleshooting section.

1

Threads

2

Posts

28

Credits

Novice

Rank: 1

Credits
28
 Author| Post time 2015-11-13 16:09:52 | Show all posts
Edited by pavser at 2015-11-13 16:13

Hi jacer,

Thank you for quick reply.
I'm using crosscompiler on Ubuntu 14.04.3 LTS but have same "KERNEL NOT BUILT" error.

Btw, do I need to compile kernel firstly and then compile the driver?

P.S. Sorry for posting in a wrong section, you can move this topic to Troubleshooting section.

0

Threads

3

Posts

30

Credits

Novice

Rank: 1

Credits
30
Post time 2015-11-14 08:37:45 | Show all posts
Edited by Tafka at 2015-11-14 08:40

Hi,
I started with Linux 2 months back ... so some following steps may be not correct.
Here is what I did to install drivers:

- downloaded linux-3.4.9 kernel from Loboris Mega drive to /usr/src/linux-3.4
- in terminal:
sudo apt-get update
sudo apt-get dist-upgrade
apt-get install gcc build-essential
cd /usr/src/linux-3.4
zcat /proc/config.gz > .config
make oldconfig

## change kernel .config if needed and 'turn on' driver settings if they are uncommented.. for example my in my case
CONFIG_ATH_COMMON=m
CONFIG_ATH9K_HW=m
CONFIG_ATH9K_COMMON=m
CONFIG_ATH9K_HTC=m

- in terminal:
make modules_prepare
make modules
sudo unlink /lib/modules/$(uname -r)/build
sudo ln -s /usr/src/linux-3.4 /lib/modules/$(uname -r)/build
sudo unlink /lib/modules/$(uname -r)/source
sudo ln -s /usr/src/linux-3.4 /lib/modules/$(uname -r)/source
- and then your driver directory run make.. as I understood then in your case
sudo make clean
sudo make ARCH=armv7l CROSS_COMPILE= -C /lib/modules/3.4.39/build M=/home/orangepi/rtl8188C  modules

13

Threads

77

Posts

442

Credits

Intermediate member

Rank: 3Rank: 3

Credits
442
Post time 2015-12-6 22:41:50 | Show all posts
Tafka replied at 2015-11-14 08:37
Hi,
I started with Linux 2 months back ... so some following steps may be not correct.
Here is what  ...

How to load the driver.
i did the same steps till "sudo make install clean"
after that the driver didnt load

13

Threads

77

Posts

442

Credits

Intermediate member

Rank: 3Rank: 3

Credits
442
Post time 2015-12-6 22:44:08 | Show all posts
Tafka replied at 2015-11-14 08:37
Hi,
I started with Linux 2 months back ... so some following steps may be not correct.
Here is what  ...

can you upload the os image file if you have the working os

0

Threads

2

Posts

66

Credits

Registered member

Rank: 2

Credits
66
Post time 2016-4-9 06:14:48 | Show all posts
Please help on compiling Kernel Modules for lirk GPIO IR blaster (orange pi pc, Ubuntu 15.04)

I've found lirc-gpioblaster for OpenWrt, and lirc_rpi for Raspberry Pi
but I cannot figure out how to build kernel modules from those sources
You have to log in before you can reply Login | Register

Points Rules

Archiver|Mobile edition|Darkroom|OrangePi En ( 粤ICP备14086627号-2

2017-12-14 08:29 GMT+8 , Processed in 0.030855 second(s), 22 queries .

Powered by Discuz! X3.2

© 2014-2015 orangepibbs en.

Quick Reply To Top Return to the list