
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
FMAC Compilation for Android
Introduction
This Blog gives an insight into compilation of Fmac source for an android platform.
Procedure
Cross-compilation tool for building the fmac source for android is obtained by fetching the Android NDK package. The Native Development Kit (NDK) along with the Android studio is a set of tools that allow you to leverage C and C++ code in your Android apps. You can use it either to build from your own source code, or to take advantage of existing prebuilt libraries.
However the toolchain provided in the package can be used independently for compiling the FMAC source.
Download the NDK package for your machine type from the following link:
https://developer.android.com/ndk/downloads
Following table is for selecting the toolchain for the architecture of host machine on which cross compilation is being done:
Architecture | Toolchain name |
ARM-based | arm-linux-androideabi-<gcc-version> |
x86-based | x86-<gcc-version> |
MIPS-based | mipsel-linux-android-<gcc-version> |
ARM64-based | aarch64-linux-android-<gcc-version> |
X86-64-based | x86_64-<gcc-version> |
MIPS64-based | mips64el-linux-android--<gcc-version> |
The NDK provides the make-standalone-toolchain.sh
shell script to allow you to perform a customized toolchain installation from the command line.
The script is located in the $NDK/build/tools/
directory, where $NDK
is the installation root for the NDK. An example of the use of this script appears below, where toolchain for arm64 is built.
$NDK/build/tools/make-standalone-toolchain.sh --toolchain=aarch64-linux-android-4.9 --platform=android-21 --install-dir=/tmp/my-android-toolchain
--platform à is to provide the android API level.
For more information on Android API level check the following link:
https://source.android.com/setup/start/build-numbers
Download and unzip the latest FMAC release(at the time of writing the blog) from the following link:
https://community.cypress.com/docs/DOC-20842
(android_v5.4.18-gamera-android-rc2_cy-imx-android-10.0-rc2_REL_PKG)
Configuring the Package
- tar -xzf cypress-backports-v4.14.34-mothra-auto-rc54-module-src.tar.gz
- cd v4.14.34-backports
- export KERNEL_HOME=<PATH_TO_KERNEL_DIR>
- export ANDROID_HOME=<your_path>/android-10.0.0_r2
- cd defconfigs/
- add the below configs in brcmfmac
- CPTCFG_BRCMFMAC_ANDROID=y
- CPTCFG_BRCMUTIL=m
- CPTCFG_BRCMDBG=y
- CPTCFG_BRCMFMAC_PROTO_MSGBUF=y
- CPTCFG_BRCMFMAC_PROTO_BCDC=y
- CPTCFG_BRCMFMAC_VIF=y
Compiling the FMAC driver
Once the FMAC driver source is configure and patched, compile can be done using the make utility with appropriate cross-compiler toolchain.
make KLIB=$KERNEL_HOME KLIB_BUILD=$KERNEL_HOME CROSS_COMPILE=$COMPILER_DIR/aarch64-linux-android-4.9/bin/aarch64-linux-android- ARCH=arm64 KCFLAGS=-mno-android defconfig-brcmfmac
$ make KLIB=$KERNEL_HOME KLIB_BUILD=$KERNEL_HOME CROSS_COMPILE=$ COMPILER_DIR/aarch64-linux-android-4.9/bin/aarch64-linux-android- ARCH=arm64 KCFLAGS=-mno-android modules -j4
Locations of the compiled LKMs.
$cp /v4.14.34-backports/compat/compat.ko
$cp /v4.14.34-backports/net/wireless/cfg80211.ko
$cp /v4.14.34-backports/drivers/net/wireless/broadcom/brcm80211/brcmutil/brcmutil.ko
$cp /v4.14.34-backports/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko