This Blog gives an insight into compilation of Fmac source for an android platform.
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:
Following table is for selecting the toolchain for the architecture of host machine on which cross compilation is being done:
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.
--platform à is to provide the android API level.
For more information on Android API level check the following link:
Download and unzip the latest FMAC release(at the time of writing the blog) from the following link:
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
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.