How to properly compile device drivers for OrangePi? 看全部

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
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.
(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.
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?

  • Sofa jacer
  • 2015-11-13 12:14:07
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.
  • Bench pavser
  • 2015-11-13 16:09:52
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.
  • Floor Tafka
  • 2015-11-14 08:37:45
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
  • 5# Manjup
  • 2015-12-6 22:41:50
quote: 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

12NextPage