Add NO_TOOLCHAIN_CONTAINER build option for bootstrapping (#13109)
Merge Checklist
All boxes should be checked before merging the PR (just tick any boxes which don't apply to this PR)
- [x] The toolchain has been rebuilt successfully (or no changes were made to it)
- [x] The toolchain/worker package manifests are up-to-date
- [x] Any updated packages successfully build (or no packages were changed)
- [x] Packages depending on static components modified in this PR (Golang,
*-staticsubpackages, etc.) have had theirReleasetag incremented. - [ ] Package tests (%check section) have been verified with RUN_CHECK=y for existing SPEC files, or added to new SPEC files
- [x] All package sources are available
- [x] cgmanifest files are up-to-date and sorted (
./cgmanifest.json,./toolkit/scripts/toolchain/cgmanifest.json,.github/workflows/cgmanifest.json) - [x] LICENSE-MAP files are up-to-date (
./LICENSES-AND-NOTICES/SPECS/data/licenses.json,./LICENSES-AND-NOTICES/SPECS/LICENSES-MAP.md,./LICENSES-AND-NOTICES/SPECS/LICENSE-EXCEPTIONS.PHOTON) - [x] All source files have up-to-date hashes in the
*.signatures.jsonfiles - [x]
sudo make go-tidy-allandsudo make go-test-coveragepass - [x] Documentation has been updated to match any changes to the build system
- [ ] Ready to merge
Summary
This introduces a new build option, NO_TOOLCHAIN_CONTAINER=y, to enable building the initial toolchain without containerization. This makes it possible to build the toolchain, and by extension, the entire distribution, without relying on prebuilt packages of itself included in the toolchain building container, closing a potential Trusting Trust attack vector, and paving the way for a full source bootstrap of Azure Linux from a minimal binary seed (e.g. the stage0 project's sub-1KiB seeds). The existing containerized workflow is unchanged, and remains the default way to build the toolchain.
Change Log
- Add new build variable
NO_TOOLCHAIN_CONTAINERwith default valuen - Pass
NO_TOOLCHAIN_CONTAINERtocreate_toolchain_in_container.sh(TODO: rename tocreate_toolchain.sh?) - Make the use of the toolchain container optional in
create_toolchain_in_container.sh - Introduce new script
bypass_container.shto replicate the functionality of theDockerfilewithout using a container or any precompiled binaries from a previous Azure Linux build - Explicitly use
/bin/bashas the interpreter fortoolchain_build_temp_tools.sh(TODO remove sanity check to ensure/bin/shis Bash?) - Access build tools via
$LFS/toolsduring temp toolchain build, do not assume/toolsis a symlink
Does this affect the toolchain?
YES (it affects only the toolchain)
Associated issues
- #13109
Test Methodology
- Local build (containerized toolchain)
- Local build (uncontainerized toolchain on Ubuntu 22.04)
- Local build (uncontainerized toolchain in live-bootstrap bare metal environment)