{"id":13998281,"url":"https://github.com/fosslinux/live-bootstrap","last_synced_at":"2025-07-23T06:31:10.365Z","repository":{"id":37041072,"uuid":"324314479","full_name":"fosslinux/live-bootstrap","owner":"fosslinux","description":"Use of a Linux initramfs to fully automate the bootstrapping process","archived":false,"fork":false,"pushed_at":"2024-09-07T13:43:14.000Z","size":4468,"stargazers_count":483,"open_issues_count":24,"forks_count":32,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-09-07T15:13:16.522Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fosslinux.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSES/Artistic-1.0-Perl.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-25T07:43:08.000Z","updated_at":"2024-09-07T13:43:18.000Z","dependencies_parsed_at":"2024-03-07T17:55:29.288Z","dependency_job_id":"e73b49c6-4d04-4dd1-8981-de67b9baa967","html_url":"https://github.com/fosslinux/live-bootstrap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fosslinux%2Flive-bootstrap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fosslinux%2Flive-bootstrap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fosslinux%2Flive-bootstrap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fosslinux%2Flive-bootstrap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fosslinux","download_url":"https://codeload.github.com/fosslinux/live-bootstrap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227245144,"owners_count":17753239,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-09T19:01:32.312Z","updated_at":"2024-11-30T00:31:23.664Z","avatar_url":"https://github.com/fosslinux.png","language":"Shell","readme":".. SPDX-FileCopyrightText: 2021 Andrius Štikonas \u003candrius@stikonas.eu\u003e\n.. SPDX-FileCopyrightText: 2021 Paul Dersey \u003cpdersey@gmail.com\u003e\n.. SPDX-FileCopyrightText: 2021 fosslinux \u003cfosslinux@aussies.space\u003e\n\n.. SPDX-License-Identifier: CC-BY-SA-4.0\n\n\nlive-bootstrap\n==============\n\nAn attempt to provide a reproducible, automatic, complete end-to-end\nbootstrap from a minimal number of binary seeds to a supported fully\nfunctioning operating system.\n\nHow do I use this?\n------------------\n\nQuick start:\n\nSee ``./rootfs.py --help`` and follow the instructions given there.\nThis uses a variety of userland tools to prepare the bootstrap.\n\n(*Currently, there is no way to perform the bootstrap without external\npreparations! This is a currently unsolved problem.*)\n\nWithout using Python:\n\n1. ``git clone https://github.com/fosslinux/live-bootstrap``\n2. ``git submodule update --init --recursive``\n3. Consider whether you are going to run this in a chroot, in QEMU, or on bare\n   metal. (All of this *can* be automated, but not in a trustable way. See\n   further below.)\n\n   a. **chroot:** Create a directory where the chroot will reside, run\n      ``./download-distfiles.sh``, and copy:\n\n      * The entire contents of ``seed/stage0-posix`` into that directory.\n      * All other files in ``seed`` into that directory.\n      * ``steps/`` and ``distfiles/`` into that directory.\n\n        * At least all files listed in ``steps/pre-network-sources`` must be\n          copied in. All other files will be obtained from the network.\n      * Run ``/bootstrap-seeds/POSIX/x86/kaem-optional-seed`` in the chroot.\n        (Eg, ``chroot rootfs /bootstrap-seeds/POSIX/x86/kaem-optional-seed``).\n   b. **QEMU:** Create two blank disk images.\n\n      * Generate ``builder-hex0-x86-stage1.img`` from hex0 source:\n\n        ``sed 's/[;#].*$//g' builder-hex0/builder-hex0-x86-stage1-hex0 | xxd -r -p``\n      * On the first image, write ``builder-hex0-x86-stage1.img`` to it, followed\n        by ``kernel-bootstrap/builder-hex0-x86-stage2.hex0``, followed by zeros\n        padding the disk to the next sector.\n      * distfiles can be obtained using ``./download-distfiles.sh``.\n      * See the list in part a. For every file within that list, write a line to\n        the disk ``src \u003csize-of-file\u003e \u003cpath-to-file\u003e``, followed by the contents\n        of the file.\n\n        * *Only* copy distfiles listed in ``sources`` files for ``build:`` steps\n          manifested before ``improve: get_network`` into this disk.\n      * Optionally (if you don't do this, distfiles will be network downloaded):\n\n        * On the second image, create an MSDOS partition table and one ext3\n          partition.\n        * Copy ``distfiles/`` into this disk.\n      * Run QEMU, with 4+G RAM, optionally SMP (multicore), both drives (in the\n        order introduced above), a NIC with model E1000\n        (``-nic user,model=e1000``), and ``-machine kernel-irqchip=split``.\n   c. **Bare metal:** Follow the same steps as QEMU, but the disks need to be\n      two different *physical* disks, and boot from the first disk.\n\nBackground\n----------\n\nProblem statement\n=================\n\nlive-bootstrap's overarching problem statement is;\n\n\u003e How can a usable Linux system be created with only human-auditable, and\nwherever possible, human-written, source code?\n\nClarifications:\n\n* \"usable\" means a modern toolchain, with appropriate utilities, that can be\n  used to expand the amount of software on the system, interactively, or\n  non-interactively.\n* \"human-auditable\" is discretionary, but is usually fairly strict. See\n  \"Specific things to be bootstrapped\" below.\n\nWhy is this difficult?\n======================\n\nThe core of a modern Linux system is primarily written in C and C++. C and C++\nare **self-hosting**, ie, nearly every single C compiler is written in C.\n\nEvery single version of GCC was written in C. To avoid using an existing\ntoolchain, we need some way to be able to compile a GCC version without C. We\ncan use a less well-featured compiler, TCC, to do this. And so forth, until we\nget to a fairly primitive C compiler written in assembly, ``cc_x86``.\n\nGoing up through this process requires a bunch of other utilities as well; the\nautotools suite, guile and autogen, etc. These also have to be matched\nappropriately to the toolchain available.\n\nWhy should I care?\n------------------\n\nThat is outside of the scope of this README. Here’s a few things you can\nlook at:\n\n-  https://bootstrappable.org\n-  Trusting Trust Attack (as described by Ken Thompson)\n-  https://guix.gnu.org/manual/en/html_node/Bootstrapping.html\n-  Collapse of the Internet (eg CollapseOS)\n\nSpecific things to be bootstrapped\n----------------------------------\n\nGNU Guix is currently the furthest along project to automate\nbootstrapping. However, there are a number of non-auditable files used\nin many of their packages. Here is a list of file types that we deem\nunsuitable for bootstrapping.\n\n1. Binaries (apart from seed hex0, kaem, builder-hex0).\n2. Any pre-generated configure scripts, or Makefile.in’s from autotools.\n3. Pre-generated bison/flex parsers (identifiable through a ``.y``\n   file).\n4. Any source code/binaries downloaded within a software’s build system\n   that is outside of our control to verify before use in the build\n   system.\n5. Any non-free software. (Must be FSF-approved license).\n\nHow does this work?\n-------------------\n\n**For a more in-depth discussion, see parts.rst.**\n\nFirstly, ``builder-hex0`` is launched. ``builder-hex0`` is a minimal kernel that is\nwritten in ``hex0``, existing in 3 self-bootstrapping stages.\n\nThis is capable of executing the entirety of ``stage0-posix``, (see\n``seed/stage0-posix``), which produces a variety of useful utilities and a basic\nC language, ``M2-Planet``.\n\n``stage0-posix`` runs a file called ``after.kaem``. This is a shell script that\nbuilds and runs a small program called ``script-generator``. This program reads\n``steps/manifest`` and converts it into a series of shell scripts that can be\nexecuted in sequence to complete the bootstrap.\n\nFrom this point forward, ``steps/manifest`` is effectively self documenting.\nEach package built exists in ``steps/\u003cpkg\u003e``, and the build scripts can be seen\nthere.\n","funding_links":[],"categories":["Shell","Bootstrap"],"sub_categories":["Self-hosted hex assemblers"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffosslinux%2Flive-bootstrap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffosslinux%2Flive-bootstrap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffosslinux%2Flive-bootstrap/lists"}