please choosego to mobile | Continue to access the PC version
View: 20744|Reply: 6

How to properly compile device drivers for OrangePi?

[Copy link]

1

threads

2

posts

28

credits

Novice

Rank: 1

credits
28
Published in 2015-11-13 07:05:12 | Show all floors |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 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 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 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

9573

credits

Moderator

Rank: 7Rank: 7Rank: 7

credits
9573
Published in 2015-11-13 12:14:07 | Show all floors
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| Published in 2015-11-13 16:09:52 | Show all floors
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
Published in 2015-11-14 08:37:45 | Show all floors
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

444

credits

Intermediate member

Rank: 3Rank: 3

credits
444
Published in 2015-12-6 22:41:50 | Show all floors
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

444

credits

Intermediate member

Rank: 3Rank: 3

credits
444
Published in 2015-12-6 22:44:08 | Show all floors
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
Published in 2016-4-9 06:14:48 | Show all floors
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 need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list