Ethan Yonker | c798c9c | 2015-10-09 11:15:26 -0500 | [diff] [blame] | 1 | # |
| 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 | |
| 17 | ifneq ($(wildcard external/toybox/Android.mk),) |
| 18 | |
| 19 | ifeq ($(TW_USE_TOOLBOX), true) |
| 20 | |
| 21 | LOCAL_PATH := external/toybox |
| 22 | |
| 23 | # |
| 24 | # To update: |
| 25 | # |
| 26 | |
| 27 | # git remote add toybox https://github.com/landley/toybox.git |
| 28 | # git fetch toybox |
| 29 | # git merge toybox/master |
| 30 | # mm -j32 |
| 31 | # # (Make any necessary Android.mk changes and test the new toybox.) |
| 32 | # git push aosp HEAD:master # Push directly, avoiding gerrit. |
| 33 | # git push aosp HEAD:refs/for/master # Push to gerrit. |
| 34 | # |
| 35 | # # Now commit any necessary Android.mk changes like normal: |
| 36 | # repo start post-sync . |
| 37 | # git commit -a |
| 38 | |
| 39 | |
| 40 | # |
| 41 | # To add a toy: |
| 42 | # |
| 43 | |
| 44 | # make menuconfig |
| 45 | # # (Select the toy you want to add.) |
| 46 | # make clean && make # Regenerate the generated files. |
| 47 | # # Edit LOCAL_SRC_FILES below to add the toy. |
| 48 | # # If you just want to use it as "toybox x" rather than "x", you can stop now. |
| 49 | # # If you want this toy to have a symbolic link in /system/bin, add the toy to ALL_TOOLS. |
| 50 | |
| 51 | include $(CLEAR_VARS) |
| 52 | |
| 53 | LOCAL_SRC_FILES := \ |
| 54 | lib/args.c \ |
| 55 | lib/dirtree.c \ |
| 56 | lib/getmountlist.c \ |
| 57 | lib/help.c \ |
| 58 | lib/interestingtimes.c \ |
| 59 | lib/lib.c \ |
| 60 | lib/llist.c \ |
| 61 | lib/net.c \ |
| 62 | lib/portability.c \ |
| 63 | lib/xwrap.c \ |
| 64 | main.c \ |
| 65 | toys/android/getenforce.c \ |
| 66 | toys/android/getprop.c \ |
| 67 | toys/android/load_policy.c \ |
| 68 | toys/android/restorecon.c \ |
| 69 | toys/android/runcon.c \ |
| 70 | toys/android/setenforce.c \ |
| 71 | toys/android/setprop.c \ |
Ethan Yonker | c798c9c | 2015-10-09 11:15:26 -0500 | [diff] [blame] | 72 | toys/lsb/hostname.c \ |
| 73 | toys/lsb/killall.c \ |
| 74 | toys/lsb/md5sum.c \ |
| 75 | toys/lsb/mknod.c \ |
| 76 | toys/lsb/mktemp.c \ |
| 77 | toys/lsb/mount.c \ |
| 78 | toys/lsb/pidof.c \ |
| 79 | toys/lsb/seq.c \ |
| 80 | toys/lsb/sync.c \ |
| 81 | toys/lsb/umount.c \ |
| 82 | toys/other/acpi.c \ |
| 83 | toys/other/base64.c \ |
| 84 | toys/other/blkid.c \ |
| 85 | toys/other/blockdev.c \ |
| 86 | toys/other/bzcat.c \ |
| 87 | toys/other/chcon.c \ |
| 88 | toys/other/chroot.c \ |
| 89 | toys/other/clear.c \ |
| 90 | toys/other/dos2unix.c \ |
| 91 | toys/other/fallocate.c \ |
| 92 | toys/other/free.c \ |
| 93 | toys/other/freeramdisk.c \ |
| 94 | toys/other/fsfreeze.c \ |
| 95 | toys/other/help.c \ |
Ethan Yonker | c798c9c | 2015-10-09 11:15:26 -0500 | [diff] [blame] | 96 | toys/other/inotifyd.c \ |
| 97 | toys/other/insmod.c \ |
| 98 | toys/other/losetup.c \ |
| 99 | toys/other/lsattr.c \ |
| 100 | toys/other/lsmod.c \ |
| 101 | toys/other/lsusb.c \ |
| 102 | toys/other/makedevs.c \ |
| 103 | toys/other/mkswap.c \ |
| 104 | toys/other/modinfo.c \ |
| 105 | toys/other/mountpoint.c \ |
| 106 | toys/other/nbd_client.c \ |
Ethan Yonker | c798c9c | 2015-10-09 11:15:26 -0500 | [diff] [blame] | 107 | toys/other/partprobe.c \ |
| 108 | toys/other/pivot_root.c \ |
| 109 | toys/other/pmap.c \ |
| 110 | toys/other/printenv.c \ |
| 111 | toys/other/pwdx.c \ |
| 112 | toys/other/readlink.c \ |
| 113 | toys/other/realpath.c \ |
| 114 | toys/other/rev.c \ |
Ethan Yonker | c798c9c | 2015-10-09 11:15:26 -0500 | [diff] [blame] | 115 | toys/other/rmmod.c \ |
| 116 | toys/other/setsid.c \ |
| 117 | toys/other/stat.c \ |
| 118 | toys/other/swapoff.c \ |
| 119 | toys/other/swapon.c \ |
Ethan Yonker | c798c9c | 2015-10-09 11:15:26 -0500 | [diff] [blame] | 120 | toys/other/sysctl.c \ |
| 121 | toys/other/tac.c \ |
| 122 | toys/other/taskset.c \ |
| 123 | toys/other/timeout.c \ |
| 124 | toys/other/truncate.c \ |
| 125 | toys/other/usleep.c \ |
| 126 | toys/other/vconfig.c \ |
| 127 | toys/other/vmstat.c \ |
| 128 | toys/other/which.c \ |
| 129 | toys/other/yes.c \ |
| 130 | toys/pending/dd.c \ |
| 131 | toys/pending/expr.c \ |
Ethan Yonker | c798c9c | 2015-10-09 11:15:26 -0500 | [diff] [blame] | 132 | toys/pending/more.c \ |
Ethan Yonker | c798c9c | 2015-10-09 11:15:26 -0500 | [diff] [blame] | 133 | toys/pending/route.c \ |
| 134 | toys/pending/tar.c \ |
Ethan Yonker | c798c9c | 2015-10-09 11:15:26 -0500 | [diff] [blame] | 135 | toys/pending/tr.c \ |
| 136 | toys/pending/traceroute.c \ |
| 137 | toys/posix/basename.c \ |
| 138 | toys/posix/cal.c \ |
| 139 | toys/posix/cat.c \ |
| 140 | toys/posix/chgrp.c \ |
| 141 | toys/posix/chmod.c \ |
| 142 | toys/posix/cksum.c \ |
| 143 | toys/posix/cmp.c \ |
| 144 | toys/posix/comm.c \ |
| 145 | toys/posix/cp.c \ |
| 146 | toys/posix/cpio.c \ |
| 147 | toys/posix/cut.c \ |
| 148 | toys/posix/date.c \ |
| 149 | toys/posix/df.c \ |
| 150 | toys/posix/dirname.c \ |
| 151 | toys/posix/du.c \ |
| 152 | toys/posix/echo.c \ |
| 153 | toys/posix/env.c \ |
| 154 | toys/posix/expand.c \ |
| 155 | toys/posix/false.c \ |
| 156 | toys/posix/find.c \ |
| 157 | toys/posix/grep.c \ |
| 158 | toys/posix/head.c \ |
| 159 | toys/posix/id.c \ |
| 160 | toys/posix/kill.c \ |
| 161 | toys/posix/ln.c \ |
| 162 | toys/posix/ls.c \ |
| 163 | toys/posix/mkdir.c \ |
| 164 | toys/posix/mkfifo.c \ |
| 165 | toys/posix/nice.c \ |
| 166 | toys/posix/nl.c \ |
| 167 | toys/posix/nohup.c \ |
| 168 | toys/posix/od.c \ |
| 169 | toys/posix/paste.c \ |
| 170 | toys/posix/patch.c \ |
| 171 | toys/posix/printf.c \ |
| 172 | toys/posix/pwd.c \ |
| 173 | toys/posix/renice.c \ |
| 174 | toys/posix/rm.c \ |
| 175 | toys/posix/rmdir.c \ |
| 176 | toys/posix/sed.c \ |
| 177 | toys/posix/sleep.c \ |
| 178 | toys/posix/sort.c \ |
| 179 | toys/posix/split.c \ |
| 180 | toys/posix/strings.c \ |
| 181 | toys/posix/tail.c \ |
| 182 | toys/posix/tee.c \ |
| 183 | toys/posix/time.c \ |
| 184 | toys/posix/touch.c \ |
| 185 | toys/posix/true.c \ |
| 186 | toys/posix/tty.c \ |
| 187 | toys/posix/uname.c \ |
| 188 | toys/posix/uniq.c \ |
| 189 | toys/posix/wc.c \ |
Hashcode | 5733215 | 2016-12-20 01:30:49 +0100 | [diff] [blame] | 190 | toys/posix/xargs.c |
| 191 | |
Captain Throwback | 695baa6 | 2019-04-26 10:46:32 -0400 | [diff] [blame] | 192 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -eq 26; echo $$?),0) |
| 193 | # Android 8.0 had some tools in different paths |
| 194 | LOCAL_SRC_FILES += \ |
| 195 | toys/pending/dmesg.c |
| 196 | else |
| 197 | LOCAL_SRC_FILES += \ |
| 198 | toys/lsb/dmesg.c |
| 199 | endif |
| 200 | |
D. Andrei Măceș | 9ce12ec | 2016-12-22 17:14:21 -0500 | [diff] [blame] | 201 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 23; echo $$?),0) |
| 202 | # there are some conflicts here with AOSP-7.[01] and CM-14.[01] |
Hashcode | 5733215 | 2016-12-20 01:30:49 +0100 | [diff] [blame] | 203 | # the following items have been removed for compatibility |
| 204 | # ifconfig, netcat, netstat, rfkill, switch_root |
| 205 | LOCAL_STATIC_LIBRARIES := libcrypto_static |
| 206 | |
| 207 | LOCAL_C_INCLUDES += \ |
| 208 | external/boringssl/include \ |
| 209 | bionic/libc/dns/include |
| 210 | |
| 211 | LOCAL_SRC_FILES += \ |
| 212 | lib/linestack.c \ |
| 213 | lib/password.c \ |
| 214 | toys/other/flock.c \ |
| 215 | toys/other/hwclock.c \ |
| 216 | toys/other/ionice.c \ |
| 217 | toys/other/lspci.c \ |
| 218 | toys/other/readahead.c \ |
| 219 | toys/other/reset.c \ |
| 220 | toys/other/uptime.c \ |
| 221 | toys/other/xxd.c \ |
| 222 | toys/pending/arp.c \ |
| 223 | toys/pending/diff.c \ |
Hashcode | 5733215 | 2016-12-20 01:30:49 +0100 | [diff] [blame] | 224 | toys/pending/lsof.c \ |
| 225 | toys/pending/telnet.c \ |
| 226 | toys/pending/test.c \ |
| 227 | toys/pending/watch.c \ |
Hashcode | 5733215 | 2016-12-20 01:30:49 +0100 | [diff] [blame] | 228 | toys/posix/ps.c \ |
| 229 | toys/posix/ulimit.c |
Humberto Borba | 84e1615 | 2018-01-05 00:51:40 -0200 | [diff] [blame] | 230 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 27; echo $$?),0) |
| 231 | LOCAL_SRC_FILES += \ |
| 232 | toys/pending/xzcat.c |
| 233 | endif |
Humberto Borba | 84e1615 | 2018-01-05 00:51:40 -0200 | [diff] [blame] | 234 | |
| 235 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 25; echo $$?),0) |
| 236 | # Android 8.0/8.1 had some tools in different paths |
| 237 | LOCAL_SRC_FILES += \ |
Ethan Yonker | 95e8007 | 2017-08-24 21:45:50 -0500 | [diff] [blame] | 238 | toys/net/ftpget.c |
| 239 | else |
| 240 | LOCAL_SRC_FILES += \ |
Ethan Yonker | 95e8007 | 2017-08-24 21:45:50 -0500 | [diff] [blame] | 241 | toys/pending/ftpget.c |
| 242 | endif |
| 243 | |
Hashcode | 5733215 | 2016-12-20 01:30:49 +0100 | [diff] [blame] | 244 | # Account for master branch changes pulld into CM14.1 |
| 245 | ifneq ($(CM_BUILD),) |
| 246 | LOCAL_SRC_FILES += \ |
| 247 | toys/android/log.c \ |
| 248 | toys/android/sendevent.c \ |
| 249 | toys/android/start.c \ |
| 250 | toys/net/ifconfig.c \ |
| 251 | toys/net/netcat.c \ |
| 252 | toys/net/netstat.c \ |
| 253 | toys/net/rfkill.c \ |
| 254 | toys/net/tunctl.c \ |
| 255 | toys/other/setfattr.c \ |
| 256 | toys/pending/chrt.c \ |
| 257 | toys/pending/fdisk.c \ |
| 258 | toys/pending/getfattr.c \ |
| 259 | toys/pending/host.c \ |
| 260 | toys/pending/resize.c \ |
| 261 | toys/posix/file.c |
| 262 | else |
| 263 | LOCAL_SRC_FILES += \ |
Ethan Yonker | 95e8007 | 2017-08-24 21:45:50 -0500 | [diff] [blame] | 264 | toys/other/switch_root.c |
| 265 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 25; echo $$?),0) |
| 266 | # Android 8.0 had some tools in different paths |
| 267 | LOCAL_SRC_FILES += \ |
Ethan Yonker | 8373cfe | 2017-09-08 06:50:54 -0500 | [diff] [blame] | 268 | toys/android/log.c \ |
| 269 | toys/android/sendevent.c \ |
| 270 | toys/android/start.c \ |
Ethan Yonker | 95e8007 | 2017-08-24 21:45:50 -0500 | [diff] [blame] | 271 | toys/net/ifconfig.c \ |
Ethan Yonker | 8373cfe | 2017-09-08 06:50:54 -0500 | [diff] [blame] | 272 | toys/net/microcom.c \ |
Ethan Yonker | 95e8007 | 2017-08-24 21:45:50 -0500 | [diff] [blame] | 273 | toys/net/netcat.c \ |
| 274 | toys/net/netstat.c \ |
Ethan Yonker | 8373cfe | 2017-09-08 06:50:54 -0500 | [diff] [blame] | 275 | toys/net/rfkill.c \ |
| 276 | toys/net/tunctl.c \ |
Ethan Yonker | 8373cfe | 2017-09-08 06:50:54 -0500 | [diff] [blame] | 277 | toys/pending/getfattr.c \ |
| 278 | toys/pending/modprobe.c \ |
Ethan Yonker | 8373cfe | 2017-09-08 06:50:54 -0500 | [diff] [blame] | 279 | toys/posix/file.c \ |
| 280 | toys/posix/uudecode.c \ |
| 281 | toys/posix/uuencode.c |
Humberto Borba | 84e1615 | 2018-01-05 00:51:40 -0200 | [diff] [blame] | 282 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 26; echo $$?),0) |
| 283 | # Android 8.1 had some tools in different paths |
| 284 | LOCAL_SRC_FILES += \ |
| 285 | toys/other/chrt.c \ |
| 286 | toys/pending/gzip.c |
| 287 | else |
| 288 | LOCAL_SRC_FILES += \ |
| 289 | toys/pending/chrt.c |
| 290 | endif |
Ethan Yonker | 58f2132 | 2018-08-24 11:17:36 -0500 | [diff] [blame] | 291 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 27; echo $$?),0) |
| 292 | # Android 9.0 |
| 293 | LOCAL_SRC_FILES += \ |
| 294 | toys/other/setfattr.c \ |
| 295 | toys/pending/fmt.c \ |
| 296 | toys/pending/stty.c |
| 297 | else |
| 298 | LOCAL_SRC_FILES += \ |
| 299 | toys/pending/setfattr.c |
| 300 | endif |
Ethan Yonker | 8373cfe | 2017-09-08 06:50:54 -0500 | [diff] [blame] | 301 | LOCAL_SHARED_LIBRARIES += liblog |
Ethan Yonker | 95e8007 | 2017-08-24 21:45:50 -0500 | [diff] [blame] | 302 | else |
| 303 | LOCAL_SRC_FILES += \ |
Hashcode | 5733215 | 2016-12-20 01:30:49 +0100 | [diff] [blame] | 304 | toys/other/ifconfig.c \ |
| 305 | toys/other/netcat.c \ |
| 306 | toys/other/rfkill.c \ |
Hashcode | 5733215 | 2016-12-20 01:30:49 +0100 | [diff] [blame] | 307 | toys/pending/netstat.c |
| 308 | endif |
Ethan Yonker | 95e8007 | 2017-08-24 21:45:50 -0500 | [diff] [blame] | 309 | endif |
Hashcode | 5733215 | 2016-12-20 01:30:49 +0100 | [diff] [blame] | 310 | else |
| 311 | LOCAL_SRC_FILES += \ |
| 312 | toys/other/ifconfig.c \ |
| 313 | toys/other/netcat.c \ |
| 314 | toys/other/rfkill.c \ |
| 315 | toys/other/switch_root.c \ |
| 316 | toys/pending/hwclock.c \ |
| 317 | toys/pending/netstat.c \ |
| 318 | toys/pending/pgrep.c \ |
| 319 | toys/pending/top.c |
| 320 | endif |
Ethan Yonker | c798c9c | 2015-10-09 11:15:26 -0500 | [diff] [blame] | 321 | |
| 322 | LOCAL_CFLAGS += \ |
Captain Throwback | 695baa6 | 2019-04-26 10:46:32 -0400 | [diff] [blame] | 323 | -std=c99 \ |
Ethan Yonker | 58f2132 | 2018-08-24 11:17:36 -0500 | [diff] [blame] | 324 | -std=gnu11 \ |
Ethan Yonker | c798c9c | 2015-10-09 11:15:26 -0500 | [diff] [blame] | 325 | -Os \ |
| 326 | -Wno-char-subscripts \ |
| 327 | -Wno-sign-compare \ |
| 328 | -Wno-string-plus-int \ |
| 329 | -Wno-uninitialized \ |
| 330 | -Wno-unused-parameter \ |
| 331 | -funsigned-char \ |
| 332 | -ffunction-sections -fdata-sections \ |
| 333 | -fno-asynchronous-unwind-tables \ |
| 334 | |
Captain Throwback | 695baa6 | 2019-04-26 10:46:32 -0400 | [diff] [blame] | 335 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 24; echo $$?),0) |
| 336 | toybox_version := $(shell git -C $(LOCAL_PATH) rev-parse --short=12 HEAD 2>/dev/null)-android |
| 337 | LOCAL_CFLAGS += -DTOYBOX_VERSION='"$(toybox_version)"' |
| 338 | else |
| 339 | toybox_version := $(shell sed 's/#define.*TOYBOX_VERSION.*"\(.*\)"/\1/p;d' $(LOCAL_PATH)/main.c) |
| 340 | LOCAL_CFLAGS += -DTOYBOX_VERSION=\"$(toybox_version)\" |
| 341 | endif |
Ethan Yonker | c798c9c | 2015-10-09 11:15:26 -0500 | [diff] [blame] | 342 | |
| 343 | LOCAL_CLANG := true |
| 344 | |
Ethan Yonker | 8373cfe | 2017-09-08 06:50:54 -0500 | [diff] [blame] | 345 | LOCAL_SHARED_LIBRARIES += libcutils libselinux |
Ethan Yonker | c798c9c | 2015-10-09 11:15:26 -0500 | [diff] [blame] | 346 | |
Humberto Borba | 84e1615 | 2018-01-05 00:51:40 -0200 | [diff] [blame] | 347 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 26; echo $$?),0) |
| 348 | LOCAL_CFLAGS += \ |
| 349 | -Wno-gnu-variable-sized-type-not-at-end \ |
| 350 | -Wno-missing-field-initializers |
| 351 | |
| 352 | LOCAL_SHARED_LIBRARIES += libz |
| 353 | endif |
| 354 | |
Ethan Yonker | c798c9c | 2015-10-09 11:15:26 -0500 | [diff] [blame] | 355 | LOCAL_MODULE := toybox_recovery |
| 356 | LOCAL_MODULE_STEM := toybox |
| 357 | LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin |
| 358 | LOCAL_MODULE_TAGS := optional |
| 359 | |
| 360 | # dupes: dd df du ls mount renice |
| 361 | # useless?: freeramdisk fsfreeze install makedevs mkfifo nbd-client |
| 362 | # partprobe pivot_root pwdx rev rfkill switch_root tty vconfig |
| 363 | # prefer BSD netcat instead?: nc netcat |
| 364 | # prefer efs2progs instead?: blkid chattr lsattr |
| 365 | |
| 366 | ALL_TOOLS := \ |
| 367 | acpi \ |
| 368 | basename \ |
| 369 | blkid \ |
| 370 | blockdev \ |
| 371 | bzcat \ |
| 372 | cal \ |
| 373 | cat \ |
| 374 | chcon \ |
| 375 | chgrp \ |
| 376 | chmod \ |
| 377 | chown \ |
| 378 | chroot \ |
| 379 | cksum \ |
| 380 | clear \ |
| 381 | comm \ |
| 382 | cmp \ |
| 383 | cp \ |
| 384 | cpio \ |
| 385 | cut \ |
| 386 | date \ |
| 387 | dirname \ |
| 388 | dmesg \ |
| 389 | dos2unix \ |
| 390 | echo \ |
| 391 | env \ |
| 392 | expand \ |
| 393 | expr \ |
| 394 | fallocate \ |
| 395 | false \ |
| 396 | find \ |
| 397 | free \ |
| 398 | getenforce \ |
Ethan Yonker | c798c9c | 2015-10-09 11:15:26 -0500 | [diff] [blame] | 399 | groups \ |
| 400 | head \ |
| 401 | hostname \ |
| 402 | hwclock \ |
| 403 | id \ |
| 404 | ifconfig \ |
| 405 | inotifyd \ |
| 406 | insmod \ |
| 407 | kill \ |
| 408 | load_policy \ |
| 409 | ln \ |
| 410 | logname \ |
| 411 | losetup \ |
| 412 | lsmod \ |
| 413 | lsusb \ |
| 414 | md5sum \ |
| 415 | mkdir \ |
| 416 | mknod \ |
| 417 | mkswap \ |
| 418 | mktemp \ |
| 419 | modinfo \ |
| 420 | more \ |
| 421 | mountpoint \ |
| 422 | mv \ |
| 423 | netstat \ |
| 424 | nice \ |
| 425 | nl \ |
| 426 | nohup \ |
| 427 | od \ |
| 428 | paste \ |
| 429 | patch \ |
| 430 | pgrep \ |
| 431 | pidof \ |
| 432 | pkill \ |
| 433 | pmap \ |
| 434 | printenv \ |
| 435 | printf \ |
| 436 | pwd \ |
| 437 | readlink \ |
| 438 | realpath \ |
| 439 | restorecon \ |
| 440 | rm \ |
| 441 | rmdir \ |
| 442 | rmmod \ |
| 443 | route \ |
| 444 | runcon \ |
| 445 | sed \ |
| 446 | seq \ |
| 447 | setenforce \ |
| 448 | setprop \ |
| 449 | setsid \ |
| 450 | sha1sum \ |
| 451 | sleep \ |
| 452 | sort \ |
| 453 | split \ |
| 454 | stat \ |
| 455 | strings \ |
| 456 | swapoff \ |
| 457 | swapon \ |
| 458 | sync \ |
| 459 | sysctl \ |
| 460 | tac \ |
| 461 | tail \ |
| 462 | tar \ |
| 463 | taskset \ |
| 464 | tee \ |
| 465 | time \ |
| 466 | timeout \ |
| 467 | touch \ |
| 468 | tr \ |
| 469 | true \ |
| 470 | truncate \ |
| 471 | umount \ |
| 472 | uname \ |
| 473 | uniq \ |
| 474 | unix2dos \ |
| 475 | usleep \ |
| 476 | vmstat \ |
| 477 | wc \ |
| 478 | which \ |
| 479 | whoami \ |
| 480 | xargs \ |
Hashcode | 5733215 | 2016-12-20 01:30:49 +0100 | [diff] [blame] | 481 | yes |
| 482 | |
D. Andrei Măceș | 9ce12ec | 2016-12-22 17:14:21 -0500 | [diff] [blame] | 483 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 23; echo $$?),0) |
Hashcode | 5733215 | 2016-12-20 01:30:49 +0100 | [diff] [blame] | 484 | ALL_TOOLS += \ |
| 485 | arp \ |
| 486 | base64 \ |
| 487 | chattr \ |
Hashcode | 5733215 | 2016-12-20 01:30:49 +0100 | [diff] [blame] | 488 | df \ |
| 489 | diff \ |
Hashcode | 5733215 | 2016-12-20 01:30:49 +0100 | [diff] [blame] | 490 | flock \ |
| 491 | freeramdisk \ |
| 492 | fsfreeze \ |
| 493 | fstype \ |
| 494 | ftpget \ |
| 495 | ftpput \ |
Hashcode | 5733215 | 2016-12-20 01:30:49 +0100 | [diff] [blame] | 496 | help \ |
| 497 | install \ |
| 498 | ionice \ |
| 499 | iorenice \ |
| 500 | iotop \ |
| 501 | killall \ |
| 502 | ls \ |
| 503 | lsattr \ |
| 504 | lsof \ |
| 505 | lspci \ |
| 506 | makedevs \ |
| 507 | mkfifo \ |
| 508 | mount \ |
| 509 | nbd-client \ |
| 510 | nc \ |
| 511 | netcat \ |
| 512 | nproc \ |
| 513 | partprobe \ |
| 514 | pivot_root \ |
| 515 | ps \ |
| 516 | pwdx \ |
| 517 | readahead \ |
| 518 | renice \ |
| 519 | reset \ |
| 520 | rev \ |
| 521 | rfkill \ |
| 522 | sha224sum \ |
| 523 | sha256sum \ |
| 524 | sha384sum \ |
| 525 | sha512sum \ |
| 526 | telnet \ |
| 527 | test \ |
| 528 | top \ |
| 529 | traceroute \ |
| 530 | traceroute6 \ |
| 531 | tty \ |
| 532 | tunctl \ |
| 533 | ulimit \ |
| 534 | uptime \ |
| 535 | vconfig \ |
| 536 | watch \ |
Humberto Borba | 84e1615 | 2018-01-05 00:51:40 -0200 | [diff] [blame] | 537 | xxd |
Captain Throwback | f0167c4 | 2019-01-18 13:17:16 -0500 | [diff] [blame] | 538 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -le 27; echo $$?),0) |
Humberto Borba | 84e1615 | 2018-01-05 00:51:40 -0200 | [diff] [blame] | 539 | ALL_TOOLS += \ |
Ethan Yonker | 58f2132 | 2018-08-24 11:17:36 -0500 | [diff] [blame] | 540 | getprop \ |
Hashcode | 5733215 | 2016-12-20 01:30:49 +0100 | [diff] [blame] | 541 | xzcat |
Humberto Borba | 84e1615 | 2018-01-05 00:51:40 -0200 | [diff] [blame] | 542 | endif |
D. Andrei Măceș | 9ce12ec | 2016-12-22 17:14:21 -0500 | [diff] [blame] | 543 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 24; echo $$?),0) |
| 544 | ALL_TOOLS += \ |
Humberto Borba | 84e1615 | 2018-01-05 00:51:40 -0200 | [diff] [blame] | 545 | du \ |
| 546 | gzip \ |
| 547 | gunzip \ |
| 548 | zcat |
bigbiff bigbiff | 6af36a4 | 2019-04-23 20:05:28 -0400 | [diff] [blame] | 549 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 25; echo $$?),0) |
Ethan Yonker | 58f2132 | 2018-08-24 11:17:36 -0500 | [diff] [blame] | 550 | ALL_TOOLS += \ |
| 551 | fmt \ |
| 552 | start \ |
| 553 | stop \ |
| 554 | stty |
| 555 | endif |
D. Andrei Măceș | 9ce12ec | 2016-12-22 17:14:21 -0500 | [diff] [blame] | 556 | endif |
Hashcode | 5733215 | 2016-12-20 01:30:49 +0100 | [diff] [blame] | 557 | # Account for master branch changes pulld into CM14.1 |
| 558 | ifneq ($(CM_BUILD),) |
| 559 | ALL_TOOLS += \ |
| 560 | chrt \ |
| 561 | fdisk \ |
| 562 | file \ |
| 563 | getfattr \ |
| 564 | host \ |
| 565 | log \ |
| 566 | resize \ |
| 567 | setfattr |
| 568 | endif |
| 569 | endif |
Ethan Yonker | c798c9c | 2015-10-09 11:15:26 -0500 | [diff] [blame] | 570 | |
| 571 | # Install the symlinks. |
| 572 | LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toybox $(TARGET_RECOVERY_ROOT_OUT)/sbin/$(t);) |
| 573 | |
| 574 | include $(BUILD_EXECUTABLE) |
| 575 | |
| 576 | # Make /sbin/toolbox launchers for each tool |
| 577 | SYMLINKS := $(addprefix $(TARGET_RECOVERY_ROOT_OUT)/sbin/,$(ALL_TOOLS)) |
| 578 | $(SYMLINKS): TOYBOX_BINARY := $(LOCAL_MODULE_STEM) |
| 579 | $(SYMLINKS): $(LOCAL_INSTALLED_MODULE) $(LOCAL_PATH)/Android.mk |
| 580 | @echo "Symlink: $@ -> $(TOYBOX_BINARY)" |
| 581 | @mkdir -p $(dir $@) |
| 582 | @rm -rf $@ |
| 583 | $(hide) ln -sf $(TOYBOX_BINARY) $@ |
| 584 | |
| 585 | include $(CLEAR_VARS) |
| 586 | LOCAL_MODULE := toybox_symlinks |
| 587 | LOCAL_MODULE_TAGS := optional |
Ethan Yonker | ae7ff3b | 2019-05-24 16:31:09 -0500 | [diff] [blame] | 588 | LOCAL_ADDITIONAL_DEPENDENCIES := $(SYMLINKS) |
Ethan Yonker | c798c9c | 2015-10-09 11:15:26 -0500 | [diff] [blame] | 589 | include $(BUILD_PHONY_PACKAGE) |
| 590 | |
| 591 | endif |
| 592 | |
| 593 | endif |