diff --git a/BoardConfig.mk b/BoardConfig.mk index e823e78..d1d4b74 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -66,3 +66,14 @@ BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4 # Disable scudo MALLOC_SVELTE := true + +# Wifi. +BOARD_WLAN_DEVICE := emulator +BOARD_HOSTAPD_DRIVER := NL80211 +BOARD_WPA_SUPPLICANT_DRIVER := NL80211 +#BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_simulated +#BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_simulated +WPA_SUPPLICANT_VERSION := VER_0_8_X +WIFI_DRIVER_FW_PATH_PARAM := "/dev/null" +WIFI_DRIVER_FW_PATH_STA := "/dev/null" +WIFI_DRIVER_FW_PATH_AP := "/dev/null" diff --git a/device.mk b/device.mk index ae3899b..82946f5 100644 --- a/device.mk +++ b/device.mk @@ -178,12 +178,35 @@ PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.vulkan.level-1.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.level.xml \ frameworks/native/data/etc/android.hardware.vulkan.version-1_1.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.version.xml \ frameworks/native/data/etc/android.hardware.vulkan.compute-0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.compute.xml \ + device/generic/goldfish/wifi/simulated_hostapd.conf:$(TARGET_COPY_OUT_VENDOR)/etc/simulated_hostapd.conf \ + device/generic/goldfish/wifi/wpa_supplicant.conf:$(TARGET_COPY_OUT_VENDOR)/etc/wifi/wpa_supplicant.conf \ + device/generic/goldfish/wifi/WifiConfigStore.xml:data/misc/wifi/WifiConfigStore.xml \ + $(LOCAL_PATH)/init-net.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init-net.sh \ + $(LOCAL_PATH)/init.net.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.net.rc \ + 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.passpoint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.passpoint.xml \ + frameworks/native/data/etc/android.hardware.wifi.direct.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.direct.xml \ frameworks/native/data/etc/android.software.freeform_window_management.xml:system/etc/permissions/android.software.freeform_window_management.xml # Power PRODUCT_PACKAGES += \ + android.hardware.wifi@1.0-service \ + sh_vendor \ + ip_vendor \ + iw_vendor \ android.hardware.power@1.0-service.waydroid +PRODUCT_PACKAGES += \ + mac80211_create_radios \ + createns \ + dhcpclient \ + execns \ + hostapd \ + hostapd_nohidl \ + netmgr \ + wifi_forwarder \ + wpa_supplicant + # Remove unwanted packages PRODUCT_PACKAGES += \ RemovePackages @@ -198,7 +221,9 @@ PRODUCT_PACKAGES += \ # Soong PRODUCT_SOONG_NAMESPACES += \ - $(LOCAL_PATH) + $(LOCAL_PATH) \ + device/generic/goldfish \ + device/generic/goldfish-opengl \ # VNDK PRODUCT_PACKAGES += \ diff --git a/init-net.sh b/init-net.sh new file mode 100644 index 0000000..42b9fb9 --- /dev/null +++ b/init-net.sh @@ -0,0 +1,9 @@ +#!/vendor/bin/sh + + +if [ ! -d /sys/class/net/wlan0 ]; then + /system/bin/ifconfig eth0 down + /system/bin/ip link set eth0 name wifi_eth + /system/bin/ifconfig wifi_eth up + /system/bin/ip link add link wifi_eth name wlan0 type virt_wifi +fi diff --git a/init.net.rc b/init.net.rc new file mode 100644 index 0000000..accad5d --- /dev/null +++ b/init.net.rc @@ -0,0 +1,66 @@ + +on post-fs-data + setprop vold.post_fs_data_done 1 + mkdir /data/vendor/var 0755 root root + mkdir /data/vendor/var/run 0755 root root + mkdir /data/vendor/var/run/netns 0755 root root + start ranchu-net + +on zygote-start + # Create the directories used by the Wireless subsystem + mkdir /data/vendor/wifi 0771 wifi wifi + mkdir /data/vendor/wifi/wpa 0770 wifi wifi + mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi + +service ranchu-net /vendor/bin/init-net.sh + class late_start + user root + group root wakelock wifi + oneshot + disabled # Started on post-fs-data + +service emu_hostapd /vendor/bin/execns router /vendor/bin/hostapd_nohidl /data/vendor/wifi/hostapd/hostapd.conf + user root + group root wifi net_raw net_admin + disabled + +service netmgr /vendor/bin/execns router /vendor/bin/netmgr --if-prefix wlan1 --bridge eth0,radio0-peer + user root + group root wifi + disabled + +service wifi_forwarder /vendor/bin/wifi_forwarder + user root + group root wifi + disabled + +service dhcpclient_rtr /vendor/bin/dhcpclient -i radio0 --no-gateway + user root + group root + disabled + +service dhcpclient_wifi /vendor/bin/dhcpclient -i wlan0 --no-gateway + user root + group root + disabled + +on property:vendor.network.bridged=1 + start dhcpclient_rtr + +service dhcpclient_def /vendor/bin/dhcpclient -i eth0 --no-gateway + user root + group root + disabled + + + + +service wpa_supplicant /vendor/bin/hw/wpa_supplicant -Dnl80211 -iwlan0 -g@android:wpa_wlan0 + interface android.hardware.wifi.supplicant@1.0::ISupplicant default + interface android.hardware.wifi.supplicant@1.1::ISupplicant default + interface android.hardware.wifi.supplicant@1.2::ISupplicant default + interface android.hardware.wifi.supplicant@1.3::ISupplicant default + socket wpa_wlan0 dgram 660 wifi wifi + group system wifi inet + oneshot + disabled