[Toybox] [PATCH] Add makefile rule to build kconfig; fixes clean-tree parallel builds
Rob Landley
rob at landley.net
Wed Feb 11 17:01:28 PST 2026
On 2/7/26 17:00, Avery Terrel wrote:
> Commit 35e26cec34 introduced a bug where `make -j32` will fail because generated/unstripped/kconfig is missing.
Toybox's Makefile is mostly just a wrapper around scripts/make.sh and
scripts/install.sh and so on. Parallelism is autodetected via nproc in
scripts/make.sh ("CPUS=1 make" disables it, or you can use taskset) so
parallelism at the Makefile level doesn't get tested a lot because the
"-j" value just says how parallel make is about launching single
instances of shell scripts.
That said, it used to work...
[days pass...]
Ok, I've simplified a lot of the make plumbing and moved even more of it
into scripts, plus converted more config targets from old kconfig to the
new kconfig plumbing, and stopped telling make about more than one
output file from scripts/genconfig.sh (which rebuilds all of them when
run so none should be significantly newer/older).
It no longer gets confused by "make -j32" for me, and no longer does
"silentoldconfig" using the old kconfig plumbing (but uses the new
plumbing instead) which I _think_ was android's main gripe about
snapshotting the generated/ directory?
(Note that "make defconfig toybox -j32" complains that toybox is
unconfigured because it doesn't know the various config targets are
creating .config, dunno how to add a rule for that...)
Anyway, in theory, android could now just do something like:
KCONFIG_ALLCONFIG=scripts/android_miniconfig scripts/genconfig.sh -n &&
scripts/make.sh
And... it might work? (Don't have the test environment.)
For macos and friends, I created a new scripts/prereq/use.sh that runs
the corresponding hermetic build.sh as necessary, sticks it at the start
of the $PATH, and runs the rest of the build under that. So now you can
just go:
$ scripts/prereq/use.sh scripts/macos_miniconfig
And toybox should build without homebrew.
While that's a hermetic build creating its own prerequisites, I dunno if
AOSP would want to use it because the first step is a single-threaded cc
*.c style build of the toybox-prereq binary. (Because if all else fails,
scripts/prereq/build.sh should work on 20th century gilligan's island
style coconut technology. Well, assuming a sufficiently competent C11
compiler that handles a ? : b and such, anyway. But the command line
parts should be reasonably hermetic, lemme know if they aren't.)
Rob
More information about the Toybox
mailing list