[Android Q&A, Help & Troubleshooting] morfikov:
I'm trying to find a solution for some WiFi roaming issues on my Neffos C5/C5 MAX smartfones running Android 5.1 Lollipop, because the roaming is disabled in the wpa_supplicant config. Basically my laptop (running Debian Sid) is able to switch between different access points in the same or different networks without any problems. According to this thread[1] and my linux setup, I have to add one line to the Android WiFi config file, which is /data/misc/wifi/wpa_supplicant.conf . When the roaming settings in wpad_supplicant configuration are disabled, the following line does nothing no matter whether you add it to the global section or to the network one:

bgscan="simple:20:-30:20"

It's not removed when you edit the file when WiFi is off. When you turn it on, the file is rewritten, but the parameter stays untouched. So the only option to make it work on my smartphones is to compile wpa_supplicant with roaming enabled. How to do it?

Basically I downloaded the Android 5.1 repo in the following way:

# curl https://storage.googleapis.com/git-repo-downloads/repo > /usr/local/bin/repo
# chmod a+x /usr/local/bin/repo
# chown root:staff /usr/local/bin/repo
$ mkdir /mnt/Lollipop-5.1/
$ cd /mnt/Lollipop-5.1/
$ repo init -u https://android.googlesource.com/platform/manifest -b android-5.1.1_r38 --depth=1
$ repo sync --current-branch --jobs=4

The wpa_supplicant tool is in the external/wpa_supplicant_8/wpa_supplicant/ directory. In this dir, there's some config files, and here is my

first question

. The two files defconfig and android.config have almost the same configuration. So why are they two, and which one is the one I should edit? I assume that the changes should go to android.config because it has an obvious name. But I just want to make sure.

I've edited the android.config file and changed the following lines in it:

#CONFIG_NO_ROAMING=y
CONFIG_AUTOSCAN_EXPONENTIAL=y
CONFIG_AUTOSCAN_PERIODIC=y

Instead of adding new stuff to the file, I created another file called android_config_bgscan.inc . I just read something about this way of doing things, so I followed this pattern. I placed the line below in that file:

CONFIG_BGSCAN_SIMPLE=y

And this is actually what I need to make the bgscan="simple:20:-30:20" line work. And now is the

second question

: how to build the wpa_supplicant tool? I was reading something about typing the following commands:

$ make clobber
$ . build/envsetup.sh
$ lunch aosp_arm64-eng

I don't really know what to use in the lunch command. My smartphones have SoC MT6735 and MT6753 (64bit ARM), and when I typed just the lunch command there was only one option that had ARM and 64 in its name, so that's why I used it. I don't know whether it's right because I don't know much about the Android building process yet. Anyways in the terminal I could see the following output:

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=5.1.1
TARGET_PRODUCT=aosp_arm64
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm64
TARGET_ARCH_VARIANT=armv8-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=arm
TARGET_2ND_ARCH_VARIANT=armv7-a-neon
TARGET_2ND_CPU_VARIANT=cortex-a15
HOST_ARCH=x86_64
HOST_OS=linux
HOST_OS_EXTRA=Linux-4.8.0-1-amd64-x86_64-with-debian-stretch-sid
HOST_BUILD_TYPE=release
BUILD_ID=LMY49M
OUT_DIR=out
===========================================

So the

third question

is: Is something wrong with this configuration in the case of the two SoCs?

The next thing I did was running the make command:

$ make -j2

I have a weak PC, only 2 GiB of RAM, but I've managed to build the source. Here's the

fouth question

: do I have to build the whole source, or can I build only a part of it when I want to build a specific project like wpa_supplicant? I know about mm and mmm commands, but I wasn't able to build the wpa_suplicant tool in this way without typing make first. There was some problems with dependencies, and that's why I've built the whole source. And that helped, and wpa_supplicant was successfully compiled.

A

few other questions

concerning mm/mmm/make.

Is there any difference between mm and mmm commands? I mean something else than just switching the dir.

Is there any difference between mm/mmm and simply make dir/ command?

Should I prefer one over the other, I mean mm/mmm/make?

Another question

: how to clean the source after building something. For now I've build the whole source and also I compiled the wpa_supplicant. How to clean only the files that wpa_supplicant added? I was using the following command while building it:

$ mmmm external/wpa_supplicant_8/wpa_supplicant/

Another question

: are the android-sdk tools required in the building process? Can I build the source without setting them first? I always set the following variables:

$ export ANDROID_HOME=/mnt/android-sdk-linux
$ export PATH=$ANDROID_HOME/tools:$PATH
$ export PATH=$ANDROID_HOME/platform-tools:$PATH

Is this necessary?

And the

final question

is how to build a package from the compiled wpa_supplicant tool so I could install it on my smartfones in the same way I was installing, for instance, F-Droid app?

If anyone knows some answers to the questions, please post them here. If you don't know, but you can point me in the right direction where I can find some info on the subject (and the asked questions), please do it. I would really appreciate that because I'm new to this things, and I want to know more and maybe in near future I start building custom packages/roms.

[1] hxxp://xdaforums.com/showpost.php?p=46134045