blob: f81250f658e8f6cdc7b6503dfc73e9b09a73488a [file] [log] [blame]
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -08001#
2# Copyright (C) 2014 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17LOCAL_PATH := $(call my-dir)
18
19#
20# To update:
21#
22
23# git remote add toybox https://github.com/gfto/toybox.git
24# git fetch toybox
25# git merge toybox/master
26# mm -j32
27# # (Make any necessary Android.mk changes and test the new toybox.)
28# git push aosp HEAD:master # Push directly, avoiding gerrit.
29# git push aosp HEAD:refs/for/master # Push to gerrit.
30#
31# # Now commit any necessary Android.mk changes like normal:
32# repo start post-sync .
33# git commit -a
34
35
Elliott Hughes361d6ab2015-03-13 14:49:52 -070036#
37# To add a toy:
38#
39
40# make menuconfig
41# # (Select the toy you want to add.)
42# make clean && make # Regenerate the generated files.
43# # Edit LOCAL_SRC_FILES below to add the toy.
44# # If you just want to use it as "toybox x" rather than "x", you can stop now.
45# # If you want this toy to have a symbolic link in /system/bin, add the toy to ALL_TOOLS.
46
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -080047include $(CLEAR_VARS)
48
49LOCAL_SRC_FILES := \
50 lib/args.c \
51 lib/dirtree.c \
52 lib/getmountlist.c \
53 lib/help.c \
54 lib/lib.c \
55 lib/llist.c \
56 lib/net.c \
57 lib/portability.c \
58 lib/xwrap.c \
59 main.c \
Elliott Hughes0e6551a2015-03-28 12:49:31 -070060 toys/android/getenforce.c \
61 toys/android/load_policy.c \
Elliott Hughescfbb8c12015-03-23 17:53:47 -070062 toys/android/runcon.c \
Elliott Hughes0e6551a2015-03-28 12:49:31 -070063 toys/android/setenforce.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -080064 toys/lsb/dmesg.c \
65 toys/lsb/hostname.c \
66 toys/lsb/killall.c \
67 toys/lsb/md5sum.c \
68 toys/lsb/mknod.c \
69 toys/lsb/mktemp.c \
70 toys/lsb/mount.c \
71 toys/lsb/pidof.c \
72 toys/lsb/seq.c \
73 toys/lsb/sync.c \
74 toys/lsb/umount.c \
75 toys/other/acpi.c \
Elliott Hughes14862232014-12-18 17:55:47 -080076 toys/other/base64.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -080077 toys/other/blkid.c \
78 toys/other/blockdev.c \
79 toys/other/bzcat.c \
Elliott Hughesbf65a2e2015-02-09 12:14:46 -080080 toys/other/chcon.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -080081 toys/other/chroot.c \
82 toys/other/chvt.c \
83 toys/other/clear.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -080084 toys/other/dos2unix.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -080085 toys/other/fallocate.c \
86 toys/other/free.c \
87 toys/other/freeramdisk.c \
88 toys/other/fsfreeze.c \
89 toys/other/help.c \
90 toys/other/ifconfig.c \
91 toys/other/inotifyd.c \
92 toys/other/insmod.c \
93 toys/other/losetup.c \
94 toys/other/lsattr.c \
95 toys/other/lsmod.c \
96 toys/other/lspci.c \
97 toys/other/lsusb.c \
98 toys/other/makedevs.c \
99 toys/other/mkswap.c \
100 toys/other/modinfo.c \
101 toys/other/mountpoint.c \
102 toys/other/nbd_client.c \
103 toys/other/netcat.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800104 toys/other/partprobe.c \
105 toys/other/pivot_root.c \
106 toys/other/pmap.c \
107 toys/other/printenv.c \
108 toys/other/pwdx.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800109 toys/other/readlink.c \
110 toys/other/realpath.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800111 toys/other/rev.c \
112 toys/other/rfkill.c \
113 toys/other/rmmod.c \
114 toys/other/setsid.c \
115 toys/other/stat.c \
116 toys/other/swapoff.c \
117 toys/other/swapon.c \
118 toys/other/switch_root.c \
119 toys/other/sysctl.c \
120 toys/other/tac.c \
121 toys/other/taskset.c \
122 toys/other/timeout.c \
123 toys/other/truncate.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800124 toys/other/usleep.c \
125 toys/other/vconfig.c \
126 toys/other/vmstat.c \
127 toys/other/which.c \
128 toys/other/yes.c \
Elliott Hughes3c3e83a2014-12-16 20:18:05 -0800129 toys/pending/dd.c \
Elliott Hughes88db4122015-02-18 17:32:09 -0800130 toys/pending/expr.c \
Elliott Hughes9aaeff32015-01-14 12:26:10 -0800131 toys/pending/hwclock.c \
Elliott Hughes53a43da2014-12-11 17:05:54 -0800132 toys/pending/more.c \
Elliott Hughes5d2ad232015-03-19 22:52:46 -0700133 toys/pending/pgrep.c \
Elliott Hughes3c3e83a2014-12-16 20:18:05 -0800134 toys/pending/ps.c \
135 toys/pending/netstat.c \
136 toys/pending/route.c \
Elliott Hughes88db4122015-02-18 17:32:09 -0800137 toys/pending/tar.c \
Elliott Hughes3c3e83a2014-12-16 20:18:05 -0800138 toys/pending/top.c \
Elliott Hughes347e42b2015-01-13 18:45:44 -0800139 toys/pending/tr.c \
Elliott Hughes3c3e83a2014-12-16 20:18:05 -0800140 toys/pending/traceroute.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800141 toys/posix/basename.c \
142 toys/posix/cal.c \
143 toys/posix/cat.c \
144 toys/posix/chgrp.c \
145 toys/posix/chmod.c \
146 toys/posix/cksum.c \
147 toys/posix/cmp.c \
148 toys/posix/comm.c \
149 toys/posix/cp.c \
Elliott Hughesbfa8d062015-02-05 10:02:55 -0800150 toys/posix/cpio.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800151 toys/posix/cut.c \
152 toys/posix/date.c \
153 toys/posix/df.c \
154 toys/posix/dirname.c \
155 toys/posix/du.c \
156 toys/posix/echo.c \
157 toys/posix/env.c \
158 toys/posix/expand.c \
159 toys/posix/false.c \
160 toys/posix/find.c \
161 toys/posix/grep.c \
162 toys/posix/head.c \
163 toys/posix/id.c \
164 toys/posix/kill.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800165 toys/posix/ln.c \
166 toys/posix/ls.c \
167 toys/posix/mkdir.c \
168 toys/posix/mkfifo.c \
169 toys/posix/nice.c \
170 toys/posix/nl.c \
171 toys/posix/nohup.c \
172 toys/posix/od.c \
173 toys/posix/paste.c \
174 toys/posix/patch.c \
Elliott Hughes0e6551a2015-03-28 12:49:31 -0700175 toys/posix/printf.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800176 toys/posix/pwd.c \
177 toys/posix/renice.c \
178 toys/posix/rm.c \
179 toys/posix/rmdir.c \
Elliott Hughes347e42b2015-01-13 18:45:44 -0800180 toys/posix/sed.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800181 toys/posix/sleep.c \
182 toys/posix/sort.c \
183 toys/posix/split.c \
184 toys/posix/strings.c \
185 toys/posix/tail.c \
186 toys/posix/tee.c \
187 toys/posix/time.c \
188 toys/posix/touch.c \
189 toys/posix/true.c \
190 toys/posix/tty.c \
191 toys/posix/uname.c \
192 toys/posix/uniq.c \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800193 toys/posix/wc.c \
194 toys/posix/xargs.c \
195
196LOCAL_CFLAGS += \
197 -Os \
198 -Wno-char-subscripts \
199 -Wno-sign-compare \
Elliott Hughes0e6551a2015-03-28 12:49:31 -0700200 -Wno-string-plus-int \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800201 -Wno-uninitialized \
202 -Wno-unused-parameter \
Elliott Hughesd3533982015-01-15 15:04:19 -0800203 -funsigned-char \
204 -ffunction-sections -fdata-sections \
205 -fno-asynchronous-unwind-tables \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800206
Elliott Hughes76115632014-12-16 09:14:47 -0800207LOCAL_SHARED_LIBRARIES := libselinux
208
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800209LOCAL_MODULE := toybox
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800210
Elliott Hughes5eec03a2015-02-09 14:09:49 -0800211# dupes: dd df du ls mount renice umount
Elliott Hughes79984b42015-02-09 12:16:39 -0800212# useless?: chvt freeramdisk fsfreeze install makedevs mkfifo nbd-client
Elliott Hughesbf65a2e2015-02-09 12:14:46 -0800213# partprobe pivot_root pwdx rev rfkill switch_root tty vconfig
Elliott Hughes5eec03a2015-02-09 14:09:49 -0800214# prefer BSD netcat instead?: nc netcat
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800215# prefer efs2progs instead?: blkid chattr lsattr
216
217ALL_TOOLS := \
218 acpi \
219 basename \
220 blockdev \
221 bzcat \
222 cal \
Elliott Hughes1e0e5ea2015-01-14 10:40:22 -0800223 cat \
Elliott Hughes76115632014-12-16 09:14:47 -0800224 chcon \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800225 chgrp \
Elliott Hughes5c7cca02014-12-11 12:12:59 -0800226 chmod \
Elliott Hughes6ee70fc2015-01-15 13:41:34 -0800227 chown \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800228 chroot \
229 cksum \
Elliott Hughes03275a82014-11-22 22:56:47 -0800230 clear \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800231 comm \
Elliott Hughesd3533982015-01-15 15:04:19 -0800232 cmp \
Elliott Hughes6b4d05c2014-12-16 16:15:47 -0800233 cp \
Elliott Hughesbfa8d062015-02-05 10:02:55 -0800234 cpio \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800235 cut \
Elliott Hughes9aaeff32015-01-14 12:26:10 -0800236 date \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800237 dirname \
Elliott Hughesc99e20b2014-11-26 11:38:43 -0800238 dmesg \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800239 dos2unix \
240 echo \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800241 env \
242 expand \
Elliott Hughes88db4122015-02-18 17:32:09 -0800243 expr \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800244 fallocate \
Elliott Hughes03275a82014-11-22 22:56:47 -0800245 false \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800246 find \
247 free \
Elliott Hughes9250c952014-12-24 11:29:44 -0800248 getenforce \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800249 groups \
250 head \
251 hostname \
Elliott Hughes9aaeff32015-01-14 12:26:10 -0800252 hwclock \
Elliott Hughesc8fa5ee2015-01-16 19:27:31 -0800253 id \
Elliott Hughes4f060a32015-01-14 11:07:28 -0800254 ifconfig \
Elliott Hughes123aecf2015-01-14 11:00:47 -0800255 inotifyd \
Elliott Hughes6a646ef2014-11-24 11:41:35 -0800256 insmod \
Elliott Hughes95211ea2014-12-04 20:09:44 -0800257 kill \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800258 killall \
Elliott Hughes0e6551a2015-03-28 12:49:31 -0700259 load_policy \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800260 ln \
261 logname \
262 losetup \
Elliott Hughes6a646ef2014-11-24 11:41:35 -0800263 lsmod \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800264 lspci \
265 lsusb \
266 md5sum \
Elliott Hughesd13bf6a2014-12-16 15:17:17 -0800267 mkdir \
Elliott Hughes0a0435c2014-12-11 18:34:09 -0800268 mknod \
Elliott Hughes620bc1a2014-11-24 16:12:40 -0800269 mkswap \
Elliott Hughes79984b42015-02-09 12:16:39 -0800270 mktemp \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800271 modinfo \
Elliott Hughes53a43da2014-12-11 17:05:54 -0800272 more \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800273 mountpoint \
Elliott Hughesdbcacc62014-12-16 19:18:43 -0800274 mv \
Elliott Hughes5f9893b2014-12-23 09:12:18 -0800275 netstat \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800276 nice \
277 nl \
Elliott Hughes9f989412014-11-25 17:00:40 -0800278 nohup \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800279 od \
280 paste \
281 patch \
Elliott Hughes5d2ad232015-03-19 22:52:46 -0700282 pgrep \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800283 pidof \
Elliott Hughes5d2ad232015-03-19 22:52:46 -0700284 pkill \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800285 pmap \
Elliott Hughes68e18cd2014-11-24 15:36:51 -0800286 printenv \
Elliott Hughes0e6551a2015-03-28 12:49:31 -0700287 printf \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800288 pwd \
Elliott Hughes8f7bc7a2014-11-26 15:21:03 -0800289 readlink \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800290 realpath \
Elliott Hughesf5275f92014-12-16 16:22:32 -0800291 rm \
Elliott Hughesd4a6d662014-12-16 15:26:53 -0800292 rmdir \
Elliott Hughes6a646ef2014-11-24 11:41:35 -0800293 rmmod \
Elliott Hughes84974ec2015-03-30 11:25:18 -0700294 route \
Elliott Hughescfbb8c12015-03-23 17:53:47 -0700295 runcon \
Elliott Hughes347e42b2015-01-13 18:45:44 -0800296 sed \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800297 seq \
Elliott Hughes9250c952014-12-24 11:29:44 -0800298 setenforce \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800299 setsid \
300 sha1sum \
Elliott Hughes62cf8d62014-11-24 15:23:04 -0800301 sleep \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800302 sort \
303 split \
304 stat \
305 strings \
Elliott Hughes620bc1a2014-11-24 16:12:40 -0800306 swapoff \
307 swapon \
Elliott Hughes85368282014-11-24 14:53:36 -0800308 sync \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800309 sysctl \
310 tac \
311 tail \
Elliott Hughes88db4122015-02-18 17:32:09 -0800312 tar \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800313 taskset \
314 tee \
315 time \
316 timeout \
Elliott Hughes5eec03a2015-02-09 14:09:49 -0800317 touch \
Elliott Hughes347e42b2015-01-13 18:45:44 -0800318 tr \
Elliott Hughes03275a82014-11-22 22:56:47 -0800319 true \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800320 truncate \
321 uname \
322 uniq \
323 unix2dos \
Elliott Hughes10bd49e2014-11-21 14:53:43 -0800324 usleep \
Elliott Hughes20800602014-11-25 17:25:05 -0800325 vmstat \
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800326 wc \
327 which \
328 whoami \
329 xargs \
330 yes \
331
Ying Wang331b22d2014-11-24 12:42:09 -0800332# Install the symlinks.
333LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toybox $(TARGET_OUT)/bin/$(t);)
Elliott Hughesd8d2d3c2014-11-20 10:39:27 -0800334
Ying Wang331b22d2014-11-24 12:42:09 -0800335include $(BUILD_EXECUTABLE)