Lines Matching +full:build +full:- +full:in +full:- +full:qemu
2 <!--#include file="header.html" -->
16 <li><h2><a href="#b_links">What are those /b/number links in the git log?</a></h2></li>
19 <li><h2><a href="#dotslash">What's this ./ on the front of commands in your examples?</a></h2></li>
26 <!-- get binaries -->
30 <li><h2><a href="#mkroot">How do I build a working Linux system with toybox?</a></h2></li>
35 <p>A: Toybox started back in 2006 when I (Rob Landley)
37 and <a href=http://landley.net/notes-2006.html#28-09-2006>started over from
39 <a href=http://lists.busybox.net/pipermail/busybox/2006-September/058617.html>protracted licensing …
42 <a href=http://landley.net/notes-2011.html#13-11-2011>relaunched</a>
43 in November 2011 with a new goal to make Android
44 <a href=http://landley.net/aboriginal/about.html#selfhost>self-hosting</a>.
46 code, which made people who had never used or participated in the project
48 after a lot of thinking <a href=http://landley.net/talks/ohio-2013.txt>about
49 licenses</a> and <a href=http://landley.net/notes-2011.html#21-03-2011>the
53 <a href=http://landley.net/talks/celf-2013.txt>strategy</a>
54 to make Android self-hosting using toybox. This helped
64 discourages</a> use of GPL and LGPL licenses in its products, and has gradually
67 <a href=http://meta.ath0.com/2012/02/05/apples-great-gpl-purge/>less subtle</a> response was to fre…
71 <a href=https://www.osnews.com/story/24572/apple-ditches-samba-in-favour-of-homegrown-replacement/>…
72 <a href=https://archive.org/details/copyleftconf2020-allison>replace samba</a>,
73 …a href=https://www.theverge.com/2019/6/4/18651872/apple-macos-catalina-zsh-bash-shell-replacement-…
74 Toybox itself exists because somebody with in a legacy position
77 up working on busybox in the first place,
88 …s.busybox.net/pipermail/busybox/2006-September/058440.html>longstanding rule of thumb</a> is to tr…
93 <p>My original theory was "4 to 5 of the 18-month cycles of moore's law should cover
95 research I did <a href=http://www.catb.org/esr/halloween/halloween9.html#id2867629>back in 2003</a>
96 and <a href=http://catb.org/esr/writings/world-domination/world-domination-201.html#id248066>update…
98 law below the high end systems, and that another 2-3 iterations should cover
99 the useful lifetime of most systems no longer being sold but still in use and
102 <p>That analysis missed <a href=http://landley.net/notes-2011.html#26-06-2011>industry
103 changes</a> in the 1990's that stretched the gap
105 <a href=https://landley.net/notes-2010.html#09-10-2010>the switch</a> from PC to smartphone cutting…
106 laptop market. Meanwhile the Moore's Law <a href=https://en.wikipedia.org/wiki/Logistic_function>s-…
108 back in 2000, and these days is pretty flat: the drive for faster clock
113 linear growth in hardware capabilities is
114 <a href=https://www.cnet.com/news/end-of-moores-law-its-not-just-about-physics/>common knowledge</a…
115 <a href=http://www.acm.org/articles/people-of-acm/2016/david-patterson>widely
119 feature is less than 7 years old, I try to have a build-time configure test
121 images around in VMs to perform the occasional defconfig build there to
135 Releases focus end-user testing on specific versions
139 in their private trees, and give regular checkpoints to measure progress.</p>
142 control knobs... Toybox's switch from "ls -q" to "ls -b" as the default output
143 format was not-a-bug-it's-a "design improvement", but the
148 <p>The counter-argument is that "continuous integration"
150 …123071427/http://www.shirky.com/weblog/2013/11/healthcare-gov-and-the-gulf-between-planning-and-re…
151 emphasis on end-user feedback and learning from real world experience.
153 expect given known inputs running in an established environment, or it's
154 regression testing against bugs previously found in the field. No plan
156 leaves the lab and encounters real world data and use cases in new
157 runtime and build environments.</p>
169 and starting the engine to leave doesn't provoke a last-minute rush of nearby
170 not-quite-ready passengers racing to catch it causing further delay and
172 (The video in the first paragraph goes into much greater detail.)</p>
176 <p>A: Toybox is written in C. There are longer writeups of the
182 <a href=code.html#building>build</a>, in this case "<b>make defconfig;
186 <p><u>The configure stage</u> is copied from the Linux kernel (in the "kconfig"
187 directory), and saves your selections in the file ".config" at the top
193 down, enter to descend into a sub-menu, space to select an entry, ? to see
195 same as the command's "<b>--help</b>" output.</p>
197 <p><u>The "make" stage</u> creates a toybox binary (which is stripped, look in
200 command to run based on the filename, or you can use the "toybox" name in which case the first
201 argument is the command to run (ala "toybox ls -l").</p>
203 <p><u>You can also build
205 The "make change" target builds all of them, as in "change for a $20".</p>
207 <p><u>The main() function is in main.c</u> at the top level,
209 The function toybox_main() in the same file implements the "toybox"
216 Commands in those two directories
217 are _not_ selected by defconfig. (Most of the files in the pending directory
223 the command's own main() function, which uses the option string in
228 <p><u>The build/install infrastructure is shell scripts under
232 in the code walkthrough. All the
233 build's temporary files live under generated, including the .o files built
234 from the .c files (in generated/obj). The "make clean" target deletes that
247 shows up in defconfig or menuconfig.</p>
249 <p><u>The toybox test suite lives in the "tests" directory</u>, and is
254 instead of the toybox version (in theory they should work the same),
263 example binaries</a> against the output of "toybox --version".
264 Between releases the --version
265 information is in "git describe --tags" format with "tag-count-hash" showing the
280 toybox version, find the most recent commit in the android log that isn't from a
281 @google or @android address and search for it in the vanilla commit log.
284 git hash in the data used to generate it so all later commits have a different
287 "git describe --tags $HASH" in the vanilla tree should give you the --version
292 <p>A: Ideally on the <a href=http://lists.landley.net/listinfo.cgi/toybox-landley.net>mailing list<…
296 AOSP has its <a href=https://source.android.com/setup/contribute/report-bugs>own bug reporting mech…
302 behavior ourselves, but ideally doing so in a reasonably current version.
308 links in the git log?</h2>
324 also running on Android, BSD, and MacOS. The project started in 2006
331 to Android in 2014, merged it into Android M (Marshmallow), and remains
332 Android's toybox maintainer. (He explained it in his own words in
333 …idbackstage.blogspot.com/2016/07/episode-53-adb-on-adb.html>this podcast</a>, starting either 18 o…
340 build infrastructure</a> off to one side. (Toybox uses a make wrapper around bash
341 scripts, AOSP builds with soong/ninja instead and checks in a snapshot of the
342 generated/ directory to avoid running kconfig each build).
344 and being pulled from there into Android keeps the two trees in
349 but develops on a standard 64-bit Linux+glibc distro while building embedded
350 32-bit big-endian nommu musl systems requiring proper data alignment for work,
352 to the Google build cluster of powerful machines capable of running the full
353 AOSP build in a reasonable amount of time. Rob is working to get android
355 toybox tools Android's build uses is
356 …ef=https://android.googlesource.com/platform/prebuilts/build-tools/+/refs/heads/master/path/linux-…
357 and what else it needs from its build environment is
358 <a href=https://android.googlesource.com/platform/build/soong/+/refs/heads/master/ui/build/paths/co…
363 you've just built). In the meantime, Rob tests static bionic
369 <p>Elliott is the Android base OS maintainer, in which role he manages
373 and thus spends less time coding than he does sitting in meetings where testers
382 from both "Author:" lines thank someone else for the suggestion in the
388 in the current release, then get the newest version of the
389 project built and running in the old environment.</p>
398 <p>The volunteers are happy to fix any bugs you point out in the current
414 <p>Reproducing bugs in current versions also makes our job easier.
415 The further back in time
416 you are, the more work it is for us digging back in the history to figure
417 out what we hadn't done yet in your version. If spot a problem in a git
418 build pulled 3 days ago, it's obvious what changed and easy to fix or back out.
423 there's a lot more ground to cover and we haven't seen it in a while.</p>
428 put any _effort_ into tracking it down, we want you to put in a little effort
449 used to call them, so if you "mv toybox ls; ./ls -l" it acts like ls. Creating
455 <a href=http://git.musl-libc.org/cgit/musl/tree/include/paths.h>the
459 <blockquote><p><b>for i in $(/bin/toybox --long); do ln -s /bin/toybox $i; done</b></p></blockquote>
461 <p>Or you can install all the symlinks in the same directory as the toybox binary
464 <blockquote><p><b>for i in $(./toybox); do ln -s toybox $i; done</b></p></blockquote></p>
474 command to run, so "./toybox ls -l" also behaves like ls. The "toybox"
475 name is special in that it can have a suffix (toybox-i686 or toybox-1.2.3)
476 and still be recognized, so you can have multiple versions of toybox in the
481 level of symlink. So if your script needs "gsed" you can "ln -s sed gsed",
484 <hr /><h2><a name="dotslash" />Q: What's this ./ on the front of commands in your examples?</h2>
487 linux command shells search the directories listed in the $PATH envionment
488 variable (in order), which usually doesn't include the current directory
494 For historical reasons PATH is colon-separated, and treats an
499 <p>Toybox's shell (toysh) checks for built-in commands before looking at the
501 so "ls" doesn't have to exist in your filesystem for toybox to find it. When
502 you give a path to a command the shell won't run the built-in version
504 won't: "toybox /bin/ls" runs the built-in ls, you can't point it at an
511 you can "make list" to see available command names you can use as build
512 targets to build just that command
516 <p>The "make change" target (as in change for a $20) builds every command
517 standalone (in the "change" subdirectory). Note that this is collectively
518 about 10 times as large as the multiplexer version, both in disk space and
527 libraries necessary to build C programs. (And a few miscellaneous binaries like
531 (bionic, musl, glibc) in the following combinations:</p>
537 default when you build normally
541 <p>You can use LDFLAGS=--static if you want static binaries, but static
542 glibc is hugely inefficient ("hello world" is 810k on x86-64) and throws a
546 <a href=https://elinux.org/images/2/2d/ELC2010-gc-sections_Denys_Vlasenko.pdf>obvious bugs</a>), pl…
547 …f=https://stackoverflow.com/questions/15165306/compile-a-static-binary-which-code-there-a-function…
551 <a href=https://stackoverflow.com/questions/14289488/use-dlsym-on-a-static-binary>improper support<…
553 <a href=https://www.youtube.com/watch?v=Ih-3vK2qLls>in brief, avoid</a>).
560 <p><a href="#cross2">2) gcc+musl = musl-cross-make</a></p>
563 <a href=http://musl.libc.org/>musl-libc</a> maintainer's
564 <a href=https://github.com/richfelker/musl-cross-make>musl-cross-make</a>
565 project, built by running toybox's scripts/mcm-buildall.sh in that directory,
572 git clone https://github.com/richfelker/musl-cross-make
573 cd musl-cross-make
574 ../toybox/scripts/mcm-buildall.sh # this takes a while
575 ln -s $(realpath ccc) ../toybox/ccc
579 in the same format the Linux kernel build uses. You can either provide a
580 full path in the CROSS_COMPILE string, or add the appropriate bin directory
584 <b><p>make LDFLAGS=--static CROSS_COMPILE=~/musl-cross-make/ccc/m68k-linux-musl-cross/bin/m68k-linu…
590 export "PATH=~/musl-cross-make/ccc/m68k-linux-musl-cross/bin:$PATH"<br />
591 LDFLAGS=--static make distclean defconfig toybox CROSS=m68k-linux-musl-
598 In theory you could "make root" a dynamic root filesystem with musl by copying
600 that in mkroot yet because a static linked musl hello world is 10k on x86
613 unzip android-ndk-r21b-linux-x86_64.zip
614 cd android-ndk-21b/toolchains/llvm/prebuilt/linux-x86_64/bin
615 ln -s x86_64-linux-android29-clang x86_64-linux-android-cc
619 make LDFLAGS=--static CROSS_COMPILE=x86_64-linux-android- defconfig toybox
628 <p>Note: although the resulting toybox will run in a standard
632 egg problem for both chroot and qemu cases, because mkroot's init script
635 Since mkroot runs as a normal user, we can't "mknod dev/null" at build
636 time to create a "null" device in the filesystem we're packaging up so
642 make the Linux kernel honor DEVTMPFS_MOUNT in initramfs. Teaching toybox
644 presumably in <a href=https://www.kernel.org/doc/Documentation/filesystems/ramfs-rootfs-initramfs.t…
649 Toybox is one of three packages (linux, libc, command line) which together provide a bootable unix-…
654 to call from it, as documented in
656 the <a href=https://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/cmdbeh…
657 <a href=https://man7.org/linux/man-pages/dir_section_1.html>Linux Manual
660 …te operating system, it's a set of standard command line utilities that run in an operating system.
665 additional libraries in menuconfig (such as openssl, zlib, or selinux),
666 but toybox either provides its own built-in versions of such functionality
671 <p>Static linking (with the --static option) copies library contents
673 can run even if they're the only file in the filesystem. Otherwise,
679 <a href=https://www.man7.org/linux/man-pages/man1/ldd.1.html>ldd</a>,
680 <a href=https://www.man7.org/linux/man-pages/man8/ld.so.8.html>ld.so</a>,
681 and <a href=https://www.man7.org/linux/man-pages/man7/libc.7.html>libc</a>
687 Build systems add a native version of the toolchain packages so
693 <p>But all of these systems conceptually sit on a common three-package
698 <hr /><h2><a name="mkroot" />Q: How do you build a working Linux system with toybox?</h2>
700 <p>A: Toybox has a built-in <a href=https://github.com/landley/toybox/blob/master/scripts/mkroot.sh…
706 <a href=https://qemu.org>qemu</a>
709 path), and pointing the build at a Linux kernel source directory, ala:</p>
713 <p>Then you can <b>cd root/sh4; ./qemu-sh4.sh</b> to launch the emulator.
714 (You'll need the appropriate qemu-system-* emulator binary installed.)
718 and I/O devices, and booted a kernel in it.)</p>
720 <p>The build finds the <a href=#system>three packages</a> needed to produce
721 this system because 1) you're in a toybox source directory, 2) your cross
724 it skips that part of the build and just produces a root filesystem directory
725 ala the first example in this FAQ answer.</p>
727 <p>The CROSS= shortcut expects a "ccc" symlink in the toybox source directory
728 pointing at a directory full of cross compilers. The ones I test this with are built from the musl-…
730 <a href=https://github.com/richfelker/musl-cross-make>musl-cross-make</a>
731 project, built by running toybox's scripts/mcm-buildall.sh in that directory,
738 git clone https://github.com/richfelker/musl-cross-make
739 cd musl-cross-make
740 ../toybox/scripts/mcm-buildall.sh # this takes a while
741 ln -s $(realpath ccc) ../toybox/ccc
759 <p>You can build all the targets at once, and can add additonal packages
760 to the build, by calling the script directly and listing packages on
767 <p>An example package build script (building the dropbear ssh server, adding a
768 port forward from 127.0.0.1:2222 to the qemu command line, and providing a
770 in the scripts/root directory. If you add your own scripts elsewhere, just
771 give a path to them on the command line. (No, I'm not merging more package build
772 scripts, I <a href=https://speakerdeck.com/landley/developing-for-non-x86-targets-using-qemu?slide=…
779 _doesn't_ have CONFIG_SH in it, you won't get a shell prompt or be able to run
781 and route are still in pending and thus not in defconfig, so "make root"
783 "rm .config" and run it again, and all this should be fixed up in future when
788 cleaned up in a future release, before 1.0.)</p>
792 <!--#include file="footer.html" -->