Intro to mkroot, Rob Landley, https://landley.net/toybox -------------------------------------------------------- This outline: https://landley.net/talks/txlf-2024.txt Quickstart: https://github.com/landley/toybox/blob/master/mkroot/mkroot.sh 3 parts: setup, root filesystem, kernel and packaging https://github.com/landley/toybox/blob/master/mkroot/README toolchain, build use wget, run, cat /init, zcat /proc/config.gz, cat run-qemu.sh -hda (becomes /mnt), KARGS test wrapper native compiler design AOSP self-hosting, base scales up, used https://landley.net/toybox/about.html Countering "trusting trust" http://lists.landley.net/pipermail/toybox-landley.net/2020-July/011898.html one langauge, no dependencies recent xz, rust making it worse Students should be able to binary re-audit entire base as exercise Binary reverse engineering/auditing is an industry, veracode etc If you can't reproduce it from scratch, you're not doing science. Minimal native development environment - rebuild itself - build linux from scratch (and now AOSP) Simple, auditable, dependency free 4 packages (kernel, libc, cmdline, compiler), circular dependencies backstory; aboriginal busybox https://youtu.be/MkJkyMuBm3g https://landley.net/aboriginal/history.html - FWL replaced 20 LFS packages (aboriginal/old) - aboriginal was 7: linux, uclibc, busybox, gcc, binutils, make, bash https://landley.net/aboriginal/about.html - build linux from scratch under result https://github.com/landley/control-images/tree/master/images/lfs-bootstrap - then gentoo/debian/fedora... - Aboriginal EOL in 2017, Alpine Linux took this ball and ran with it build simple chroot alpine has musl, glibc sucks var=, packages CROSS= LINUX= script walkthrough setup, root filesystem, kernel and packaging 1) setup: vars, dirs, airlock (hermetic build) 2) chroot: mkdir, init, other files 3) kernel (config be->csv->mini->full) I build with kernel patches initramfs.cpio.gz (static vs dynamic, modules) packages plumbing dropbear busybox overlay toybox vs busybox drop in file, adds commands 0BSD If you prefer: mkroot/packages/busybox, NOTOYBOX=1 (bzip2 dependency) vs scripts/prereq/build.sh mkroot/testroot.sh