LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 03-14-2016, 10:55 AM   #1
ilesterg
Member
 
Registered: Jul 2012
Location: München
Distribution: Debian, CentOS/RHEL
Posts: 587

Rep: Reputation: 72
How to be a Linux driver developer


Hello!

I am pretty convinced that there's no existing Linux kernel driver for the built-in WLAN adapter on my laptop, having been tried both CentOS and Debian, esp that I haven't seen my Vendor/Product code here.

So..I decided to be a kernel driver programmer! lol

Where should I start? Here's what I know so far.
* Programming language is C - need to learn that
* Device specification needs to be provided by Manufacturer

What should I know next?

Thanks!
 
Old 03-14-2016, 10:58 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,792

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
yes, you will need c, and also you need to know how to build something (I mean the build tools, like make), and also you need to know the kernel, need to know how to make a kernel module and need to know what is a driver.
 
Old 03-14-2016, 11:04 AM   #3
ilesterg
Member
 
Registered: Jul 2012
Location: München
Distribution: Debian, CentOS/RHEL
Posts: 587

Original Poster
Rep: Reputation: 72
Would there be a distribution of choice? I know some distributions such as CentOS provide less drivers support on "non server" hardware, so might they be providing less development support/tools also? So I guess I will be better off not using CentOS? Debian maybe?
 
Old 03-14-2016, 11:15 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,792

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
I think you can choose what you want. (if you want to learn, it will be almost the same)
 
Old 03-14-2016, 11:49 AM   #5
ardvark71
LQ Veteran
 
Registered: Feb 2015
Location: USA
Distribution: Lubuntu 14.04, 22.04, Windows 8.1 and 10
Posts: 6,282
Blog Entries: 4

Rep: Reputation: 842Reputation: 842Reputation: 842Reputation: 842Reputation: 842Reputation: 842Reputation: 842
Hi...

What is the adapter specifically?

Code:
lspci -nnk | grep -i net -A2
Regards...
 
Old 03-15-2016, 12:28 PM   #6
ilesterg
Member
 
Registered: Jul 2012
Location: München
Distribution: Debian, CentOS/RHEL
Posts: 587

Original Poster
Rep: Reputation: 72
Please see below.
Code:
root@debianpc:~# lspci -nnk | grep -i net -A2
02:00.1 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 12)
	Subsystem: Acer Incorporated [ALI] Device [1025:096a]
	Kernel driver in use: r8169
03:00.0 Network controller [0280]: Qualcomm Atheros Device [168c:0042] (rev 30)
	Subsystem: Foxconn International, Inc. Device [105b:e09a]
04:00.0 3D controller [0302]: NVIDIA Corporation Device [10de:1299] (rev a1)
root@debianpc:~#
 
Old 03-15-2016, 03:21 PM   #7
ardvark71
LQ Veteran
 
Registered: Feb 2015
Location: USA
Distribution: Lubuntu 14.04, 22.04, Windows 8.1 and 10
Posts: 6,282
Blog Entries: 4

Rep: Reputation: 842Reputation: 842Reputation: 842Reputation: 842Reputation: 842Reputation: 842Reputation: 842
Hi ilesterg...

It looks like your adapter uses a patched (or fixed) ath10k driver in Ubuntu. I'm not sure how if the same steps (in terms of installation) would work in Debian, though.

Regards....

Last edited by ardvark71; 03-15-2016 at 03:23 PM. Reason: Correction.
 
1 members found this post helpful.
Old 03-15-2016, 04:58 PM   #8
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,973

Rep: Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623
Three ways to get a driver in linux. One is a built in module. Two is you add it in. Three is to use ndiswrapper. I'd think that both of those two nic's should be supported in linux. May have to blacklist or as above, use a modified driver.


Notes.
Generally when you wish to make a new driver you look for similar driver sources and see if you can edit the changes. Making a driver from scratch is quite involved. In some cases all you have to do is add in a pci id using some binary editor. They put those numbers in sometimes in reverse order.
 
Old 03-27-2016, 02:08 AM   #9
ilesterg
Member
 
Registered: Jul 2012
Location: München
Distribution: Debian, CentOS/RHEL
Posts: 587

Original Poster
Rep: Reputation: 72
Came back to report that my WLAN is now working.

So one day I was looking at my adapters on my Windows 8.1 and I noticed that the WIFI adapter has a label "QCA9377", something that didn't show up from all the commands I entered when troubleshooting in debian. So i went ahead and searched for Linux drivers and got a hit. So once again, I ended up with the ath10k driver and the linux kernel drivers page which didn't list QCA9377, but out of desperation, I tried the steps anyway. Here are all the steps.
Code:
apt-get update
apt-get install linux-headers-generic build-essential
wget https://www.kernel.org/pub/linux/ker...0151120.tar.gz
tar -zxvf backports-20151120.tar.gz
cd backports-20151120
make defconfig-ath10k
make
make install
Output of make install:
Code:
root@debianpc:/home/myuser/backports-20151120# make install
Makefile:10: *** mixed implicit and normal rules: deprecated syntax
make[1]: Entering directory `/usr/src/linux-headers-3.16.0-4-amd64'
  Building modules, stage 2.
  MODPOST 6 modules
Makefile:10: *** mixed implicit and normal rules: deprecated syntax
make[1]: Entering directory `/usr/src/linux-headers-3.16.0-4-amd64'
  INSTALL /home/myuser/backports-20151120/compat/compat.ko
  INSTALL /home/myuser/backports-20151120/drivers/net/wireless/ath/ath.ko
  INSTALL /home/myuser/backports-20151120/drivers/net/wireless/ath/ath10k/ath10k_core.ko
  INSTALL /home/myuser/backports-20151120/drivers/net/wireless/ath/ath10k/ath10k_pci.ko
  INSTALL /home/myuser/backports-20151120/net/mac80211/mac80211.ko
  INSTALL /home/myuser/backports-20151120/net/wireless/cfg80211.ko
  DEPMOD  3.16.0-4-amd64
depmod will prefer updates/ over kernel/ -- OK!
Note:
You may or may not need to update your initramfs, you should if
any of the modules installed are part of your initramfs. To add
support for your distribution to do this automatically send a
patch against "update-initramfs.sh". If your distribution does not
require this send a patch with the '/usr/bin/lsb_release -i -s'
("Debian GNU/Linux") tag for your distribution to avoid this warning.

Your backported driver modules should be installed now.
Reboot.
After rebooting, still no working WLAN. Checked dmesg:
Code:
[   15.809650] ath10k_pci 0000:03:00.0: irq 70 for MSI/MSI-X
[   15.809660] ath10k_pci 0000:03:00.0: irq 71 for MSI/MSI-X
[   15.809666] ath10k_pci 0000:03:00.0: irq 72 for MSI/MSI-X
[   15.809671] ath10k_pci 0000:03:00.0: irq 73 for MSI/MSI-X
[   15.809677] ath10k_pci 0000:03:00.0: irq 74 for MSI/MSI-X
[   15.809682] ath10k_pci 0000:03:00.0: irq 75 for MSI/MSI-X
[   15.809687] ath10k_pci 0000:03:00.0: irq 76 for MSI/MSI-X
[   15.809693] ath10k_pci 0000:03:00.0: irq 77 for MSI/MSI-X
[   15.809713] ath10k_pci 0000:03:00.0: pci irq msi-x interrupts 8 irq_mode 0 reset_mode 0
[   16.070521] ath10k_pci 0000:03:00.0: firmware: failed to load ath10k/cal-pci-0000:03:00.0.bin (-2)
[   16.070562] ath10k_pci 0000:03:00.0: Direct firmware load failed with error -2
[   16.070564] ath10k_pci 0000:03:00.0: Falling back to user helper
[   16.071044] ath10k_pci 0000:03:00.0: firmware: failed to load ath10k/QCA9377/hw1.0/firmware-5.bin (-2)
[   16.071082] ath10k_pci 0000:03:00.0: Direct firmware load failed with error -2
[   16.071083] ath10k_pci 0000:03:00.0: Falling back to user helper
[   16.071453] ath10k_pci 0000:03:00.0: could not fetch firmware file 'ath10k/QCA9377/hw1.0/firmware-5.bin': -12
[   16.071506] ath10k_pci 0000:03:00.0: firmware: failed to load ath10k/QCA9377/hw1.0/firmware-4.bin (-2)
[   16.071571] ath10k_pci 0000:03:00.0: Direct firmware load failed with error -2
[   16.071573] ath10k_pci 0000:03:00.0: Falling back to user helper
[   16.071919] ath10k_pci 0000:03:00.0: could not fetch firmware file 'ath10k/QCA9377/hw1.0/firmware-4.bin': -12
[   16.071973] ath10k_pci 0000:03:00.0: firmware: failed to load ath10k/QCA9377/hw1.0/firmware-3.bin (-2)
[   16.072039] ath10k_pci 0000:03:00.0: Direct firmware load failed with error -2
[   16.072041] ath10k_pci 0000:03:00.0: Falling back to user helper
[   16.072356] ath10k_pci 0000:03:00.0: could not fetch firmware file 'ath10k/QCA9377/hw1.0/firmware-3.bin': -12
[   16.072405] ath10k_pci 0000:03:00.0: firmware: failed to load ath10k/QCA9377/hw1.0/firmware-2.bin (-2)
[   16.072457] ath10k_pci 0000:03:00.0: Direct firmware load failed with error -2
[   16.072459] ath10k_pci 0000:03:00.0: Falling back to user helper
[   16.072772] ath10k_pci 0000:03:00.0: could not fetch firmware file 'ath10k/QCA9377/hw1.0/firmware-2.bin': -12
[   16.072818] ath10k_pci 0000:03:00.0: firmware: failed to load ath10k/QCA9377/hw1.0/firmware.bin (-2)
[   16.072866] ath10k_pci 0000:03:00.0: Direct firmware load failed with error -2
[   16.072868] ath10k_pci 0000:03:00.0: Falling back to user helper
[   16.073180] ath10k_pci 0000:03:00.0: could not fetch firmware (-12)
[   16.073212] ath10k_pci 0000:03:00.0: could not fetch firmware files (-12)
[   16.073239] ath10k_pci 0000:03:00.0: could not probe fw (-12)
Googled some more and found the solution.
Code:
mkdir /lib/firmware/ath10k
mkdir /lib/firmware/ath10k/QCA9377
mkdir /lib/firmware/ath10k/QCA9377/hw1.0

apt-get -y install git
git clone https://github.com/kvalo/ath10k-firmware.git
ls -l ath10k-firmware/QCA9377/hw1.0/board.bin ath10k-firmware/QCA9377/hw1.0/firmware-5.bin_WLAN.TF.1.0-00267-1
cp ath10k-firmware/QCA9377/hw1.0/board.bin /lib/firmware/ath10k/QCA9377/hw1.0
cp ath10k-firmware/QCA9377/hw1.0/firmware-5.bin_WLAN.TF.1.0-00267-1 /lib/firmware/ath10k/QCA9377/hw1.0/firmware-5.bin
modprobe -r ath10k_pci
modprobe ath10k_pci
Before I close out this thread, I wish to have the below questions answered first, having little knowledge on kernel drivers right now.

1. Why did I need to copy a firmware file over the internet (from a git repo) when I already had to compile and install ath10k manually? Was it not supposed to contain the necessary firmware files already?
2. It appears that QCA9377 is a newer device so understandably it is not listed in kernel.org's list of supported devices for ath10k, here and here, but it just works on my device. Why is that?
3. Jessie currently does not include any Qualcomm Atheros QCA* firmware in its firmware-atheros package. Jessie-backports up to sid already has Qualcomm Atheros QCA* firmware, unfortunately, still no firmware for QCA9377. Is there any way the firmware will be included to the upcoming stable releases, or at least to Jessie-backports?

Hoping my questions are still considers on topic.
 
Old 03-27-2016, 02:27 AM   #10
ilesterg
Member
 
Registered: Jul 2012
Location: München
Distribution: Debian, CentOS/RHEL
Posts: 587

Original Poster
Rep: Reputation: 72
Update on #3:

Apparently, the development happens here, where I downloaded the firmware files, but QCA9377/ is not yet pushed to the ath10k tree in the kernel. Once the QCA9377 is pushed to the kernel.org git tree, distributions such as Debian will start to add the firmware files to the stable and succeeding releases. Is this correct?

Thanks.
 
Old 03-27-2016, 02:31 AM   #11
ilesterg
Member
 
Registered: Jul 2012
Location: München
Distribution: Debian, CentOS/RHEL
Posts: 587

Original Poster
Rep: Reputation: 72
Quote:
Originally Posted by ardvark71 View Post
Hi ilesterg...

It looks like your adapter uses a patched (or fixed) ath10k driver in Ubuntu. I'm not sure how if the same steps (in terms of installation) would work in Debian, though.

Regards....
Now that I understood the commands in the link you shared, I realized this was it :'( The steps are almost the same, I guess, because I had to compile the source from backports, though I had to use defconfig-ath10k instead of defconfig-wifi. Thanks anyway.
 
Old 03-27-2016, 03:07 AM   #12
ardvark71
LQ Veteran
 
Registered: Feb 2015
Location: USA
Distribution: Lubuntu 14.04, 22.04, Windows 8.1 and 10
Posts: 6,282
Blog Entries: 4

Rep: Reputation: 842Reputation: 842Reputation: 842Reputation: 842Reputation: 842Reputation: 842Reputation: 842
Quote:
Originally Posted by ilesterg View Post
Now that I understood the commands in the link you shared, I realized this was it :'( The steps are almost the same, I guess, because I had to compile the source from backports, though I had to use defconfig-ath10k instead of defconfig-wifi. Thanks anyway.
Hi...

Your welcome, I'm glad you were able to get it working after quite an effort!

Quote:
1. Why did I need to copy a firmware file over the internet (from a git repo) when I already had to compile and install ath10k manually? Was it not supposed to contain the necessary firmware files already?
While I don't know the details, I think this has to do with licensing/legal issues. Please see this page from Debian's website.

Regards...
 
1 members found this post helpful.
Old 03-27-2016, 03:15 AM   #13
ardvark71
LQ Veteran
 
Registered: Feb 2015
Location: USA
Distribution: Lubuntu 14.04, 22.04, Windows 8.1 and 10
Posts: 6,282
Blog Entries: 4

Rep: Reputation: 842Reputation: 842Reputation: 842Reputation: 842Reputation: 842Reputation: 842Reputation: 842
Quote:
Originally Posted by ilesterg View Post
3. Jessie currently does not include any Qualcomm Atheros QCA* firmware in its firmware-atheros package. Jessie-backports up to sid already has Qualcomm Atheros QCA* firmware, unfortunately, still no firmware for QCA9377. Is there any way the firmware will be included to the upcoming stable releases, or at least to Jessie-backports?
As an idea, you might want to talk to the folks at Debian about this. You can either post at their forum or email them using, I'm guessing, the "Developers' database administrators" address here.

Regards...

Last edited by ardvark71; 03-27-2016 at 03:19 AM. Reason: Added link.
 
Old 03-27-2016, 07:27 AM   #14
oldtechaa
Member
 
Registered: May 2015
Location: US
Distribution: Fedora
Posts: 364

Rep: Reputation: 83
Just for a hint to anyone who really is looking to get into kernel development, try http://kernelnewbies.org
 
1 members found this post helpful.
Old 03-27-2016, 08:39 AM   #15
ilesterg
Member
 
Registered: Jul 2012
Location: München
Distribution: Debian, CentOS/RHEL
Posts: 587

Original Poster
Rep: Reputation: 72
Thanks ardvark71, my questions are more distribution specific, I guess.

Thanks oldtechaa, I will check the site out.
 
  


Reply

Tags
kernel


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Red Hat Picks Up Another Graphics Driver Developer LXer Syndicated Linux News 0 02-15-2013 02:41 PM
Become a Linux Developer dr.karabas Linux - General 2 12-05-2008 12:03 PM
LXer: Ubuntu Developer Summit report: X.org improvements, driver controversy, and bling LXer Syndicated Linux News 0 11-14-2006 03:21 PM
How to become a linux developer elf-assassin Linux - General 1 06-10-2004 11:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 09:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration