Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [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 | LOCAL_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 | |
| 36 | include $(CLEAR_VARS) |
| 37 | |
| 38 | LOCAL_SRC_FILES := \ |
| 39 | lib/args.c \ |
| 40 | lib/dirtree.c \ |
| 41 | lib/getmountlist.c \ |
| 42 | lib/help.c \ |
| 43 | lib/lib.c \ |
| 44 | lib/llist.c \ |
| 45 | lib/net.c \ |
| 46 | lib/portability.c \ |
| 47 | lib/xwrap.c \ |
| 48 | main.c \ |
| 49 | toys/lsb/dmesg.c \ |
| 50 | toys/lsb/hostname.c \ |
| 51 | toys/lsb/killall.c \ |
| 52 | toys/lsb/md5sum.c \ |
| 53 | toys/lsb/mknod.c \ |
| 54 | toys/lsb/mktemp.c \ |
| 55 | toys/lsb/mount.c \ |
| 56 | toys/lsb/pidof.c \ |
| 57 | toys/lsb/seq.c \ |
| 58 | toys/lsb/sync.c \ |
| 59 | toys/lsb/umount.c \ |
| 60 | toys/other/acpi.c \ |
Elliott Hughes | 1486223 | 2014-12-18 17:55:47 -0800 | [diff] [blame] | 61 | toys/other/base64.c \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 62 | toys/other/blkid.c \ |
| 63 | toys/other/blockdev.c \ |
| 64 | toys/other/bzcat.c \ |
Elliott Hughes | bf65a2e | 2015-02-09 12:14:46 -0800 | [diff] [blame] | 65 | toys/other/chcon.c \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 66 | toys/other/chroot.c \ |
| 67 | toys/other/chvt.c \ |
| 68 | toys/other/clear.c \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 69 | toys/other/dos2unix.c \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 70 | toys/other/fallocate.c \ |
| 71 | toys/other/free.c \ |
| 72 | toys/other/freeramdisk.c \ |
| 73 | toys/other/fsfreeze.c \ |
| 74 | toys/other/help.c \ |
| 75 | toys/other/ifconfig.c \ |
| 76 | toys/other/inotifyd.c \ |
| 77 | toys/other/insmod.c \ |
| 78 | toys/other/losetup.c \ |
| 79 | toys/other/lsattr.c \ |
| 80 | toys/other/lsmod.c \ |
| 81 | toys/other/lspci.c \ |
| 82 | toys/other/lsusb.c \ |
| 83 | toys/other/makedevs.c \ |
| 84 | toys/other/mkswap.c \ |
| 85 | toys/other/modinfo.c \ |
| 86 | toys/other/mountpoint.c \ |
| 87 | toys/other/nbd_client.c \ |
| 88 | toys/other/netcat.c \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 89 | toys/other/partprobe.c \ |
| 90 | toys/other/pivot_root.c \ |
| 91 | toys/other/pmap.c \ |
| 92 | toys/other/printenv.c \ |
| 93 | toys/other/pwdx.c \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 94 | toys/other/readlink.c \ |
| 95 | toys/other/realpath.c \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 96 | toys/other/rev.c \ |
| 97 | toys/other/rfkill.c \ |
| 98 | toys/other/rmmod.c \ |
| 99 | toys/other/setsid.c \ |
| 100 | toys/other/stat.c \ |
| 101 | toys/other/swapoff.c \ |
| 102 | toys/other/swapon.c \ |
| 103 | toys/other/switch_root.c \ |
| 104 | toys/other/sysctl.c \ |
| 105 | toys/other/tac.c \ |
| 106 | toys/other/taskset.c \ |
| 107 | toys/other/timeout.c \ |
| 108 | toys/other/truncate.c \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 109 | toys/other/usleep.c \ |
| 110 | toys/other/vconfig.c \ |
| 111 | toys/other/vmstat.c \ |
| 112 | toys/other/which.c \ |
| 113 | toys/other/yes.c \ |
Elliott Hughes | 3c3e83a | 2014-12-16 20:18:05 -0800 | [diff] [blame] | 114 | toys/pending/dd.c \ |
Elliott Hughes | f9551b3 | 2014-12-24 10:59:08 -0800 | [diff] [blame] | 115 | toys/pending/getenforce.c \ |
Elliott Hughes | 9aaeff3 | 2015-01-14 12:26:10 -0800 | [diff] [blame] | 116 | toys/pending/hwclock.c \ |
Elliott Hughes | 53a43da | 2014-12-11 17:05:54 -0800 | [diff] [blame] | 117 | toys/pending/more.c \ |
Elliott Hughes | 3c3e83a | 2014-12-16 20:18:05 -0800 | [diff] [blame] | 118 | toys/pending/ps.c \ |
| 119 | toys/pending/netstat.c \ |
| 120 | toys/pending/route.c \ |
Elliott Hughes | f9551b3 | 2014-12-24 10:59:08 -0800 | [diff] [blame] | 121 | toys/pending/setenforce.c \ |
Elliott Hughes | 3c3e83a | 2014-12-16 20:18:05 -0800 | [diff] [blame] | 122 | toys/pending/top.c \ |
Elliott Hughes | 347e42b | 2015-01-13 18:45:44 -0800 | [diff] [blame] | 123 | toys/pending/tr.c \ |
Elliott Hughes | 3c3e83a | 2014-12-16 20:18:05 -0800 | [diff] [blame] | 124 | toys/pending/traceroute.c \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 125 | toys/posix/basename.c \ |
| 126 | toys/posix/cal.c \ |
| 127 | toys/posix/cat.c \ |
| 128 | toys/posix/chgrp.c \ |
| 129 | toys/posix/chmod.c \ |
| 130 | toys/posix/cksum.c \ |
| 131 | toys/posix/cmp.c \ |
| 132 | toys/posix/comm.c \ |
| 133 | toys/posix/cp.c \ |
Elliott Hughes | bfa8d06 | 2015-02-05 10:02:55 -0800 | [diff] [blame] | 134 | toys/posix/cpio.c \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 135 | toys/posix/cut.c \ |
| 136 | toys/posix/date.c \ |
| 137 | toys/posix/df.c \ |
| 138 | toys/posix/dirname.c \ |
| 139 | toys/posix/du.c \ |
| 140 | toys/posix/echo.c \ |
| 141 | toys/posix/env.c \ |
| 142 | toys/posix/expand.c \ |
| 143 | toys/posix/false.c \ |
| 144 | toys/posix/find.c \ |
| 145 | toys/posix/grep.c \ |
| 146 | toys/posix/head.c \ |
| 147 | toys/posix/id.c \ |
| 148 | toys/posix/kill.c \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 149 | toys/posix/ln.c \ |
| 150 | toys/posix/ls.c \ |
| 151 | toys/posix/mkdir.c \ |
| 152 | toys/posix/mkfifo.c \ |
| 153 | toys/posix/nice.c \ |
| 154 | toys/posix/nl.c \ |
| 155 | toys/posix/nohup.c \ |
| 156 | toys/posix/od.c \ |
| 157 | toys/posix/paste.c \ |
| 158 | toys/posix/patch.c \ |
| 159 | toys/posix/pwd.c \ |
| 160 | toys/posix/renice.c \ |
| 161 | toys/posix/rm.c \ |
| 162 | toys/posix/rmdir.c \ |
Elliott Hughes | 347e42b | 2015-01-13 18:45:44 -0800 | [diff] [blame] | 163 | toys/posix/sed.c \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 164 | toys/posix/sleep.c \ |
| 165 | toys/posix/sort.c \ |
| 166 | toys/posix/split.c \ |
| 167 | toys/posix/strings.c \ |
| 168 | toys/posix/tail.c \ |
| 169 | toys/posix/tee.c \ |
| 170 | toys/posix/time.c \ |
| 171 | toys/posix/touch.c \ |
| 172 | toys/posix/true.c \ |
| 173 | toys/posix/tty.c \ |
| 174 | toys/posix/uname.c \ |
| 175 | toys/posix/uniq.c \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 176 | toys/posix/wc.c \ |
| 177 | toys/posix/xargs.c \ |
| 178 | |
| 179 | LOCAL_CFLAGS += \ |
| 180 | -Os \ |
| 181 | -Wno-char-subscripts \ |
| 182 | -Wno-sign-compare \ |
| 183 | -Wno-uninitialized \ |
| 184 | -Wno-unused-parameter \ |
Elliott Hughes | d353398 | 2015-01-15 15:04:19 -0800 | [diff] [blame] | 185 | -funsigned-char \ |
| 186 | -ffunction-sections -fdata-sections \ |
| 187 | -fno-asynchronous-unwind-tables \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 188 | |
Elliott Hughes | 7611563 | 2014-12-16 09:14:47 -0800 | [diff] [blame] | 189 | LOCAL_SHARED_LIBRARIES := libselinux |
| 190 | |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 191 | LOCAL_MODULE := toybox |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 192 | |
Elliott Hughes | 5eec03a | 2015-02-09 14:09:49 -0800 | [diff] [blame^] | 193 | # dupes: dd df du ls mount renice umount |
Elliott Hughes | 79984b4 | 2015-02-09 12:16:39 -0800 | [diff] [blame] | 194 | # useless?: chvt freeramdisk fsfreeze install makedevs mkfifo nbd-client |
Elliott Hughes | bf65a2e | 2015-02-09 12:14:46 -0800 | [diff] [blame] | 195 | # partprobe pivot_root pwdx rev rfkill switch_root tty vconfig |
Elliott Hughes | 5eec03a | 2015-02-09 14:09:49 -0800 | [diff] [blame^] | 196 | # prefer BSD netcat instead?: nc netcat |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 197 | # prefer efs2progs instead?: blkid chattr lsattr |
| 198 | |
| 199 | ALL_TOOLS := \ |
| 200 | acpi \ |
| 201 | basename \ |
| 202 | blockdev \ |
| 203 | bzcat \ |
| 204 | cal \ |
Elliott Hughes | 1e0e5ea | 2015-01-14 10:40:22 -0800 | [diff] [blame] | 205 | cat \ |
Elliott Hughes | 7611563 | 2014-12-16 09:14:47 -0800 | [diff] [blame] | 206 | chcon \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 207 | chgrp \ |
Elliott Hughes | 5c7cca0 | 2014-12-11 12:12:59 -0800 | [diff] [blame] | 208 | chmod \ |
Elliott Hughes | 6ee70fc | 2015-01-15 13:41:34 -0800 | [diff] [blame] | 209 | chown \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 210 | chroot \ |
| 211 | cksum \ |
Elliott Hughes | 03275a8 | 2014-11-22 22:56:47 -0800 | [diff] [blame] | 212 | clear \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 213 | comm \ |
Elliott Hughes | d353398 | 2015-01-15 15:04:19 -0800 | [diff] [blame] | 214 | cmp \ |
Elliott Hughes | 6b4d05c | 2014-12-16 16:15:47 -0800 | [diff] [blame] | 215 | cp \ |
Elliott Hughes | bfa8d06 | 2015-02-05 10:02:55 -0800 | [diff] [blame] | 216 | cpio \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 217 | cut \ |
Elliott Hughes | 9aaeff3 | 2015-01-14 12:26:10 -0800 | [diff] [blame] | 218 | date \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 219 | dirname \ |
Elliott Hughes | c99e20b | 2014-11-26 11:38:43 -0800 | [diff] [blame] | 220 | dmesg \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 221 | dos2unix \ |
| 222 | echo \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 223 | env \ |
| 224 | expand \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 225 | fallocate \ |
Elliott Hughes | 03275a8 | 2014-11-22 22:56:47 -0800 | [diff] [blame] | 226 | false \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 227 | find \ |
| 228 | free \ |
Elliott Hughes | 9250c95 | 2014-12-24 11:29:44 -0800 | [diff] [blame] | 229 | getenforce \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 230 | groups \ |
| 231 | head \ |
| 232 | hostname \ |
Elliott Hughes | 9aaeff3 | 2015-01-14 12:26:10 -0800 | [diff] [blame] | 233 | hwclock \ |
Elliott Hughes | c8fa5ee | 2015-01-16 19:27:31 -0800 | [diff] [blame] | 234 | id \ |
Elliott Hughes | 4f060a3 | 2015-01-14 11:07:28 -0800 | [diff] [blame] | 235 | ifconfig \ |
Elliott Hughes | 123aecf | 2015-01-14 11:00:47 -0800 | [diff] [blame] | 236 | inotifyd \ |
Elliott Hughes | 6a646ef | 2014-11-24 11:41:35 -0800 | [diff] [blame] | 237 | insmod \ |
Elliott Hughes | 95211ea | 2014-12-04 20:09:44 -0800 | [diff] [blame] | 238 | kill \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 239 | killall \ |
| 240 | ln \ |
| 241 | logname \ |
| 242 | losetup \ |
Elliott Hughes | 6a646ef | 2014-11-24 11:41:35 -0800 | [diff] [blame] | 243 | lsmod \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 244 | lspci \ |
| 245 | lsusb \ |
| 246 | md5sum \ |
Elliott Hughes | d13bf6a | 2014-12-16 15:17:17 -0800 | [diff] [blame] | 247 | mkdir \ |
Elliott Hughes | 0a0435c | 2014-12-11 18:34:09 -0800 | [diff] [blame] | 248 | mknod \ |
Elliott Hughes | 620bc1a | 2014-11-24 16:12:40 -0800 | [diff] [blame] | 249 | mkswap \ |
Elliott Hughes | 79984b4 | 2015-02-09 12:16:39 -0800 | [diff] [blame] | 250 | mktemp \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 251 | modinfo \ |
Elliott Hughes | 53a43da | 2014-12-11 17:05:54 -0800 | [diff] [blame] | 252 | more \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 253 | mountpoint \ |
Elliott Hughes | dbcacc6 | 2014-12-16 19:18:43 -0800 | [diff] [blame] | 254 | mv \ |
Elliott Hughes | 5f9893b | 2014-12-23 09:12:18 -0800 | [diff] [blame] | 255 | netstat \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 256 | nice \ |
| 257 | nl \ |
Elliott Hughes | 9f98941 | 2014-11-25 17:00:40 -0800 | [diff] [blame] | 258 | nohup \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 259 | od \ |
| 260 | paste \ |
| 261 | patch \ |
| 262 | pidof \ |
| 263 | pmap \ |
Elliott Hughes | 68e18cd | 2014-11-24 15:36:51 -0800 | [diff] [blame] | 264 | printenv \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 265 | pwd \ |
Elliott Hughes | 8f7bc7a | 2014-11-26 15:21:03 -0800 | [diff] [blame] | 266 | readlink \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 267 | realpath \ |
Elliott Hughes | f5275f9 | 2014-12-16 16:22:32 -0800 | [diff] [blame] | 268 | rm \ |
Elliott Hughes | d4a6d66 | 2014-12-16 15:26:53 -0800 | [diff] [blame] | 269 | rmdir \ |
Elliott Hughes | 6a646ef | 2014-11-24 11:41:35 -0800 | [diff] [blame] | 270 | rmmod \ |
Elliott Hughes | 347e42b | 2015-01-13 18:45:44 -0800 | [diff] [blame] | 271 | sed \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 272 | seq \ |
Elliott Hughes | 9250c95 | 2014-12-24 11:29:44 -0800 | [diff] [blame] | 273 | setenforce \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 274 | setsid \ |
| 275 | sha1sum \ |
Elliott Hughes | 62cf8d6 | 2014-11-24 15:23:04 -0800 | [diff] [blame] | 276 | sleep \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 277 | sort \ |
| 278 | split \ |
| 279 | stat \ |
| 280 | strings \ |
Elliott Hughes | 620bc1a | 2014-11-24 16:12:40 -0800 | [diff] [blame] | 281 | swapoff \ |
| 282 | swapon \ |
Elliott Hughes | 8536828 | 2014-11-24 14:53:36 -0800 | [diff] [blame] | 283 | sync \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 284 | sysctl \ |
| 285 | tac \ |
| 286 | tail \ |
| 287 | taskset \ |
| 288 | tee \ |
| 289 | time \ |
| 290 | timeout \ |
Elliott Hughes | 5eec03a | 2015-02-09 14:09:49 -0800 | [diff] [blame^] | 291 | touch \ |
Elliott Hughes | 347e42b | 2015-01-13 18:45:44 -0800 | [diff] [blame] | 292 | tr \ |
Elliott Hughes | 03275a8 | 2014-11-22 22:56:47 -0800 | [diff] [blame] | 293 | true \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 294 | truncate \ |
| 295 | uname \ |
| 296 | uniq \ |
| 297 | unix2dos \ |
Elliott Hughes | 10bd49e | 2014-11-21 14:53:43 -0800 | [diff] [blame] | 298 | usleep \ |
Elliott Hughes | 2080060 | 2014-11-25 17:25:05 -0800 | [diff] [blame] | 299 | vmstat \ |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 300 | wc \ |
| 301 | which \ |
| 302 | whoami \ |
| 303 | xargs \ |
| 304 | yes \ |
| 305 | |
Ying Wang | 331b22d | 2014-11-24 12:42:09 -0800 | [diff] [blame] | 306 | # Install the symlinks. |
| 307 | LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf toybox $(TARGET_OUT)/bin/$(t);) |
Elliott Hughes | d8d2d3c | 2014-11-20 10:39:27 -0800 | [diff] [blame] | 308 | |
Ying Wang | 331b22d | 2014-11-24 12:42:09 -0800 | [diff] [blame] | 309 | include $(BUILD_EXECUTABLE) |