Compile Driver for Android (x86)

The following instructions cover the driver compiling process for RED bean on devices running Linux. We recommend using Debian or Ubuntu. It also might be possible to compile on OSX. Compiling directly on a Windows platform is not supported. However, if all you have available is a windows machine then we would recommend to set up a linux based virtual machine.


Android Oreo

1. Prepare build environment by official Android guide

sudo apt-get update
sudo apt-get install openjdk-8-jdk
sudo apt-get install dosfstools genisoimage bc libssl-dev python2.7 python-mako git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev libgl1-mesa-dev libxml2-utils xsltproc unzip

2. Install Repo:

mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo

3. Checkout Android sources:

mkdir android-x86; cd android-x86
repo init -u git://git.osdn.net/gitroot/android-x86/manifest -b oreo-x86
repo sync -j$(nproc) --no-tags --no-clone-bundle

4. Prepare Android build:

sudo ln -s /sbin/mkdosfs /home/${USER}/bin/
. build/envsetup.sh
lunch android_x86-eng

5. Edit line: 84 of file bootable/newinstaller/Android.mk (vi or vim editors recommended):

Find this line:

-no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot \

Replace line with:

-no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -eltorito-boot boot/grub/efi.img -no-emul-boot \

6. Build Android (long process, powerful system recommended):

m -j$(nproc) iso_img

7. Get the latest qcacld-2.0 sources from 8devices:

cd ..
git clone https://github.com/8devices/qcacld-2.0.git -b caf-wlan/LNX.LEH.4.2.2.2
cd qcacld-2.0

8. Build QCA driver:

PATH=$ANDROID_BUILD_PATHS$PATH KERNEL_SRC=$ANDROID_BUILD_TOP/out/target/product/x86/obj/kernel/ ARCH=x86 CROSS_COMPILE=$ANDROID_TOOLCHAIN/x86_64-linux-android-  make wlan-sdio -j$(nproc)

9. Edit Android sources to include blobs:

vi $ANDROID_BUILD_TOP/device/generic/common/x86.mk

Change LOCAL_PATH variable accordingly to path of qca driver source folder and append to file:

LOCAL_PATH=/home/${USER}/qcacld-2.0
# qcacld driver sdio blobs:
PRODUCT_COPY_FILES := \
    $(LOCAL_PATH)/firmware/sdio/utf30.bin:root/lib/firmware/utf30.bin \
    $(LOCAL_PATH)/firmware/sdio/utfbd30.bin:root/lib/firmware/utfbd30.bin \
    $(LOCAL_PATH)/firmware/sdio/bdwlan30.bin:root/lib/firmware/bdwlan30.bin \
    $(LOCAL_PATH)/firmware/sdio/qwlan30.bin:root/lib/firmware/qwlan30.bin \
    $(LOCAL_PATH)/firmware/sdio/otp30.bin:root/lib/firmware/otp30.bin \
    $(LOCAL_PATH)/firmware/sdio/sdio_qcom_cfg.ini:root/lib/firmware/wlan/sdio_qcom_cfg.ini \
    $(LOCAL_PATH)/firmware/sdio/sdio_cfg.dat:root/lib/firmware/wlan/sdio_cfg.dat \
    $(LOCAL_PATH)/wlan-sdio.ko:root/lib/modules/wlan-sdio.ko \
    $(PRODUCT_COPY_FILES)

10. Build Android image:

cd $ANDROID_BUILD_TOP
m -j$(nproc) iso_img

11. Upon finished build, your image android_x86.iso will be available at:

ls $ANDROID_BUILD_TOP/out/target/product/x86/

12. Once you have android installed, up and runnning, insert the module with:

insmod /lib/modules/wlan-sdio.ko

More information here: http://www.android-x86.org/releases/releasenote-8-1-rc1 https://source.android.com/setup/build/initializing