The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 1 | LOCAL_PATH:= $(call my-dir) |
| 2 | include $(CLEAR_VARS) |
| 3 | |
| 4 | TOOLS := \ |
| 5 | ls \ |
| 6 | mount \ |
| 7 | cat \ |
| 8 | ps \ |
| 9 | kill \ |
| 10 | ln \ |
| 11 | insmod \ |
| 12 | rmmod \ |
| 13 | lsmod \ |
| 14 | ifconfig \ |
| 15 | setconsole \ |
| 16 | rm \ |
| 17 | mkdir \ |
| 18 | rmdir \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 19 | getevent \ |
| 20 | sendevent \ |
| 21 | date \ |
| 22 | wipe \ |
| 23 | sync \ |
| 24 | umount \ |
| 25 | start \ |
| 26 | stop \ |
| 27 | notify \ |
| 28 | cmp \ |
| 29 | dmesg \ |
| 30 | route \ |
| 31 | hd \ |
| 32 | dd \ |
| 33 | df \ |
| 34 | getprop \ |
| 35 | setprop \ |
| 36 | watchprops \ |
| 37 | log \ |
| 38 | sleep \ |
| 39 | renice \ |
| 40 | printenv \ |
| 41 | smd \ |
| 42 | chmod \ |
Dries Harnie | 2a74373 | 2010-01-18 17:44:33 +0100 | [diff] [blame] | 43 | chown \ |
San Mehat | 72eead4 | 2009-07-06 11:10:03 -0700 | [diff] [blame] | 44 | newfs_msdos \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 45 | netstat \ |
| 46 | ioctl \ |
| 47 | mv \ |
| 48 | schedtop \ |
| 49 | top \ |
| 50 | iftop \ |
| 51 | id \ |
Mike Lockwood | a699d62 | 2010-04-09 15:27:16 -0400 | [diff] [blame] | 52 | uptime \ |
Arve Hjønnevåg | 7c953d0 | 2009-09-17 17:30:55 -0700 | [diff] [blame] | 53 | vmstat \ |
San Mehat | 10d469b | 2010-02-25 14:02:55 -0800 | [diff] [blame] | 54 | nandread \ |
Kenny Root | 8b9b105 | 2010-07-27 09:20:02 -0700 | [diff] [blame] | 55 | ionice \ |
Ken Sumrall | 795165b | 2011-04-05 20:46:30 -0700 | [diff] [blame] | 56 | touch \ |
Scott Anderson | d0455c9 | 2012-01-11 18:13:26 -0800 | [diff] [blame] | 57 | lsof \ |
Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 58 | du \ |
Michael Wright | 52abb4b | 2012-07-15 15:52:50 -0700 | [diff] [blame] | 59 | md5 \ |
Kenny Root | efb5e3c | 2012-10-16 18:00:29 -0700 | [diff] [blame] | 60 | clear \ |
Stephen Smalley | 8290d10 | 2012-01-13 08:53:56 -0500 | [diff] [blame] | 61 | getenforce \ |
| 62 | setenforce \ |
| 63 | chcon \ |
| 64 | restorecon \ |
| 65 | runcon \ |
| 66 | getsebool \ |
| 67 | setsebool \ |
Rom Lemarchand | 367297c | 2013-06-05 13:25:12 -0700 | [diff] [blame] | 68 | load_policy \ |
| 69 | swapon \ |
| 70 | swapoff \ |
Michael Wright | 9f50abd | 2013-08-19 15:56:34 -0700 | [diff] [blame] | 71 | mkswap \ |
Glenn Kasten | 3707e7f | 2013-09-23 15:10:12 -0700 | [diff] [blame] | 72 | readlink \ |
| 73 | nohup |
Stephen Smalley | 8290d10 | 2012-01-13 08:53:56 -0500 | [diff] [blame] | 74 | |
Erik Gilling | b76f0ff | 2011-04-28 14:23:26 -0700 | [diff] [blame] | 75 | ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) |
| 76 | TOOLS += r |
| 77 | endif |
| 78 | |
Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 79 | ALL_TOOLS = $(TOOLS) |
| 80 | ALL_TOOLS += \ |
Jeff Sharkey | 3e8b158 | 2012-07-13 16:37:13 -0700 | [diff] [blame] | 81 | cp \ |
| 82 | grep |
Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 83 | |
| 84 | LOCAL_SRC_FILES := \ |
David 'Digit' Turner | a8d1afb | 2011-01-06 08:39:44 +0100 | [diff] [blame] | 85 | dynarray.c \ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 86 | toolbox.c \ |
Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 87 | $(patsubst %,%.c,$(TOOLS)) \ |
Jeff Sharkey | 3e8b158 | 2012-07-13 16:37:13 -0700 | [diff] [blame] | 88 | cp/cp.c cp/utils.c \ |
| 89 | grep/grep.c grep/fastgrep.c grep/file.c grep/queue.c grep/util.c |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 90 | |
Scott Anderson | d0455c9 | 2012-01-11 18:13:26 -0800 | [diff] [blame] | 91 | LOCAL_C_INCLUDES := bionic/libc/bionic |
| 92 | |
Kenny Root | b83c098 | 2012-10-10 11:26:33 -0700 | [diff] [blame] | 93 | LOCAL_SHARED_LIBRARIES := \ |
| 94 | libcutils \ |
Ying Wang | 083b5cc | 2013-04-09 22:03:45 -0700 | [diff] [blame] | 95 | liblog \ |
Kenny Root | b83c098 | 2012-10-10 11:26:33 -0700 | [diff] [blame] | 96 | libc \ |
| 97 | libusbhost \ |
| 98 | libselinux |
Stephen Smalley | 8290d10 | 2012-01-13 08:53:56 -0500 | [diff] [blame] | 99 | |
Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 100 | LOCAL_MODULE := toolbox |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 101 | |
| 102 | # Including this will define $(intermediates). |
| 103 | # |
| 104 | include $(BUILD_EXECUTABLE) |
| 105 | |
| 106 | $(LOCAL_PATH)/toolbox.c: $(intermediates)/tools.h |
| 107 | |
| 108 | TOOLS_H := $(intermediates)/tools.h |
Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 109 | $(TOOLS_H): PRIVATE_TOOLS := $(ALL_TOOLS) |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 110 | $(TOOLS_H): PRIVATE_CUSTOM_TOOL = echo "/* file generated automatically */" > $@ ; for t in $(PRIVATE_TOOLS) ; do echo "TOOL($$t)" >> $@ ; done |
| 111 | $(TOOLS_H): $(LOCAL_PATH)/Android.mk |
| 112 | $(TOOLS_H): |
| 113 | $(transform-generated-source) |
| 114 | |
| 115 | # Make #!/system/bin/toolbox launchers for each tool. |
| 116 | # |
Jeff Sharkey | 57df14c | 2012-07-13 16:25:33 -0700 | [diff] [blame] | 117 | SYMLINKS := $(addprefix $(TARGET_OUT)/bin/,$(ALL_TOOLS)) |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 118 | $(SYMLINKS): TOOLBOX_BINARY := $(LOCAL_MODULE) |
| 119 | $(SYMLINKS): $(LOCAL_INSTALLED_MODULE) $(LOCAL_PATH)/Android.mk |
| 120 | @echo "Symlink: $@ -> $(TOOLBOX_BINARY)" |
| 121 | @mkdir -p $(dir $@) |
| 122 | @rm -rf $@ |
| 123 | $(hide) ln -sf $(TOOLBOX_BINARY) $@ |
| 124 | |
| 125 | ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS) |
| 126 | |
| 127 | # We need this so that the installed files could be picked up based on the |
| 128 | # local module name |
| 129 | ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \ |
| 130 | $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS) |