WIP: Make bootstrapping platform configurable #48
No reviewers
Labels
No labels
Compat
Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: auxolotl/labs#48
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "aleksi/labs:wip-config-bootstrap-system"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Not for merge just yet; aux/foundation currently supports only i686-linux for now, but this PR presents a demo of how tidepool could leverage different bootstrap platforms. I'm working on supporting riscv64-linux in the bootstrap, and @srd424 is working on x86_64-linux as well.
In case you are wondering why I separated bootstrap and build here: The separation may be useful in cases where the bootstrap does not support the desired build platform, yet where a (potentially emulated) bootstrap can cross-compile an userland to run on the final build platform. For example, the user might have a very slow
i686-linuxmachine and a very fastaarch64-linuxmachine, and so they want to bootstrap natively on the slow machine and then perform most compiling on theiraarch64-linux. Please let me know what your thoughts on this approach are!In any case, this PR allows the user to do e.g.
to use a
riscv64-linuxbootstrap, then compile a tidepool foundation running oni686-linuxtargetingx86_64-linux, and then use this to cross-compile bash to run onx86_64-linux. I also tested the plainx86_64-linux->x86_64-linuxcase and it seemed to work good as well.I was especially not sure about whether my way of configuring the platforms here is semantically correct. Also, builders/foundation/basic.nix assumes that the bash to be used should either come from aux/foundation stage2 (if build == bootstrap) or should be bootstrap->build-cross compiled. I'm not sure if this is what we want, or if we should rather build up another layer to ultimately build->build-compile a bash which is then used to build anything that wants build->host.
Sorry about the verbose wall of text here, please let me know if anything is unclear as well.
Not for merge just yet. This allows the user to do e.g. nix build -f . packages.foundation.bash.latest.packages.\ i686-linux.x86_64-linux.package to bootstrap a riscv64-linux aux/foundation, then compile an i686-linux tidepool foundation targeting x86_64-linux, and then use this to cross-compile bash for x86_64-linux.e86cf9b0d4to372bd96ff3@ -19,0 +26,4 @@};platform.bootstrap = lib.options.create {type = lib.types.string;default.value = "i686-linux";Once more platforms are supported in bootstrap, this default could have a smarter automatic selection, preferring a platform that can run natively on the specific final build platform if possible.
@ -22,1 +33,3 @@type = lib.types.attrs.of lib.types.derivation;config = {internal.packages.foundation = foundation;platform.bootstrap = "riscv64-linux";is this a good value to set?
Nah, this assignment is really here only for the sake of testing. Perhaps instead there could be something akin to
.packages.x86_64-linux...to allow choosing the bootstrap platform from the CLI in a convenient way.@ -66,0 +73,4 @@"ld-linux-riscv64-lp64d.so.1"else"ld-linux.so.2");I would recommend something like this instead:
as it make the mapping clear, and the default clear.
Ah, that makes a lot of sense! I'll be updating it shortly.
Oh yeah, another thing that I forgot about when reviewing, but have now remembered, is that this is only true on glibc platforms. So on musl this would be different. I would give it a think about how to design it so it is relatively painless for musl or other libcs, even if it's not explicitly done here.
How about we add a similar option to the musl package, and then require that any libc implementation package must expose such an option? That is, if I've understood the concern correctly 😅
Yeah that sounds good. Basically on musl the linker has a different name (
ld-musl-x86_64.so.1and such)372bd96ff3to01f43626efView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.