From 32decfacef12644c8c939466db58f1370ccba4d0 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 22 Feb 2026 17:11:16 -0600 Subject: [PATCH] More build cleanup. Convert symbol probes to just check compiler #defines in :|cc -e -DM - output (can't use #ifdef because config dependency resolution happens before compilation), merge Config.probed into generated/Config.in (probed symbol names now consistently IS_THINGY based on the #define), eliminate isnewer from make.sh because always rebuilding the headers isn't expensive, replace hostcomp with brun, fix a scripts/kconfig.c bug in dependency resolution, add $OBJDIR and move it under $UNSTRIPPED, redo scripts/prereq build (which only needs snapshot headers for the first build that doesn't run scripts/make.sh). I think "clean menuconfig baseline bloatcheck" are the only make targets left that aren't just wrapping a script you can call directly. (You can "git clean" and baseline/bloatcheck are just a question of what the new interface should look like.) --- Config.in | 7 ++- scripts/genconfig.sh | 43 ++++------------ scripts/kconfig.c | 8 +-- scripts/make.sh | 82 ++++++++++-------------------- scripts/prereq/build.sh | 4 +- scripts/prereq/generated/config.h | 24 +++++---- scripts/prereq/generated/flags.h | 19 ------- scripts/prereq/generated/globals.h | 6 --- scripts/prereq/generated/help.h | 1 - scripts/prereq/generated/newtoys.h | 1 - scripts/recreate-prereq.sh | 8 +-- toys/android/log.c | 2 +- toys/android/sendevent.c | 2 +- toys/other/losetup.c | 4 +- toys/other/mkpasswd.c | 2 +- toys/other/modinfo.c | 2 +- toys/posix/ps.c | 6 +-- 17 files changed, 77 insertions(+), 144 deletions(-) diff --git a/Config.in b/Config.in index 98add31b..79f39cf6 100644 --- a/Config.in +++ b/Config.in @@ -1,7 +1,5 @@ mainmenu "Toybox Configuration" - -source generated/Config.probed source generated/Config.in comment "" @@ -187,3 +185,8 @@ config TOYBOX_FORCE_NOMMU Building a scripts/mcm-buildall.sh toolchain patches musl to fix this. endmenu + +config TOYBOX_FORK + bool + default y + depends on !IS_FDPIC && !TOYBOX_FORCE_NOMMU diff --git a/scripts/genconfig.sh b/scripts/genconfig.sh index 1e0ac798..6a5ae064 100755 --- a/scripts/genconfig.sh +++ b/scripts/genconfig.sh @@ -7,39 +7,19 @@ source scripts/portability.sh mkdir -p "$GENDIR" -probecc() +genconfig() { - ${CROSS_COMPILE}${CC} $CFLAGS $LDFLAGS -xc -o /dev/null - "$@" -} + # Convert compiler builtin #defines to config symbols + local i j DIR X DEFINES="$($CROSS_COMPILE$CC $CFLAGS -E -dM - /dev/null && DEFAULT=y || DEFAULT=n - rm a.out 2>/dev/null - echo -e "config $1\n\tbool\n\tdefault $DEFAULT\n" || exit 1 -} + for i in ANDROID FDPIC + do + X=n + [ "${DEFINES/#define __${i}__ /}" != "$DEFINES" ] && X=y -probeconfig() -{ - # Some commands are android-specific - probesymbol TOYBOX_ON_ANDROID -c << EOF - #ifndef __ANDROID__ - #error nope - #endif -EOF - - # nommu support - probesymbol TOYBOX_FORK << EOF - #include - int main(int argc, char *argv[]) { return fork(); } -EOF - echo -e '\tdepends on !TOYBOX_FORCE_NOMMU' -} + echo -e "config IS_$i\n\tbool\n\tdefault $X\n" || return 1 + done -genconfig() -{ # Reverse sort puts posix first, examples last. for j in $(ls toys/*/README | sort -s -r) do @@ -59,12 +39,11 @@ genconfig() echo done - echo endmenu + echo endmenu || return 1 done } -probeconfig > "$GENDIR"/Config.probed || rm "$GENDIR"/Config.probed -genconfig > "$GENDIR"/Config.in || rm "$GENDIR"/Config.in +genconfig > "$GENDIR"/Config.in || { rm "$GENDIR"/Config.in; exit 1; } # Find names of commands that can be built standalone in these C files toys() diff --git a/scripts/kconfig.c b/scripts/kconfig.c index c7e49a92..dbca339e 100644 --- a/scripts/kconfig.c +++ b/scripts/kconfig.c @@ -91,7 +91,7 @@ struct kconfig *read_Config(char *name, struct kconfig *contain) FILE *fp = fopen(name, "r"); char *line, *help = 0, *s, *ss, *keywords[] = {"mainmenu", "menu", "choice", "comment", "config", "endmenu", "endchoice", 0}; - struct kconfig *kc, *klist = 0; + struct kconfig *kc = 0, *klist = 0; int ii, jj, count = 1, hindent; size_t size; @@ -137,7 +137,7 @@ struct kconfig *read_Config(char *name, struct kconfig *contain) struct kconfig *kt; if (!(kt = read_Config(trim(s), contain))) { fp = 0; break; } - if (klist) kc = (kc->next) = kt; + if (klist) kc = (kc->next = kt); else klist = kc = kt; while (kc->next) kc = kc->next; // start help block @@ -150,7 +150,7 @@ struct kconfig *read_Config(char *name, struct kconfig *contain) if (ii<4) contain = kt; if (klist) kc = (kc->next = kt); else klist = kc = kt; - if (!strcmp(ss, "config")) { + if (ii==5) { if (!*s) { fp = 0; break; } else kt->symbol = strdup(trim(s)); } else if (*s) kt->prompt = strdup(trim(s)); @@ -226,7 +226,7 @@ int depends(struct kconfig *klist, struct kconfig *kc) dprintf(2, "unknown dependency %s in %s\n", sym, kc->symbol); exit(1); } else { - rc = depends(kc, kt) ? value(kt) : 0; + rc = depends(klist, kt) ? value(kt) : 0; if (flip) rc = !rc; } free(ss); diff --git a/scripts/make.sh b/scripts/make.sh index c2e79c42..1c3e9501 100755 --- a/scripts/make.sh +++ b/scripts/make.sh @@ -4,6 +4,16 @@ set -o pipefail source scripts/portability.sh +[ -e "$KCONFIG_CONFIG" ] || { + echo "No $KCONFIG_CONFIG (run \"scripts/genconfig.sh -d\" for defconfig)" + exit 1 +} + +# Run oldconfig if necessary +[ -e "$GENDIR"/Config.in ] || + KCONFIG_ALLCONFIG="${KCONFIG_ALLCONFIG:-$KCONFIG_CONFIG}" \ + scripts/genconfig.sh -d || exit 1 + # Shell functions called by the build DASHN=-n @@ -39,24 +49,6 @@ do_loudly() "$@" } -# Is anything under directory $2 newer than generated/$1 (or does it not exist)? -isnewer() -{ - [ -e "$GENDIR/$1" ] && [ -z "$(find "${@:2}" -newer "$GENDIR/$1")" ] && - return 1 - echo -n "${DIDNEWER:-$GENDIR/{}$1" - DIDNEWER=, -} - -# Build a tool that runs on the host -hostcomp() -{ - if [ ! -f "$UNSTRIPPED"/$1 ] || [ "$UNSTRIPPED"/$1 -ot scripts/$1.c ] - then - do_loudly $HOSTCC scripts/$1.c -o "$UNSTRIPPED"/$1 || exit 1 - fi -} - # --as-needed removes libraries we don't use any symbols out of, but the # compiler has no way to ignore a library that doesn't exist, so detect # and skip nonexistent libraries for it (probing in parallel). @@ -98,9 +90,10 @@ B="$(readlink -f "$PWD")/" A="$(readlink -f "$GENDIR")" A="${A%/}"/ unset A B DOTPROG DIDNEWER # Force full rebuild if our compiler/linker options changed -cmp -s <(compflags | grep '#d') <(grep '%d' "$GENDIR"/build.sh 2>/dev/null) || - rm -rf "$GENDIR"/* # Keep symlink, delete contents -mkdir -p "$UNSTRIPPED" "$(dirname $OUTNAME)" || exit 1 +OBJDIR="$UNSTRIPPED/obj" +cmp -s <(compflags | grep '#d') <(grep '#d' "$GENDIR"/build.sh 2>/dev/null) || + rm -rf "$UNSTRIPPED" +mkdir -p "$OBJDIR" "$(dirname $OUTNAME)" || exit 1 # Extract a list of toys/*/*.c files to compile from the data in $KCONFIG_CONFIG # (First command names, then filenames with relevant {NEW,OLD}TOY() macro.) @@ -123,30 +116,13 @@ compflags > "$GENDIR"/build.sh && source "$GENDIR/build.sh" && } >> "$GENDIR"/build.sh && chmod +x "$GENDIR"/build.sh || exit 1 -if isnewer Config.in toys || isnewer Config.in Config.in -then - scripts/genconfig.sh -fi - -# Does .config need dependency recalculation because toolchain changed? -A="$($SED -n '/^config .*$/h;s/default \(.\)/\1/;T;H;g;s/config \([^\n]*\)[^yn]*\(.\)/\1=\2/p' "$GENDIR"/Config.probed | sort)" -B="$(egrep "^CONFIG_($(echo "$A" | sed 's/=[yn]//' | xargs | tr ' ' '|'))=" "$KCONFIG_CONFIG" | $SED 's/^CONFIG_//' | sort)" -A="$(echo "$A" | grep -v =n)" -[ "$A" != "$B" ] && - { echo -e "\nWarning: Config.probed changed, run 'make oldconfig'" >&2; } -unset A B - -# Create a list of all the commands toybox can provide. -if isnewer newtoys.h toys -then - # The multiplexer is the first element in the array - echo "USE_TOYBOX(NEWTOY(toybox, 0, TOYFLAG_STAYROOT|TOYFLAG_NOHELP))" \ - > "$GENDIR"/newtoys.h +# newtoys.h is a list of USE_XXX(NEWTOY(xxx...)) lines, one per command. +{ # The multiplexer is the first element in the array + echo "USE_TOYBOX(NEWTOY(toybox, 0, TOYFLAG_STAYROOT|TOYFLAG_NOHELP))" && # Sort rest by name for binary search (copy name to front, sort, remove copy) $SED -n 's/^\(USE_[^(]*(.*TOY(\)\([^,]*\)\(,.*\)/\2 \1\2\3/p' toys/*/*.c \ - | sort -s -k 1,1 | $SED 's/[^ ]* //' >> "$GENDIR"/newtoys.h - [ $? -ne 0 ] && exit 1 -fi + | sort -s -k 1,1 | $SED 's/[^ ]* //' +} > "$GENDIR"/newtoys.h || exit 1 # Rebuild config.h from .config $SED -En $KCONFIG_CONFIG > "$GENDIR"/config.h \ @@ -159,8 +135,7 @@ $SED -En $KCONFIG_CONFIG > "$GENDIR"/config.h \ # allow multiple NEWTOY() in the same C file. (When disabled the FLAG is 0, # so flags&0 becomes a constant 0 allowing dead code elimination.) -hostcomp mkflags -if isnewer flags.h toys "$KCONFIG_CONFIG" +if true then # Parse files through C preprocessor twice, once to get flags for current # .config and once to get flags for allyesconfig @@ -196,7 +171,7 @@ then done | sort -s | $SED -n -e 's/ A / /;t pair;h;s/\([^ ]*\).*/\1 " "/;x' \ -e 'b single;:pair;h;n;:single;s/[^ ]* B //;H;g;s/\n/ /;p' | \ - tee "$GENDIR"/flags.raw | "$UNSTRIPPED"/mkflags > "$GENDIR"/flags.h || exit 1 + brun mkflags > "$GENDIR"/flags.h || exit 1 fi # Extract global structure definitions and flag definitions from toys/*/*.c @@ -226,8 +201,7 @@ while read i; do done > "$GENDIR"/tags.h || exit 1 # Create help.h, and zhelp.h if zcat enabled -hostcomp kconfig -"$UNSTRIPPED"/kconfig -h > "$GENDIR"/help.h || exit 1 +brun kconfig -h > "$GENDIR"/help.h || exit 1 if grep -qx 'CONFIG_TOYBOX_ZHELP=y' "$KCONFIG_CONFIG" then @@ -248,17 +222,17 @@ DOTPROG=. # This is a parallel version of: do_loudly $BUILD lib/*.c $TOYFILES $LINK -# Build all if oldest generated/obj file isn't newer than all header files. -X="$(ls -1t "$GENDIR"/obj/* 2>/dev/null | tail -n 1)" +# Build all if oldest obj file isn't newer than all header files. +X="$(ls -1t "$OBJDIR"/* 2>/dev/null | tail -n 1)" if [ ! -e "$X" ] || [ -n "$(find toys -name "*.h" -newer "$X")" ] then - rm -rf "$GENDIR"/obj && mkdir -p "$GENDIR"/obj || exit 1 + rm -f "$OBJDIR"/*.o || exit 1 else # always redo toy_list[] and help_data[] - rm -f "$GENDIR"/obj/main.o || exit 1 + rm -f "$OBJDIR"/main.o || exit 1 fi -# build each generated/obj/*.o file in parallel +# build each *.o file in parallel PENDING= LNKFILES= CLICK= DONE=0 COUNT=0 for i in lib/*.c click $TOYFILES @@ -267,7 +241,7 @@ do X=${i/lib\//lib_} X=${X##*/} - OUT="$GENDIR/obj/${X%%.c}.o" + OUT="$OBJDIR/${X%%.c}.o" LNKFILES="$LNKFILES $OUT" # Library files don't get rebuilt if older than .config, but commands do. diff --git a/scripts/prereq/build.sh b/scripts/prereq/build.sh index ac1fa11b..93263417 100755 --- a/scripts/prereq/build.sh +++ b/scripts/prereq/build.sh @@ -8,8 +8,8 @@ toys/pending/tr.c toys/posix/basename.c toys/posix/cat.c toys/posix/chmod.c toys/posix/cmp.c toys/posix/dirname.c toys/posix/echo.c toys/posix/fold.c toys/posix/grep.c toys/posix/head.c toys/posix/ln.c toys/posix/ls.c toys/posix/mkdir.c toys/posix/od.c toys/posix/rm.c toys/posix/sed.c -toys/posix/sort.c toys/posix/tail.c toys/posix/tee.c toys/posix/uname.c -toys/posix/wc.c toys/posix/xargs.c +toys/posix/sort.c toys/posix/tail.c toys/posix/uname.c toys/posix/wc.c +toys/posix/xargs.c " $BUILD lib/*.c $FILES $LINK -o toybox-prereq diff --git a/scripts/prereq/generated/config.h b/scripts/prereq/generated/config.h index 51262376..2235b919 100644 --- a/scripts/prereq/generated/config.h +++ b/scripts/prereq/generated/config.h @@ -1,9 +1,9 @@ -#define CFG_TOYBOX_ON_ANDROID 0 -#define USE_TOYBOX_ON_ANDROID(...) -#define SKIP_TOYBOX_ON_ANDROID(...) __VA_ARGS__ -#define CFG_TOYBOX_FORK 1 -#define USE_TOYBOX_FORK(...) __VA_ARGS__ -#define SKIP_TOYBOX_FORK(...) +#define CFG_IS_ANDROID 0 +#define USE_IS_ANDROID(...) +#define SKIP_IS_ANDROID(...) __VA_ARGS__ +#define CFG_IS_FDPIC 0 +#define USE_IS_FDPIC(...) +#define SKIP_IS_FDPIC(...) __VA_ARGS__ #define CFG_BASENAME 1 #define USE_BASENAME(...) __VA_ARGS__ #define SKIP_BASENAME(...) @@ -208,9 +208,9 @@ #define CFG_TAR 0 #define USE_TAR(...) #define SKIP_TAR(...) __VA_ARGS__ -#define CFG_TEE 1 -#define USE_TEE(...) __VA_ARGS__ -#define SKIP_TEE(...) +#define CFG_TEE 0 +#define USE_TEE(...) +#define SKIP_TEE(...) __VA_ARGS__ #define CFG_TEST 0 #define USE_TEST(...) #define SKIP_TEST(...) __VA_ARGS__ @@ -961,6 +961,9 @@ #define CFG_DEMO_SCANKEY 0 #define USE_DEMO_SCANKEY(...) #define SKIP_DEMO_SCANKEY(...) __VA_ARGS__ +#define CFG_DEMO_SCANLINE 0 +#define USE_DEMO_SCANLINE(...) +#define SKIP_DEMO_SCANLINE(...) __VA_ARGS__ #define CFG_DEMO_UTF8TOWC 0 #define USE_DEMO_UTF8TOWC(...) #define SKIP_DEMO_UTF8TOWC(...) __VA_ARGS__ @@ -1047,3 +1050,6 @@ #define CFG_TOYBOX_FORCE_NOMMU 0 #define USE_TOYBOX_FORCE_NOMMU(...) #define SKIP_TOYBOX_FORCE_NOMMU(...) __VA_ARGS__ +#define CFG_TOYBOX_FORK 1 +#define USE_TOYBOX_FORK(...) __VA_ARGS__ +#define SKIP_TOYBOX_FORK(...) diff --git a/scripts/prereq/generated/flags.h b/scripts/prereq/generated/flags.h index bdb5136a..1247d9f7 100644 --- a/scripts/prereq/generated/flags.h +++ b/scripts/prereq/generated/flags.h @@ -349,16 +349,6 @@ #undef FLAG_f #endif -// tee ia ia -#undef OPTSTR_tee -#define OPTSTR_tee "ia" -#ifdef CLEANUP_tee -#undef CLEANUP_tee -#undef FOR_tee -#undef FLAG_a -#undef FLAG_i -#endif - // tr ^<1>2Ccstd[+cC] ^<1>2Ccstd[+cC] #undef OPTSTR_tr #define OPTSTR_tr "^<1>2Ccstd[+cC]" @@ -745,15 +735,6 @@ #define FLAG_f (1LL<<4) #endif -#ifdef FOR_tee -#define CLEANUP_tee -#ifndef TT -#define TT this.tee -#endif -#define FLAG_a (1LL<<0) -#define FLAG_i (1LL<<1) -#endif - #ifdef FOR_tr #define CLEANUP_tr #ifndef TT diff --git a/scripts/prereq/generated/globals.h b/scripts/prereq/generated/globals.h index 7cab4263..cc9c41b2 100644 --- a/scripts/prereq/generated/globals.h +++ b/scripts/prereq/generated/globals.h @@ -115,11 +115,6 @@ struct tail_data { } *F; }; -struct tee_data { - void *outputs; - int out; -}; - struct wc_data { unsigned long totals[5]; }; @@ -150,7 +145,6 @@ extern union global_union { struct sed_data sed; struct sort_data sort; struct tail_data tail; - struct tee_data tee; struct wc_data wc; struct xargs_data xargs; } this; diff --git a/scripts/prereq/generated/help.h b/scripts/prereq/generated/help.h index f8f6357d..3ea1fbc7 100644 --- a/scripts/prereq/generated/help.h +++ b/scripts/prereq/generated/help.h @@ -25,7 +25,6 @@ #define HELP_sort "" #define HELP_strip "" #define HELP_tail "" -#define HELP_tee "" #define HELP_tr "" #define HELP_uname "" #define HELP_wc "" diff --git a/scripts/prereq/generated/newtoys.h b/scripts/prereq/generated/newtoys.h index 114728ec..d1137719 100644 --- a/scripts/prereq/generated/newtoys.h +++ b/scripts/prereq/generated/newtoys.h @@ -101,7 +101,6 @@ USE_SYSLOGD(NEWTOY(syslogd,">0l#<1>8=8R:b#<0>99=1s#<0=200m#<0>71582787=20O:p:f:a USE_TAIL(NEWTOY(tail, "?fFs:c(bytes)-n(lines)-[-cn][-fF]", TOYFLAG_USR|TOYFLAG_BIN|TOYFLAG_LINEBUF)) USE_TAR(NEWTOY(tar, "&(one-file-system)(no-ignore-case)(ignore-case)(no-anchored)(anchored)(no-wildcards)(wildcards)(no-wildcards-match-slash)(wildcards-match-slash)(show-transformed-names)(selinux)(restrict)(full-time)(no-recursion)(null)(numeric-owner)(no-same-permissions)(overwrite)(exclude)*(sort);:(mode):(mtime):(group):(owner):(to-command):~(strip-components)(strip)#~(transform)(xform)*Z(zstd)o(no-same-owner)p(same-permissions)k(keep-old)c(create)|h(dereference)x(extract)|t(list)|v(verbose)J(xz)j(bzip2)z(gzip)S(sparse)O(to-stdout)P(absolute-names)m(touch)X(exclude-from)*T(files-from)*I(use-compress-program):C(directory):f(file):as[!txc][!jzJa]", TOYFLAG_USR|TOYFLAG_BIN|TOYFLAG_UMASK)) USE_TASKSET(NEWTOY(taskset, "^pa", TOYFLAG_USR|TOYFLAG_BIN)) -USE_TEE(NEWTOY(tee, "ia", TOYFLAG_USR|TOYFLAG_BIN)) USE_TELNET(NEWTOY(telnet, "<1>2", TOYFLAG_BIN)) USE_TELNETD(NEWTOY(telnetd, "w#<0b:p#<0>65535=23f:l:FSKi[!wi]", TOYFLAG_USR|TOYFLAG_BIN)) USE_SH(OLDTOY(toysh, sh, TOYFLAG_BIN)) diff --git a/scripts/recreate-prereq.sh b/scripts/recreate-prereq.sh index 86891d87..9908ee12 100755 --- a/scripts/recreate-prereq.sh +++ b/scripts/recreate-prereq.sh @@ -5,7 +5,6 @@ # Detect toybox prerequisites using record-commands mkroot/record-commands make clean defconfig toybox && -sed -i 's/default y/default n/' generated/Config.probed || exit 1 CMDLIST="$(echo toybox; echo ln; ./toybox cut -DF 1 log.txt | sort -u | grep -v nproc)" { for i in $(tr '[:lower:]' '[:upper:]' <<<"$CMDLIST") @@ -16,8 +15,9 @@ CMDLIST="$(echo toybox; echo ln; ./toybox cut -DF 1 log.txt | sort -u | grep -v # Create minimal dependency-free build -make clean allnoconfig KCONFIG_ALLCONFIG=prereq.mini && -make toybox && +rm -rf generated && +KCONFIG_ALLCONFIG=prereq.mini scripts/genconfig.sh -n && +scripts/make.sh && cat > scripts/prereq/build.sh << 'EOF' && #!/bin/sh @@ -38,5 +38,5 @@ FORS="$(sed -n 's/#define FOR_//p' $(grep -o 'toys/[^/]*/[^.]*\.c' scripts/prere sed -En '1,/^$/p;/\/\/ ('"$FORS"') /,/^$/p;/#ifdef FOR_('"$FORS"')$/,/^$/p' generated/flags.h > scripts/prereq/generated/flags.h egrep "OPTSTR_($(egrep -v "($FORS)" <<<"$CMDLIST" | xargs | tr ' ' '|'))" \ generated/flags.h >> scripts/prereq/generated/flags.h -# TODO: slim down config.h +# TODO: slim down config.h, force _IS_ symbols n if necessary. cp generated/{globals,config}.h scripts/prereq/generated/ diff --git a/toys/android/log.c b/toys/android/log.c index 1b05f4e7..d28aef7a 100644 --- a/toys/android/log.c +++ b/toys/android/log.c @@ -6,7 +6,7 @@ USE_LOG(NEWTOY(log, "b:p:t:", TOYFLAG_USR|TOYFLAG_SBIN)) config LOG bool "log" - depends on TOYBOX_ON_ANDROID + depends on IS_ANDROID default y help usage: log [-b BUFFER] [-p PRI] [-t TAG] [MESSAGE...] diff --git a/toys/android/sendevent.c b/toys/android/sendevent.c index b952d192..b2af27a5 100644 --- a/toys/android/sendevent.c +++ b/toys/android/sendevent.c @@ -7,7 +7,7 @@ USE_SENDEVENT(NEWTOY(sendevent, "<4>4", TOYFLAG_USR|TOYFLAG_SBIN)) config SENDEVENT bool "sendevent" default y - depends on TOYBOX_ON_ANDROID + depends on IS_ANDROID help usage: sendevent DEVICE TYPE CODE VALUE diff --git a/toys/other/losetup.c b/toys/other/losetup.c index 0973273c..40841096 100644 --- a/toys/other/losetup.c +++ b/toys/other/losetup.c @@ -71,7 +71,7 @@ static int loopback_setup(char *device, char *file) } close(cfd); } - if (CFG_TOYBOX_ON_ANDROID && device) { + if (CFG_IS_ANDROID && device) { // ANDROID SPECIFIC: /dev is not devtmpfs, instead an userspace daemon // ueventd is responsible for creating the loop devices under /dev. // Wait for the uevent to be processed to avoid race. @@ -164,7 +164,7 @@ void losetup_main(void) { char **s; - TT.dir = CFG_TOYBOX_ON_ANDROID ? "/dev/block" : "/dev"; + TT.dir = CFG_IS_ANDROID ? "/dev/block" : "/dev"; TT.openflags = FLAG(r) ? O_RDONLY : O_RDWR; if (TT.j) { diff --git a/toys/other/mkpasswd.c b/toys/other/mkpasswd.c index 9f895075..81870041 100644 --- a/toys/other/mkpasswd.c +++ b/toys/other/mkpasswd.c @@ -10,7 +10,7 @@ USE_MKPASSWD(NEWTOY(mkpasswd, ">2S:m:P#=0<0", TOYFLAG_USR|TOYFLAG_BIN)) config MKPASSWD bool "mkpasswd" default y - depends on !TOYBOX_ON_ANDROID + depends on !IS_ANDROID help usage: mkpasswd [-P FD] [-m TYPE] [-S SALT] [PASSWORD] [SALT] diff --git a/toys/other/modinfo.c b/toys/other/modinfo.c index 0a6d6577..2b464358 100644 --- a/toys/other/modinfo.c +++ b/toys/other/modinfo.c @@ -106,7 +106,7 @@ void modinfo_main(void) // Android (as shipped by Google) currently only has modules on /vendor. // Android does not support multiple sets of modules for different kernels. - if (CFG_TOYBOX_ON_ANDROID) { + if (CFG_IS_ANDROID) { if (!TT.b) TT.b = "/vendor"; if (!TT.k) TT.k = ""; } else { diff --git a/toys/posix/ps.c b/toys/posix/ps.c index b5610218..86cd2197 100644 --- a/toys/posix/ps.c +++ b/toys/posix/ps.c @@ -1366,10 +1366,8 @@ void ps_main(void) "USER:12=UID,%%sPPID,%s,STIME,TTY,TIME,ARGS=CMD", FLAG(T) ? "TCNT" :"C"); else if (FLAG(l)) not_o = "F,S,UID,%sPPID,C,PRI,NI,BIT,SZ,WCHAN,TTY,TIME,CMD"; - else if (CFG_TOYBOX_ON_ANDROID) - sprintf(not_o = toybuf+128, - "USER,%%sPPID,VSIZE:10,RSS,WCHAN:10,ADDR:10,S,%s", - FLAG(T) ? "CMD" : "NAME"); + else if (CFG_IS_ANDROID) sprintf(not_o = toybuf+128, + "USER,%%sPPID,VSIZE:10,RSS,WCHAN:10,ADDR:10,S,%s",FLAG(T) ? "CMD" : "NAME"); sprintf(toybuf, not_o, FLAG(T) ? "PID,TID," : "PID,"); // Init TT.fields. This only uses toybuf if TT.ps.o is NULL -- 2.39.5