[android] build ot-ctl on Android.mk (#4567)

This commit is contained in:
Yakun Xu
2020-02-19 11:46:23 -08:00
committed by GitHub
parent 8546bceeab
commit abf108a9b1
4 changed files with 48 additions and 6 deletions
+5
View File
@@ -78,6 +78,11 @@ jobs:
dist: trusty
python: "2.7" # The old Android build system only supports python2
script: .travis/script.sh
- env: BUILD_TARGET="android-build" VERBOSE=1 USE_OTBR_DAEMON=1
os: linux
dist: trusty
python: "2.7" # The old Android build system only supports python2
script: .travis/script.sh
- env: BUILD_TARGET="gn-build" VERBOSE=1
os: linux
script: .travis/script.sh
+10 -4
View File
@@ -96,14 +96,20 @@ EOF
main() {
android_prepare_build_system
make showcommands ot-core
make showcommands ot-cli
make showcommands ot-ncp
make showcommands spi-hdlc-adapter
test -x out/target/product/generic/system/bin/ot-cli
if test "${USE_OTBR_DAEMON}" = 1; then
make showcommands ot-ctl
test -x out/target/product/generic/system/bin/ot-ctl
fi
make showcommands ot-ncp
test -x out/target/product/generic/system/bin/ot-ncp
make showcommands spi-hdlc-adapter
test -x out/target/product/generic/system/bin/spi-hdlc-adapter
}
main "$@"
+30 -2
View File
@@ -60,8 +60,14 @@ OPENTHREAD_COMMON_FLAGS += \
$(NULL)
endif
ifneq ($(USE_OTBR_DAEMON), 1)
OPENTHREAD_COMMON_FLAGS += -DOPENTHREAD_CONFIG_UDP_FORWARD_ENABLE=1
ifeq ($(USE_OTBR_DAEMON), 1)
OPENTHREAD_COMMON_FLAGS += \
-DOPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE=1 \
-DOPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE=1 \
-DOPENTHREAD_ENABLE_POSIX_APP_DAEMON \
$(NULL)
else
OPENTHREAD_COMMON_FLAGS += -DOPENTHREAD_CONFIG_UDP_FORWARD_ENABLE=1
endif
# Enable all optional features for CI tests.
@@ -432,3 +438,25 @@ LOCAL_LDLIBS := \
LOCAL_STATIC_LIBRARIES = libopenthread-ncp ot-core
include $(BUILD_EXECUTABLE)
ifeq ($(USE_OTBR_DAEMON), 1)
include $(CLEAR_VARS)
LOCAL_MODULE := ot-ctl
LOCAL_MODULE_TAGS := eng
LOCAL_CFLAGS := \
-DOPENTHREAD_CONFIG_FILE=\<openthread-config-android.h\> \
$(NULL)
LOCAL_C_INCLUDES := \
$(OPENTHREAD_PROJECT_INCLUDES) \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/src/core \
$(LOCAL_PATH)/src/posix/platform \
$(NULL)
LOCAL_SRC_FILES := src/posix/client.cpp
include $(BUILD_EXECUTABLE)
endif # ($(USE_OTBR_DAEMON), 1)
+3
View File
@@ -68,6 +68,8 @@
#define OPENTHREAD_POSIX_TUN_DEVICE "/dev/net/tun"
#endif // OPENTHREAD_TUN_DEVICE
// Some platforms will include linux/ipv6.h in netinet/in.h
#if !defined(_IPV6_H) && !defined(_UAPI_IPV6_H)
// from linux/ipv6.h
struct in6_ifreq
{
@@ -75,6 +77,7 @@ struct in6_ifreq
__u32 ifr6_prefixlen;
int ifr6_ifindex;
};
#endif
static otInstance * sInstance = NULL;
static int sTunFd = -1; ///< Used to exchange IPv6 packets.