Add init fragment for hostapd on Android

This fragment defines how the Android init system should start hostapd
as a standalone service. Previously, hostapd was fork/exec'd from
Android's netd. This left hostapd with some dangling file descriptors
and a process parent minimally interested in acting as init for child
processes.

Signed-off-by: Christopher Wiley <wiley@google.com>
This commit is contained in:
Christopher Wiley 2016-08-17 17:21:01 +00:00 committed by Jouni Malinen
parent ecba4509d9
commit 9d5d1c5dd2
2 changed files with 21 additions and 0 deletions

View file

@ -995,6 +995,7 @@ endif
LOCAL_CFLAGS := $(L_CFLAGS) LOCAL_CFLAGS := $(L_CFLAGS)
LOCAL_SRC_FILES := $(OBJS) LOCAL_SRC_FILES := $(OBJS)
LOCAL_C_INCLUDES := $(INCLUDES) LOCAL_C_INCLUDES := $(INCLUDES)
LOCAL_INIT_RC := hostapd.android.rc
include $(BUILD_EXECUTABLE) include $(BUILD_EXECUTABLE)
endif # ifeq ($(WPA_BUILD_HOSTAPD),true) endif # ifeq ($(WPA_BUILD_HOSTAPD),true)

View file

@ -0,0 +1,20 @@
#
# init.rc fragment for hostapd on Android
# Copyright (c) 2002-2016, Jouni Malinen <j@w1.fi>
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
#
on post-fs-data
mkdir /data/misc/wifi/hostapd 0770 wifi wifi
service hostapd /system/bin/hostapd \
-e /data/misc/wifi/entropy.bin \
/data/misc/wifi/hostapd.conf
class main
user wifi
writepid /data/misc/wifi/hostapd.pid
group wifi
disabled
oneshot