From 50d6ff32d43e0df062f764fa6d96a0b75a14ba3c Mon Sep 17 00:00:00 2001
From: Rob Landley Toybox can provide its own build prerequisites (I.E
-perform a "hermetic" build) using the script scripts/prereq/build.sh
-which is a canned minimal toybox build that basically does "cc *.c" against
-saved headers to build the commands needed by the rest of the build. At the moment, building toybox on mac requires homebrew to get a .config
-file, ala: But the rest of the hermetic build works without it: If you already have an appropriate .config file you can copy in you
-don't need homebrew at all (and can skip the first section above).
-Editing one up by hand for qnx and similar is currently left as an exercise
-for the reader (but it's a fairly simple text file format). The files in the scripts/prereq directory were created by
+ Toybox can provide its own build prerequisites (I.E perform a "hermetic"
+build) via scripts/prereq/build.sh which is a canned minimal toybox
+build script that basically does "cc *.c" against
+saved headers to build just the commands needed by the the full toybox
+build scripts. The wrapper scripts/prereq/use.sh calls that hermetic build.sh
+script to create a minimal toybox-prereq, then populates a directory
+of symlinks to those toybox commands plus the cc/ld/as/strip binaries
+out of the host $PATH, and finally runs scripts/genconfig.sh and
+scripts/make.sh
+to configure and build a full toybox binary. By default it builds defconfig,
+but can take as its first argument a miniconfig file. So to build toybox on MacOS (without homebrew) run
+scripts/prereq/use.sh scripts/macos_miniconfig and it should
+create a toybox binary configured for mac using the host toolchain.
+The scripts directory also contains freebsd_miniconfig and
+android_miniconfig files enumerating the commands known to work
+under those operating systems. Most of the files in the scripts/prereq directory were created by
scripts/recreate-prereq.sh which records the commands used by
a toybox build, harvests stripped down headers, and writes a build.sh
to compile the appropriate source files. It's a couple dozen lines of
-bash if you're interested.How do I build toybox on a system with a broken $PATH?
-
-
-
-$ homebrew
-$ make macos_defconfig
-$ make clean
-$ exit
-
-
-
-$ cc scripts/kconfig.c
-$ KCONFIG_ALLCONFIG=kconfig/macos_miniconfig ./a.out -n > .config
-$ scripts/prereq/build.sh #ignoring SO many warnings
-$ mkdir prereq; mv toybox-prereq prereq/
-$ for i in $(prereq/toybox-prereq); do ln -s toybox-prereq prereq/$i; done
-$ PATH=$PWD/prereq:$PATH scripts/make.sh
-$ ./toybox
-
At the moment toybox's full scripts/make.sh still requires bash (until toysh is finished and promoted out of pending). Freebsd users @@ -581,9 +571,14 @@ to work around their distro's policy insisting that /bin/env can be trusted to live at a specific path but /bin/bash can't. (On Android both env and sh live in /system/bin, which is at least internally consistent.)
-Toybox does not yet provide "make" either. You can call scripts/make.sh -directly (and scripts/test.sh and scripts/single.sh) if you've got a .config, -but until kconfig/ is replaced defconfig/menuconfig still need gmake.
+Toybox does not yet provide "make" either. The Makefile is mostly convenience +wrappers around shell scripts, so you can directly call +"scripts/genconfig.sh -d" (defconfig), scripts/make.sh, scripts/install.sh, +scripts/test.sh, scripts/single.sh and so on, all without needing make. +The exception is menuconfig: most config +functions have been migrated to scripts/genconfig.sh using scripts/kconfig.c, +but for the moment menuconfig is still using the old kconfig/ infrastructure +and thus still needs gmake.