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.