[Toybox] [PATCH] Add makefile rule to build kconfig; fixes clean-tree parallel builds
Rob Landley
rob at landley.net
Tue Feb 17 00:08:28 PST 2026
On 2/13/26 13:36, enh wrote:
> On Wed, Feb 11, 2026 at 8:02 PM Rob Landley <rob at landley.net> wrote:
>> 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.)
>
> ...you had me worried here that i was going to have to change
> something, but it seems like the update "just worked"? is that
> expected, or have i missed something and just haven't noticed the
> other shoe fall yet?
If you're still snapshotting the generated/ directory then presumably it
should just work. This changes the config plumbing that produced that
stuff, but the result should be about the same. (There's an upcoming
change that would require a re-snapshotting by making Config.probed go
away, but it's not quite ready yet.)
But now even if you delete the Makefile and the kconfig/ subdir you can
use the new build infrastructure for android_defconfig without going
through "make" at all. The scripts should work for android's defconfig
the same way as for macos.
I gotta tackle the UI parts next, but when I started on that I did some
generic lib/ infrastructure and got distracted down the shell command
line editing rathole, which is just INSANE...
[long rant about linux terminals deleted.]
Anyway, make config/oldconfig are just text question/answer sessions
with no navigation and menuconfig can redraw the whole screen at will,
so I should do a pass at that and then maybe cut a release.
>> 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.
And in THEORY an android build can go:
$ scripts/prereq/use.sh scripts/android_miniconfig
Even on android! (Modulo being able to run binaries you build.) Or less
hermetically (and more parallellellelly):
$ KCONFIG_ALLCONFIG=scripts/android_miniconfig scripts/genconfig.sh -n
$ scripts/make.sh
>> 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.
Hence both options.
Snapshotting generated/ still works. It just theoretically shouldn't be
necessary anymore? But I don't remember the details of how we got there
in the first place, so... (I mean I'm _also_ snapshotting
scripts/prereq/generated, but I know why I'm doing it and have a script
that strips them down to a total of 59k. Yes I have considered creating
a generated/generated.h that #includes all the other files so the
digester script can create one output file, but things like
scripts/install.c import specific generated headers, and main.c imports
generated/newtoys.h multiple times with different #defines... Alas,
there were reasons.)
FYI the list of commands the hermetic use.sh script currently provides,
as detected in scripts/recreate-prereq.sh, is:
basename cat chmod cmp dirname echo fold grep egrep fgrep head ln ls
mkdir od rm sed sort tail tee uname wc xargs tr readlink which gzip
There's an argument for adding "mv" because if you set NOSTRIP=1 (or if
"strip -o" fails) make.sh will try to use that, which isn't detected by
recreate-prereq.sh because the strip succeeds on a linux build. (The
only command recreate-prereq.sh manually adds at the moment is "ln"
which is only used by the install not the build.)
The main reason I _haven't_ added mv is the cp.c plumbing is using a lot
of xattr weirdness that I'm unsure of the portability of to strange
platforms, and kinda don't want unnecessary surface area in the
canned/hermetic build stage. (Possibly use.sh should unset NOSTRIP.
"Make this work on macos without homebrew" is kinda morphing into
"mkroot/mkroot.sh should use this to set up its airlock", which requires
more bullet proofing...)
(scripts/prereq/use.sh is also symlinking in "cc as ld strip" from the
host to create a mini-airlock, on the assumption they have them.
Posix-2001 said they should. posix-2008 removed "cc", which like
removing tar everybody ignored. It doesn't directly call "as" or "ld"
but I've hit toolchains that barf if they're not in the $PATH. I am not
doing the full distcc shenanigans scripts/install.sh --airlock does,
because I'm TRYING to make this understandable...)
>> (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.)
Still gotta check freebsd and netbsd. And I have no idea what the QNX
guys are doing...
Rob
More information about the Toybox
mailing list