[Toybox] [PATCH] Add makefile rule to build kconfig; fixes clean-tree parallel builds
enh
enh at google.com
Fri Feb 27 14:07:11 PST 2026
On Sun, Feb 22, 2026 at 6:49 PM Rob Landley <rob at landley.net> wrote:
>
> On 2/13/26 13:36, enh wrote:
> >> 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?
>
> Commit 32decfacef12 is probably the other shoe, you'll have to at least
> resnapshot the headers because the probed symbol names changed.
yeah, that's fucked it :-)
here's what we're doing on each update (at the root of our toybox clone):
```
rm -rf .config generated/ android/
function generate() {
which=$1
echo -e "\n-------- $1\n"
# These are the only generated files we actually need.
files="config.h flags.h globals.h help.h newtoys.h tags.h"
cp config-$which .config
NOBUILD=1 scripts/make.sh
out=android/$which/generated/
mkdir -p $out
for f in $files; do cp generated/$f $out/$f ; done
rm -rf .config generated/
make allnoconfig KCONFIG_ALLCONFIG=config-$which
}
generate "device"
generate "linux"
generate "mac"
rm -rf .config
```
(and, yes, i can confirm that it's
32decfacef12644c8c939466db58f1370ccba4d0 that broke things, not the
more recent change.)
it seems like my "config" file is being used (because i get an error
until i rename CONFIG_TOYBOX_ON_ANDROID to CONFIG_IS_ANDROID) but then
when i look at the resulting generated/config.h file it's wrong. for
example:
generated/config.h:#define CFG_TOYBOX_SELINUX 0
despite
CONFIG_TOYBOX_SELINUX=y
in my config...
> That said, I dunno the current reason for the snapshot? On the
> technology side, you should just be able to use the build scripts as is
> now. The gplv2 build infrastructure is out of the flow for your use
> cases and it's not doing HOSTCC on _more_ binaries than it was before.
> (This pass eliminates all the probecc ones, instead of building
> something it checks compiler #defines via ":|cc -E -dM -" now.)
>
> The full hermetic experience would be:
>
> CPUS=$(nproc) scripts/prereq/use.sh scripts/android_miniconfig
>
> Alas, the CPUS=$(nproc) is because the prereq mini-airlock doesn't
> include "nproc" so the build falls back to CPUS=1. And yes, that full
> hermetic build first does a single threaded toybox-prereq build that's
> not ideal for you. (On my 12 year old laptop prereq/build.sh takes 9.2
> seconds.) I'm open to suggestions...
>
> Rob
>
> P.S. I just did commit 44610ac30e7b so it still builds after rm -rf
> kconfig. :)
>
> P.P.S. I suppose you could ship a toybox-prereq binary, and I could even
> hack in an "nproc" for macos pretty easily, and then ninja could do what
> use.sh does by itself, or with a different script? make.sh needing a
> bash-alike on mac isn't new but mksh is good enough on android. Working
> on getting toysh workable in prereq/use.sh, hit an unrelated bug and
> went down a rathole...
More information about the Toybox
mailing list