Wi-Fi hotspot
Bliss OS and other Android-x86 based systems offer a smooth and refined experience for desktop and laptop users, but they sometimes lack features present in a conformant OEM Android device. One such feature is the Wi-Fi hotspot functionality. While awaiting for Bliss OS developers to implement it properly, I discovered a workaround to allow users enabling Wi-Fi hotspot functionality using the hostapd HAL binaries extracted from Google’s cuttlefish system images available at Android CI.
Prerequisites
Before you begin, ensure you have:
- A Bliss OS or Android-x86 system installed.
- Unpacked system.sfs to allow modification: https://docs.blissos.org/knowledgebase/troubleshooting/remount-system-as-read-write/.
- Extract the required files from cuttlefish images: Android CI or download a .zip.
- A high degree of Linux terminal skills, as it involves complex file manipulations and system modifications.
Steps to Enable Wi-Fi Hotspot
1. Download the Required Files
The .zip file contains the necessary files:
com.android.wifi.hal.apex_payload
com.google.cf.wifi.rc
system/init/init.cutf_cvm.rc
vendor/vintf/manifest/android.hardware.wifi.hostapd.xml
2. Prepare the System Image
- Resize the System Partition
- Unpack the
system.sfs
file as mentioned before: https://docs.blissos.org/knowledgebase/troubleshooting/remount-system-as-read-write/. - Resize the
system.img
file using theresize2fs
command. Currently it is around 4GB in size, so we will increase its size to 5GB to accommodate the new files:
- Mount the System Image
- Mount the resized
system.img
to a directory:
3. Install the Apex Payload containing the hostapd HAL
- Prepare the Directory
- Create the necessary directory for the Apex payload:
- Mount the Apex Payload
- Loop mount
com.android.wifi.hal.apex_payload
read-only and copy its contents preserving permissions and SELinux context:
4. Edit init.rc files
init.cutf_cvm.rc
contains the lines to be added to init.bliss_x86_64.rc for creating the necessary directories required for hostapd to function.
com.google.cf.wifi.rc
contains the lines to be added to init.bliss_x86_64.rc to start a hostapd service.
- Edit
/tmp/system_img/init.bliss_x86_64.rc
to include the hostapd service
- Edit
/tmp/system_img/init.bliss_x86_64.rc
to add the code for creating /data/vendor/wifi/hostapd/sockets
- Modify the system VINTF Manifest
- Copy
android.hardware.wifi.hostapd.xml
to the VINTF manifest directory:
Further reading:
- https://source.android.com/docs/core/architecture/aidl/dynamic-aidl
- https://android.googlesource.com/platform/system/core/+/master/init/README.md
- https://source.android.com/docs/core/architecture/vintf/objects
5. Apply Changes and Reboot
-
Unmount and Repack
-
Unmount the system image:
-
Repack
system.img
if necessary.
-
-
Reboot Your System
-
Restart your system for the changes to take effect. After rebooting, you should be able to use the Wi-Fi hotspot feature.
-
This workaround provides a temporary solution for enabling Wi-Fi hotspot functionality on Bliss OS and Android-x86 systems till it is fixed. This is written solely for the purpose of sharing knowledge.
Hardware Limitations
-
This workaround allows you to share a connection not being used by your Wi-Fi adapter, such as Ethernet or mobile data. However, not all hardware supports sharing the same Wi-Fi connection on the same adapter. Not all Wi-Fi adapters can function as both a station (client) and an access point (AP) simultaneously with Linux drivers.
-
To potentially overcome this limitation, hostapd can be configured to use a different Wi-Fi interface (e.g
wlan1
instead ofwlan0
). This can be done by modifying the configuration file provided to hostapd. It is yet to be investigated. https://source.android.com/docs/core/connect/wifi-sta-ap-concurrency