wifi: package hostapd and wpa_supplicant into apex
* This is now possible on Android 15 QPR2. Use cuttlefish as reference. https://android.googlesource.com/device/google/cuttlefish/+/refs/tags/android-15.0.0_r20/apex/com.google.cf.wpa_supplicant/ * Create local copies of the service entries. Generally creating the directories for wireless subsystem happens on trigger 'on post-fs-data'. Since apexd for non-bootstrap APEXs starts 'on post-fs-data', this trigger is not available for vendor APEX packages. Use trigger 'apex.all.ready=true' instead which is later still within post-fs-data. https://source.android.com/docs/core/ota/vendor-apex#init-scripts * Create a local copy of wpa_supplicant_overlay.conf. It hasn't been updated in ten years in hardware/broadcom/wlan. TODO: Check relevance.
This commit is contained in:
@@ -85,5 +85,4 @@ BOARD_HOSTAPD_DRIVER := NL80211
|
|||||||
BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_$(BOARD_WLAN_DEVICE)
|
BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_$(BOARD_WLAN_DEVICE)
|
||||||
BOARD_WPA_SUPPLICANT_DRIVER := NL80211
|
BOARD_WPA_SUPPLICANT_DRIVER := NL80211
|
||||||
BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_$(BOARD_WLAN_DEVICE)
|
BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_$(BOARD_WLAN_DEVICE)
|
||||||
WIFI_HIDL_UNIFIED_SUPPLICANT_SERVICE_RC_ENTRY := true
|
|
||||||
WPA_SUPPLICANT_VERSION := VER_0_8_X
|
WPA_SUPPLICANT_VERSION := VER_0_8_X
|
||||||
|
10
device.mk
10
device.mk
@@ -285,16 +285,12 @@ $(call inherit-product, packages/modules/Virtualization/apex/product_packages.mk
|
|||||||
# Wifi
|
# Wifi
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
com.android.hardware.wifi \
|
com.android.hardware.wifi \
|
||||||
hostapd \
|
com.android.hardware.wifi.hostapd.rpi4 \
|
||||||
|
com.android.hardware.wifi.supplicant.rpi4 \
|
||||||
hostapd_cli \
|
hostapd_cli \
|
||||||
libwpa_client \
|
libwpa_client \
|
||||||
wificond \
|
wificond \
|
||||||
wpa_cli \
|
wpa_cli
|
||||||
wpa_supplicant \
|
|
||||||
wpa_supplicant.conf
|
|
||||||
|
|
||||||
PRODUCT_COPY_FILES += \
|
|
||||||
hardware/broadcom/wlan/bcmdhd/config/wpa_supplicant_overlay.conf:$(TARGET_COPY_OUT_VENDOR)/etc/wifi/wpa_supplicant_overlay.conf
|
|
||||||
|
|
||||||
PRODUCT_COPY_FILES += \
|
PRODUCT_COPY_FILES += \
|
||||||
frameworks/native/data/etc/android.hardware.wifi.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.xml
|
frameworks/native/data/etc/android.hardware.wifi.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.xml
|
||||||
|
@@ -5,9 +5,3 @@ on init
|
|||||||
|
|
||||||
on fs
|
on fs
|
||||||
mount_all /vendor/etc/fstab.rpi4
|
mount_all /vendor/etc/fstab.rpi4
|
||||||
|
|
||||||
on post-fs-data
|
|
||||||
# Create the directories used by the Wireless subsystem
|
|
||||||
mkdir /data/vendor/wifi 0770 wifi wifi
|
|
||||||
mkdir /data/vendor/wifi/wpa 0770 wifi wifi
|
|
||||||
mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi
|
|
||||||
|
68
wifi/Android.bp
Normal file
68
wifi/Android.bp
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
// Copyright (C) 2025 KonstaKANG
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
prebuilt_etc {
|
||||||
|
name: "android.hardware.wifi.hostapd-service.rc",
|
||||||
|
src: "android.hardware.wifi.hostapd-service.rc",
|
||||||
|
installable: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
prebuilt_etc {
|
||||||
|
name: "android.hardware.wifi.supplicant-service.rc",
|
||||||
|
src: "android.hardware.wifi.supplicant-service.rc",
|
||||||
|
installable: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
prebuilt_etc {
|
||||||
|
name: "wpa_supplicant.conf.rpi",
|
||||||
|
src: ":wpa_supplicant_template.conf",
|
||||||
|
filename: "wpa_supplicant.conf",
|
||||||
|
relative_install_path: "wifi",
|
||||||
|
installable: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
prebuilt_etc {
|
||||||
|
name: "wpa_supplicant_overlay.conf",
|
||||||
|
src: "wpa_supplicant_overlay.conf",
|
||||||
|
relative_install_path: "wifi",
|
||||||
|
installable: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
apex {
|
||||||
|
name: "com.android.hardware.wifi.hostapd.rpi4",
|
||||||
|
manifest: "apex_manifest_hostapd.json",
|
||||||
|
file_contexts: "apex_file_contexts_hostapd",
|
||||||
|
key: "com.android.hardware.key",
|
||||||
|
certificate: ":com.android.hardware.certificate",
|
||||||
|
updatable: false,
|
||||||
|
vendor: true,
|
||||||
|
|
||||||
|
binaries: [
|
||||||
|
"//external/wpa_supplicant_8/wpa_supplicant/wpa_supplicant:hostapd",
|
||||||
|
],
|
||||||
|
prebuilts: [
|
||||||
|
"android.hardware.wifi.hostapd-service.rc",
|
||||||
|
"android.hardware.wifi.hostapd.xml.prebuilt",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
apex {
|
||||||
|
name: "com.android.hardware.wifi.supplicant.rpi4",
|
||||||
|
manifest: "apex_manifest_supplicant.json",
|
||||||
|
file_contexts: "apex_file_contexts_supplicant",
|
||||||
|
key: "com.android.hardware.key",
|
||||||
|
certificate: ":com.android.hardware.certificate",
|
||||||
|
updatable: false,
|
||||||
|
vendor: true,
|
||||||
|
|
||||||
|
binaries: [
|
||||||
|
"//external/wpa_supplicant_8/wpa_supplicant/wpa_supplicant:wpa_supplicant",
|
||||||
|
],
|
||||||
|
prebuilts: [
|
||||||
|
"android.hardware.wifi.supplicant-service.rc",
|
||||||
|
"android.hardware.wifi.supplicant.xml.prebuilt",
|
||||||
|
"wpa_supplicant.conf.rpi",
|
||||||
|
"wpa_supplicant_overlay.conf",
|
||||||
|
],
|
||||||
|
}
|
13
wifi/android.hardware.wifi.hostapd-service.rc
Normal file
13
wifi/android.hardware.wifi.hostapd-service.rc
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
on property:apex.all.ready=true
|
||||||
|
mkdir /data/vendor/wifi 0770 wifi wifi
|
||||||
|
mkdir /data/vendor/wifi/hostapd 0770 wifi wifi
|
||||||
|
mkdir /data/vendor/wifi/hostapd/sockets 0770 wifi wifi
|
||||||
|
|
||||||
|
service hostapd /apex/com.android.hardware.wifi.hostapd.rpi4/bin/hw/hostapd
|
||||||
|
interface aidl android.hardware.wifi.hostapd.IHostapd/default
|
||||||
|
class main
|
||||||
|
capabilities NET_ADMIN NET_RAW
|
||||||
|
user wifi
|
||||||
|
group wifi net_raw net_admin
|
||||||
|
disabled
|
||||||
|
oneshot
|
18
wifi/android.hardware.wifi.supplicant-service.rc
Normal file
18
wifi/android.hardware.wifi.supplicant-service.rc
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
on property:apex.all.ready=true
|
||||||
|
mkdir /data/vendor/wifi 0770 wifi wifi
|
||||||
|
mkdir /data/vendor/wifi/wpa 0770 wifi wifi
|
||||||
|
mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi
|
||||||
|
|
||||||
|
service wpa_supplicant /apex/com.android.hardware.wifi.supplicant.rpi4/bin/hw/wpa_supplicant \
|
||||||
|
-O/data/vendor/wifi/wpa/sockets -dd \
|
||||||
|
-g@android:wpa_wlan0
|
||||||
|
# we will start as root and wpa_supplicant will switch to user wifi
|
||||||
|
# after setting up the capabilities required for WEXT
|
||||||
|
# user wifi
|
||||||
|
# group wifi inet keystore
|
||||||
|
interface aidl android.hardware.wifi.supplicant.ISupplicant/default
|
||||||
|
class main
|
||||||
|
socket wpa_wlan0 dgram 660 wifi wifi
|
||||||
|
user root
|
||||||
|
disabled
|
||||||
|
oneshot
|
3
wifi/apex_file_contexts_hostapd
Normal file
3
wifi/apex_file_contexts_hostapd
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
(/.*)? u:object_r:vendor_file:s0
|
||||||
|
/etc(/.*)? u:object_r:vendor_configs_file:s0
|
||||||
|
/bin/hw/hostapd u:object_r:hal_wifi_hostapd_default_exec:s0
|
3
wifi/apex_file_contexts_supplicant
Normal file
3
wifi/apex_file_contexts_supplicant
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
(/.*)? u:object_r:vendor_file:s0
|
||||||
|
/etc(/.*)? u:object_r:vendor_configs_file:s0
|
||||||
|
/bin/hw/wpa_supplicant u:object_r:hal_wifi_supplicant_default_exec:s0
|
4
wifi/apex_manifest_hostapd.json
Normal file
4
wifi/apex_manifest_hostapd.json
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"name": "com.android.hardware.wifi.hostapd.rpi4",
|
||||||
|
"version": 1
|
||||||
|
}
|
4
wifi/apex_manifest_supplicant.json
Normal file
4
wifi/apex_manifest_supplicant.json
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"name": "com.android.hardware.wifi.supplicant.rpi4",
|
||||||
|
"version": 1
|
||||||
|
}
|
5
wifi/wpa_supplicant_overlay.conf
Normal file
5
wifi/wpa_supplicant_overlay.conf
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
disable_scan_offload=1
|
||||||
|
wowlan_triggers=any
|
||||||
|
p2p_disabled=1
|
||||||
|
filter_rssi=-75
|
||||||
|
no_ctrl_interface=
|
Reference in New Issue
Block a user