summaryrefslogtreecommitdiffstats
path: root/toolbox/Android.mk
diff options
context:
space:
mode:
authorDees Troy <dees_troy@teamw.in>2013-10-08 16:04:55 +0200
committerDees Troy <dees_troy@teamw.in>2013-10-16 21:46:29 +0200
commit8d66f8bda919435d36a1df1d8f3cea16a3c496fa (patch)
tree43fb8f1c2c90b4fe4dd66fd22146380d5b2e20ed /toolbox/Android.mk
parentMerge "check for space after = too" into twrp2.7 (diff)
downloadandroid_bootable_recovery-8d66f8bda919435d36a1df1d8f3cea16a3c496fa.tar
android_bootable_recovery-8d66f8bda919435d36a1df1d8f3cea16a3c496fa.tar.gz
android_bootable_recovery-8d66f8bda919435d36a1df1d8f3cea16a3c496fa.tar.bz2
android_bootable_recovery-8d66f8bda919435d36a1df1d8f3cea16a3c496fa.tar.lz
android_bootable_recovery-8d66f8bda919435d36a1df1d8f3cea16a3c496fa.tar.xz
android_bootable_recovery-8d66f8bda919435d36a1df1d8f3cea16a3c496fa.tar.zst
android_bootable_recovery-8d66f8bda919435d36a1df1d8f3cea16a3c496fa.zip
Diffstat (limited to 'toolbox/Android.mk')
-rw-r--r--toolbox/Android.mk80
1 files changed, 80 insertions, 0 deletions
diff --git a/toolbox/Android.mk b/toolbox/Android.mk
new file mode 100644
index 000000000..ef0593a04
--- /dev/null
+++ b/toolbox/Android.mk
@@ -0,0 +1,80 @@
+LOCAL_PATH:= system/core/toolbox/
+include $(CLEAR_VARS)
+
+TOOLS := \
+ start \
+ stop \
+ getprop \
+ setprop
+
+ifeq ($(TWHAVE_SELINUX), true)
+ TOOLS += \
+ ls \
+ getenforce \
+ setenforce \
+ chcon \
+ restorecon \
+ runcon \
+ getsebool \
+ setsebool \
+ load_policy
+endif
+
+LOCAL_SRC_FILES := \
+ dynarray.c \
+ toolbox.c \
+ $(patsubst %,%.c,$(TOOLS))
+
+TOOLS += reboot
+
+ifeq ($(BOARD_USES_BOOTMENU),true)
+ LOCAL_SRC_FILES += ../../../external/bootmenu/libreboot/reboot.c
+else
+ LOCAL_SRC_FILES += reboot.c
+endif
+
+LOCAL_C_INCLUDES := bionic/libc/bionic
+
+LOCAL_SHARED_LIBRARIES := \
+ libcutils \
+ liblog \
+ libc
+
+ifeq ($(TWHAVE_SELINUX), true)
+ LOCAL_SHARED_LIBRARIES += libselinux
+endif
+
+LOCAL_MODULE := toolbox_recovery
+LOCAL_MODULE_STEM := toolbox
+LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
+LOCAL_MODULE_TAGS := optional
+
+# Including this will define $(intermediates).
+#
+include $(BUILD_EXECUTABLE)
+
+$(LOCAL_PATH)/toolbox.c: $(intermediates)/tools.h
+
+TOOLS_H := $(intermediates)/tools.h
+$(TOOLS_H): PRIVATE_TOOLS := $(TOOLS)
+$(TOOLS_H): PRIVATE_CUSTOM_TOOL = echo "/* file generated automatically */" > $@ ; for t in $(PRIVATE_TOOLS) ; do echo "TOOL($$t)" >> $@ ; done
+$(TOOLS_H): $(LOCAL_PATH)/Android.mk
+$(TOOLS_H):
+ $(transform-generated-source)
+
+# Make #!/system/bin/toolbox launchers for each tool.
+#
+SYMLINKS := $(addprefix $(TARGET_RECOVERY_ROOT_OUT)/sbin/,$(TOOLS))
+$(SYMLINKS): TOOLBOX_BINARY := $(LOCAL_MODULE_STEM)
+$(SYMLINKS): $(LOCAL_INSTALLED_MODULE) $(LOCAL_PATH)/Android.mk
+ @echo "Symlink: $@ -> $(TOOLBOX_BINARY)"
+ @mkdir -p $(dir $@)
+ @rm -rf $@
+ $(hide) ln -sf $(TOOLBOX_BINARY) $@
+
+ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS)
+
+# We need this so that the installed files could be picked up based on the
+# local module name
+ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
+ $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS)