3

I am trying to connect an OTG USB-Ethernet adapter on the Aquaris E4.5 running kernel 3.4.67. The adapter is Cable Matters AX88179 which has open source drivers available for linux.

The installation requires the source files for the device's kernel which however are not on the device. I've tried installing the respective linux-headers but they are not available for the kernel image I have (found through uname -r). Installing the source or linux generic headers gives errors as I run out of i-nodes on the phone.

Is there a way of cross-compiling the C drivers for the Aquaris?

1
  • I tried setting up a cross-build environment using the kernel's source code from github but I run into several problems with missing header files (plat, mach, gcc5). Has anyone cross-compiled anything on this thing?
    – koukouviou
    Dec 19, 2015 at 20:13

1 Answer 1

0

To cross-compile for Aquaris E4.5 on an x86 Ubuntu host you need the ARM androideabi toolchain. You can install that with:

$ sudo apt install gcc-arm-linux-androideabi

The Linux kernel source code for Aquaris E4.5 can be found on BQ's GitHub page. As documented on BQ's README file, you can build the kernel with:

$ ./makeMtk -t krillin n k

To cross-compile the AX88179 drivers (I expect the procedure to be similar for other drivers but I haven't tested it on anything but the AX88179 drivers) I modified the drivers' Makefile as follows:

export ARCH:=arm
export CROSS_COMPILE:=arm-linux-androideabi-
TARGET  = ax88179_178a
OBJS    = ax88179_178a.o
MDIR    = drivers/net/usb
KDIR    = <absolute-path>/aquaris/out/target/product/krillin/obj/KERNEL_OBJ
USBNET  = $(shell find $(KDIR)/include/linux/usb/* -name usbnet.h)

EXTRA_CFLAGS = -DEXPORT_SYMTAB
PWD = $(shell pwd)

obj-m      := $(TARGET).o

default:
    make -C $(KDIR) SUBDIRS=$(PWD) modules

$(TARGET).o: $(OBJS)
    $(LD) $(LD_RFLAG) -r -o $@ $(OBJS)

clean:
    $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) clean

.PHONY: modules clean

-include $(KDIR)/Rules.make

Make sure to replace the KDIR value with your absolute path to KERNEL_OBJ in the aquaris directory.

After this you get the cross-compiled kernel object, which you should then 1) transfer and 2) load onto your phone (the following commands should be executed on the phone after the kernel object ax88179_178a.ko is transfered):

# modprobe usbnet
# insmod ax88179_178a.ko

Et voilà! Ethernet OTG worked for me.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .