logo

bootstrap-initrd

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

README.md (2547B)


  1. # bootstrap-initrd
  2. ```
  3. Copyright 2017 Haelwenn (lanodan) Monnier <contact@hacktivis.me>
  4. SPDX-License-Identifier: MPL-2.0
  5. ```
  6. A initrd generator for Linux to bootstrap a POSIX-ish system from a reasonably small binary seed.
  7. ## Status
  8. - [x] Small binary seed of only TCC and musl (~1.2MB of binaries, depending on the architecture), enforced by [deblob](https://hacktivis.me/projects/deblob)
  9. - [x] Capable of bootstrapping <https://git.sr.ht/~mcf/oasis>
  10. - [ ] Self-replicating: Able to reassemble the initrd with Alpine apks
  11. - [ ] Self-hosting: Able to recompile all the software used from source (including tcc and musl)
  12. - [x] Code compiled by `init.sh` is reviewable, mostly thanks to a lack of autotools
  13. ## Explorations
  14. - Reduce the binary seed even further, without compromising on keeping the bootstrapping simple and reasonably fast
  15. ## Non-Goals
  16. - GNU Environment, there is already <https://github.com/fosslinux/live-bootstrap> for this and it's a massive effort
  17. - Become a distro, at worst it should end up deferring to an existing ports system like <https://www.pkgsrc.org/>
  18. ## Architectures
  19. You can set `ALPINE_ARCH` to change the architecture, by default it's set to `x86_64`.
  20. - `aarch64`: Works except for extras (tested on HoneyComb LX2k with linux 6.12.21-gentoo)
  21. - `armhf`: Untested
  22. - `armv7`: Untested
  23. - `riscv64`: Works except for extras (tested on VisionFive2 with linux-lts from Alpine)
  24. - `x86`: Works
  25. - `x86_64` (aka amd64): Works
  26. ## Rationales
  27. Moved to RATIONALES.md
  28. ## Extras
  29. The `/extras` directory is for software which is either specific
  30. to bootstrapping a particular system, or software which contains
  31. pregenerated code rather than 100% source code.
  32. You can automatically build all of it with `/extras-build-all.sh`
  33. You can exclude those tarballs from the initrd with setting
  34. the `EXCLUDE_EXTRAS` environment variable to any value.
  35. ## Launching in QEMU
  36. * You need a Linux kernel, so far no known version limitations
  37. * Combination of `panic=1` and `-no-reboot` allows to exit+relaunch
  38. ```
  39. $ ./make-initrd.sh && qemu-system-x86_64 -enable-kvm -m 512 -kernel /boot/vmlinuz-6.6.21-gentoo -initrd bootstrap-initrd/x86_64+extras.cpio.gz -append 'init=/init console=ttyS0 panic=1' -nographic -no-reboot
  40. ```
  41. ## Dev setup via bubblewrap
  42. ```
  43. $ ./make-root.sh && bwrap --clearenv --unshare-all --bind bootstrap-initrd/x86_64+extras/ / --proc /proc --dev /dev --uid 0 --gid 0 /init
  44. ```
  45. Useful as it allows to manipulate the environment externally, for example to edit files in an editor more comfortable than `ed(1)`.