logo

bootstrap-initrd

Linux initrd to bootstrap from a small binary seed git clone https://anongit.hacktivis.me/git/bootstrap-initrd.git/

RATIONALES.md (5307B)


  1. # Rationales
  2. Each of those roughly by their build order, no guarantee on this.
  3. ## TCC (binary)
  4. Need to start somewhere and TCC allows to interpret C, allowing to avoid seeding another interpreter.
  5. The reason to not pick Guile+MesCC instead is because I find Guile Scheme to be less well-known than amd64 itself.
  6. ## musl (binary)
  7. Need a libc to start somewhere, tryhards could maybe compile it from source with TCC to reduce the seed further but this hasn't been tried.
  8. It's `libc.a` is removed, to shave off 9.1MB from the binary seed, going from 11MB total to 1.2MB total, you're likely going to rebuild musl anyway since this is a sort of stage0.
  9. ## TCC as ar(1) implementation
  10. Meanwhile:
  11. - Binutils: 300+ MiB repository of sources, generated artifacts frequently over 1MB, and test fixtures also often over 1MB. Nope.
  12. ## OpenBSD ksh
  13. Portable version done by Dr. Brian Robert Callahan aka ibara@, of OpenBSD.
  14. Buildable with only a C compiler while being nicely complete (maybe even too much).
  15. Builtin commands (as of 7.6):
  16. - defined in c_sh.c: ., :, [, break, builtin, continue, eval, exec, exit, false, return, set, shift, times, trap, wait, read, test, true, ulimit, umask, unset, suspend
  17. - defined in c_ksh.c: alias, cd, command, echo, export, fc, getopts, jobs, kill, let, print, pwd, readonly, type, typeset, unalias, whence, bg, fg (and bind when emacs-mode is enabled)
  18. Meanwhile:
  19. - loksh: similar port but header names overrides the libc ones
  20. - mrsh: Too incomplete for actual use, but trivial to build with only a C Compiler
  21. - heirloom-sh: Also buildable with only a C Compiler but fails to allocate memory at launch
  22. - bash, yash: autoconf, so needs an existing shell
  23. - dash: autoconf and generator scripts, so needs an existing shell
  24. - mksh: ./Build.sh, so needs an existing shell
  25. - AT&T ksh: Way too big to even try, might as well try Perl
  26. ## OpenBSD yacc
  27. Portable version done by Dr. Brian Robert Callahan aka ibara@, of OpenBSD.
  28. Uses a BSD-style configure script, trivial to diff between versions and adjust hardcoded compiler flags (no utilities to run said script yet).
  29. Meanwhile:
  30. - bison: autoconf, way too early
  31. - byacc: autoconf
  32. - [yacc from compilertools.net](https://web.archive.org/web/20220511161030/http://dinosaur.compilertools.net/): Domain expired years ago and turns out Gentoo was the only distro still providing it
  33. ## utils-std
  34. My own software, which explicitly allows to bootstrap with an incomplete POSIX environment such as this one.
  35. Meanwhile:
  36. - GNU coreutils: Autoconf, therefore needs the utilities it's building plus some extras to already be available
  37. - Busybox and Toybox: Heavy dependency on GNU Make, bash, …, which can only come much later on in the bootstrapping process
  38. ## sbase
  39. Simple `ed` and `sed` implementations which uses `regex.h` instead of some broken regex engine.
  40. Lack of support of `-i` option on sed(1) is a bit annoying, might patch this.
  41. Meanwhile:
  42. - minised: Broken regex engine which is too limited to pass `./configure` checks like the one in GNU make
  43. - GNU sed: `./configure` script requires an existing sed (*why*), doesn't seems like there's a workaround.
  44. ## (One True) awk
  45. Reference implementation and AFAIK the one used in BSDs, can be built with only a Yacc implementation and a C Compiler.
  46. ## pdpmake
  47. Public Domain POSIX make, trivial to compile without an existing make, features future POSIX additions and common extensions.
  48. Meanwhile:
  49. - bmake (NetBSD make port): autotools configure script, simpler than the one in GNU make but still unreviewable
  50. - OpenBSD make, port at <https://github.com/ibara/make> is incomplete and likely outdated
  51. - (OpenOffice) dmake: Horribly massive
  52. ## bzip2
  53. Builds with C Compiler + POSIX make.
  54. Meanwhile:
  55. - pbzip2: Requires C++ compiler
  56. ## zlib
  57. Simple albeit slightly broken `./configure` script (see patches).
  58. ## pigz
  59. Simple, needs make + c compiler + zlib.
  60. Note: Vendored zopfli got removed, so no compression beyond -9
  61. Meanwhile:
  62. - GNU gzip: Autotools
  63. ## Heirloom-devtools lex
  64. Slightly messy Makefiles but only has few dependencies.
  65. Meanwhile:
  66. - flex: Autotools
  67. ## Heirloom-devtools m4
  68. Slightly messy Makefiles but only has few dependencies.
  69. Meanwhile:
  70. - GNU m4: Not even close
  71. - OpenBSD m4 aka om4: Requires a more modern lex than heirloom-devtools provides
  72. ## Heirloom (toolchest) diff, sort
  73. Slightly messy Makefiles but only has few dependencies.
  74. ## Heirloom (toolchest) tar
  75. Slightly messy Makefiles but only has few dependencies.
  76. Meanwhile:
  77. - libarchive aka bsdtar: Autotools
  78. - GNU tar: [No.](https://www.roguelazer.com/blog/surprising-behavior-in-gnu-tar/)
  79. ## extra: genext2fs
  80. - e2fsprogs: complex autotools buildsystem
  81. - genext2fs: uses autotools but only for generating a config.h which can be vendored
  82. - lwext4: a lot more code than you'd need on systems like Linux which have builtin support for ext2
  83. ## misc extras
  84. - lua: For oasis
  85. - muon: For pkgconf and git without autotools
  86. - pkgconf: For iproute2
  87. - GNU make: Required by the other extras
  88. - iproute2: Basic networking configuration
  89. - bearssl: small TLS library
  90. - tiny-curl: Still pretty big but hopefully close enough to the usual one
  91. - cacert (from curl.haxx.se): Maybe could be reduced to a handful of CAs (like maybe even just Let's Encrypt)
  92. - git: For oasis
  93. - usign: To check signify(1) signatures