Thursday, January 30, 2014

Getting USB 3.0 Ethernet Adapter Working on Linux on Chromebook

Introduction

In previous posts, I described how I got Bodhi Linux installed on my Samsung (ARM) Series 3 Chromebook.  The Chromebook has no ethernet port (it does have Wifi support of course). I recently saw there were some fairly inexpensive USB adapters that supposedly supported Linux and the Chromebook. So I decided to get one.  The one I got was the Etekcity USB 3.0 to Gigabit Ethernet adapter which I found at Amazon. The adapter uses an ASIX AX88179 USB3.0 to 10/100/1000M Gigabit Ethernet Controller.

Unfortunately, while apparently there is driver support for these in newer Chrome OS kernels, there isn't in the 3.4 Chrome OS kernel on my Chromebook. I describe below how I tried to resolve that limitation. I should point out that I believe that driver support for the ASIX AX88179 is in most recent Linux kernels.

Getting the Kernel Source

To get the Chrome OS kernel source for the 3.4 version, I did the following:

apt-get install git-core
cd /usr/src
git clone  https://git.chromium.org/git/chromiumos/third_party/kernel.git
cd kernel
git checkout origin/chromeos-3.4

Building With the Driver Source

To build the kernel I downloaded the Linaro ARM Linux toolchain from here. The source for the driver came on a disk with the adapter, but is also available from the ASIX site here.

I then added the source files for the driver under kernel/drives/net/usb and built the kernel.  There were some other configuration steps to tell the build process that this new driver was there and should be built that I won't go into here. I have previously built a newer version of the Chrome OS kernel called kernel_next which already had support for the adapter. I was able to use that as a model to know how to configure the Chrome OS 3.4 kernel I was working with.

Once I had the kernel built, I had the kernel module I wanted. The file name was ax88179_178a.ko.

Getting It Installed and Working

To get the new driver module installed, I copied it (as root) under:

/lib/modules/3.4.0/kernel/drivers/net

To make the kernel aware of it I issued the command (as root):

depmod

Then I added the following lines to /etc/network/interfaces:

auto eth0
iface eth0 inet dhcp

After rebooting with the adapter plugged into my USB 2.0 port, I had a working ethernet adapter. Doing speed tests I was getting in the range of 60Mbps download and 10Mbps upload. Of course the speed varies according based on the Internet service provider I was using. I didn't bother to test within my LAN to see if I could get faster speeds.

A Debian Package

Knowing that others with ARM based Samsung Chromebooks might want to be able to use ASIX AX88179 USB adatpers as well, I decided to create a debian package. Although I use Bodhi (which is based on Debian for ARM), other Debian-based distributions being run on the same type of Chromebook could theoretically use the package as well.  The package I created is pretty simple. It does the following:
  • Checks to make sure you are running a 3.4 kernel. I would have preferred of course to use dependency checking (which would be done prior to install) to do this, but I could not find something I could check that way. So I put the check in the pre-install (preinst) script.   If you are not running a 3.4 kernel it will terminate installation with a failure message.
  • Installs the file in the proper location (described previously)
  • Adds the aforementioned lines to /etc/network/interfaces
  • Runs the depmod command.
I have made the package available here. It is called ax88179_1.9.0_armhf.deb. I am not aware of any problems it can cause, but you should use at your own risk. Note also that if you don't want to use DHCP (for example, you want to use a static IP address) you can modify the /etc/network/interfaces file as needed after installation.

Caveats

I have used the USB Ethernet adapter (and driver I built) for days without problems, except for one thing. If the adapter is plugged into the USB 2.0 port it works perfectly. If it is plugged into the USB 3.0 port it does not work. The DHCP discover step fails.  I don't know if this is to be expected or not. I do know that this same USB 3.0 port (the blue one) is also not capable of being booted from (this is documented). So if your experience is like mine, you need to plug the adapter into the USB port that is not blue. This is a little disappointing since the Chromebook has a USB 3.0 port and the adapter supports USB 3.0, but I have only gotten it working with the USB 2.0 port. I don't know if the issue is with the adapter and/or driver, or the USB 3.0 support in the Chromebook or Chrome OS.

2 comments: