[Toybox] android kernel builds

enh enh at google.com
Mon Jul 17 06:32:34 PDT 2023


On Sun, Jul 16, 2023 at 1:10 AM Rob Landley <rob at landley.net> wrote:

> On 7/14/23 12:08, enh via Toybox wrote:
> > heh, i hadn't noticed that toybox-built kernels mention the fact
> before...
> >
> > ~/aosp-master-with-phones/bionic$ adb shell uname -a
> > Linux localhost 6.3.0-mainline-g0526833d4674-ab10303652 #1 SMP PREEMPT
> Mon Jun
> > 12 08:24:48 UTC 2023 riscv64 Toybox
>
> Did that build _on_ risc64 or _for_ risc64?
>
> Hmmm, I wonder where it's getting that from. ("Toybox" is the first word
> of help
> output, nonzero chance this is in error). I can't easily reproduce your
> kernel
> build, but let's see...
>
> https://source.android.com/docs/setup/build/building-kernels
>
> Um...
>
>
> https://android.googlesource.com/kernel/manifest/+/refs/heads/common-android-mainline/default.xml#14
>
> Er...
>
>
> https://android.googlesource.com/kernel/common/+/refs/heads/android-mainline/fs/proc/version.c
>
> Sigh, bounce off include/linux/utsname.h and where is init_uts_ns
> initialized...
>
> https://android.googlesource.com/kernel/common/+/refs/heads/android-mainline/init/version.c
> leads us to the ACTUAL version string at:
>
>
> https://android.googlesource.com/kernel/common/+/refs/heads/android-mainline/init/version-timestamp.c#28
>
> So yes, it ends with UTS_VERSION. So...
>
>
> https://android.googlesource.com/kernel/common/+/refs/heads/android-mainline/init/Makefile#35
>
> utsver=$$(echo '$(pound)'"$(build-version)" $(smp-flag-y) $(preempt-flag-y)
> "$(build-timestamp)" | cut -b -64);
>
> No, that's the "SMP PREEMPT Mon Jun 12 08:24:48 UTC 2023" part, and toybox
> cut
> -b -64 is not producing an error message, so where does it get riscv64 and
> Toybox? It's calling...
>
>
> https://android.googlesource.com/kernel/common/+/refs/heads/android-mainline/init/build-version
>
> Nope, that's not it... Hmmm:
>
>
> https://android.googlesource.com/kernel/common/+/refs/heads/android-mainline/init/version-timestamp.c#12
>
> Is something outputting the fields in order? Where is UTS_DOMAINNAME
> set... it's
> dynamic at runtime? But /proc/version wouldn't... Oh. duh.
>
> $ toybox uname -o
> Toybox
>
> You didn't _run_ cat /proc/version, you ran toybox uname -a. Which
> means it's not the kernel saying "Toybox", it's toybox saying it.
>

d'oh! that makes more sense ... i thought they'd added the build
environment as well as the compiler, but the capital letter in "Toybox" was
a bit weird for that :-)


> Blah. Long tangent (started Friday!) because I didn't read the problem
> statement
> closely enough. Yes, toybox says "toybox" when you ask it what userspace
> you're
> running. Because I refused to ever describe anything as "GNU/Linux", which
> is
> what the other one says for the -o extension.
>
> Rob
>
> P.S. And then on sheer autopilot I ran a grep -r 'uname -a' * in the kernel
> source to go "and now that I've found THAT, here's where the build is..."
> NO.
> Wrong. Step away from the keyboard.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20230717/04c46713/attachment.htm>


More information about the Toybox mailing list