Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

FMAC Compilation for Android

FMAC Compilation for Android

VinayakS_26
Moderator
Moderator
Moderator
100 replies posted 50 replies posted 25 replies posted

What is FMAC?

 

FMAC stands for Fast Initial Link Setup (FILS) Media Access Control (MAC). The feature of today's Wi-Fi chips enables them to rapidly switch from one access point to another. In environments where multiple access points, e.g. in large buildings, airports, and parks, and public places.

With FMAC, a device can connect to an access point by using a pre-shared key, PSKMAC, which is stored on the device. The device can be rapidly connected to another access point with the same PSK when it moves out of range of a single access point and does not have to perform any reauthentication. This will make it easier for users to move between points of access and improve their user experience.

FMAC Source for Android


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

 

  1. tar -xzf cypress-backports-v4.14.34-mothra-auto-rc54-module-src.tar.gz
  2. cd v4.14.34-backports
  3. export   KERNEL_HOME=<PATH_TO_KERNEL_DIR>
  4. export ANDROID_HOME=<your_path>/android-10.0.0_r2
  5. cd defconfigs/
  6. 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                                

1258 Views