2009-03-04 11:32:55 +08:00
|
|
|
LOCAL_PATH:= $(call my-dir)
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
|
|
|
TOOLS := \
|
|
|
|
ls \
|
|
|
|
mount \
|
|
|
|
cat \
|
|
|
|
ps \
|
|
|
|
kill \
|
|
|
|
ln \
|
|
|
|
insmod \
|
|
|
|
rmmod \
|
|
|
|
lsmod \
|
|
|
|
ifconfig \
|
|
|
|
setconsole \
|
|
|
|
rm \
|
|
|
|
mkdir \
|
|
|
|
rmdir \
|
|
|
|
reboot \
|
|
|
|
getevent \
|
|
|
|
sendevent \
|
|
|
|
date \
|
|
|
|
wipe \
|
|
|
|
sync \
|
|
|
|
umount \
|
|
|
|
start \
|
|
|
|
stop \
|
|
|
|
notify \
|
|
|
|
cmp \
|
|
|
|
dmesg \
|
|
|
|
route \
|
|
|
|
hd \
|
|
|
|
dd \
|
|
|
|
df \
|
|
|
|
getprop \
|
|
|
|
setprop \
|
|
|
|
watchprops \
|
|
|
|
log \
|
|
|
|
sleep \
|
|
|
|
renice \
|
|
|
|
printenv \
|
|
|
|
smd \
|
|
|
|
chmod \
|
2010-01-19 00:44:33 +08:00
|
|
|
chown \
|
2009-07-07 02:10:03 +08:00
|
|
|
newfs_msdos \
|
2009-03-04 11:32:55 +08:00
|
|
|
netstat \
|
|
|
|
ioctl \
|
|
|
|
mv \
|
|
|
|
schedtop \
|
|
|
|
top \
|
|
|
|
iftop \
|
|
|
|
id \
|
2010-04-10 03:27:16 +08:00
|
|
|
uptime \
|
2009-09-18 08:30:55 +08:00
|
|
|
vmstat \
|
2010-02-26 06:02:55 +08:00
|
|
|
nandread \
|
2010-07-28 00:20:02 +08:00
|
|
|
ionice \
|
2011-04-06 11:46:30 +08:00
|
|
|
touch \
|
2012-01-12 10:13:26 +08:00
|
|
|
lsof \
|
2012-07-10 08:31:26 +08:00
|
|
|
du \
|
2012-01-12 10:13:26 +08:00
|
|
|
md5
|
2009-03-04 11:32:55 +08:00
|
|
|
|
2012-01-13 21:53:56 +08:00
|
|
|
ifeq ($(HAVE_SELINUX),true)
|
|
|
|
|
|
|
|
TOOLS += \
|
|
|
|
getenforce \
|
|
|
|
setenforce \
|
|
|
|
chcon \
|
|
|
|
restorecon \
|
|
|
|
runcon \
|
|
|
|
getsebool \
|
|
|
|
setsebool \
|
|
|
|
load_policy
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2011-04-29 05:23:26 +08:00
|
|
|
ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
|
|
|
|
TOOLS += r
|
|
|
|
endif
|
|
|
|
|
2009-03-04 11:32:55 +08:00
|
|
|
LOCAL_SRC_FILES:= \
|
2011-01-06 15:39:44 +08:00
|
|
|
dynarray.c \
|
2009-03-04 11:32:55 +08:00
|
|
|
toolbox.c \
|
|
|
|
$(patsubst %,%.c,$(TOOLS))
|
|
|
|
|
2010-12-29 21:33:24 +08:00
|
|
|
LOCAL_SHARED_LIBRARIES := libcutils libc libusbhost
|
2010-12-10 06:52:53 +08:00
|
|
|
|
2012-01-12 10:13:26 +08:00
|
|
|
LOCAL_C_INCLUDES := bionic/libc/bionic
|
|
|
|
|
2012-01-13 21:53:56 +08:00
|
|
|
ifeq ($(HAVE_SELINUX),true)
|
|
|
|
|
|
|
|
LOCAL_CFLAGS += -DHAVE_SELINUX
|
|
|
|
LOCAL_SHARED_LIBRARIES += libselinux
|
|
|
|
LOCAL_C_INCLUDES += external/libselinux/include
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
2009-03-04 11:32:55 +08:00
|
|
|
LOCAL_MODULE:= toolbox
|
|
|
|
|
|
|
|
# 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_OUT)/bin/,$(TOOLS))
|
|
|
|
$(SYMLINKS): TOOLBOX_BINARY := $(LOCAL_MODULE)
|
|
|
|
$(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)
|