Allow supplying of prebuilt bootloader to avoid nested Cargo builds

Ouverte
#583 3 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
48/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
Active
Stack technique
rust
Domaine
build-system

Piste de recherche

Start with build.rs at the linked lines, where the UEFI bootloader is built, and trace how its output is copied; check the corresponding BIOS stages for the same pattern. Compare the two approaches raised in the issue: accepting a prebuilt EFI path or using Cargo artifact dependencies. Done means the build can use a separately built bootloader without a nested Cargo build, with equivalent support for relevant BIOS stages.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Hi there,

Thanks for the wonderful crate.

I've been trying to build my Rust kernel using Nix (it makes building my userspace and ramdisk a lot easier).
Nix runs builds in a sandbox without any network access unless the output of the build is guaranteed to match a hash (which it provides utilities for doing from a Cargo lock file). Basically this works best if Nix is what invokes Cargo and it has access to the lock file.

Basically, bootloader's invocation of Cargo from its build script causes problems here, since it builds the bootloader-x86_64-uefi crate (I use UEFI only but I believe something similar happens for BIOS builds), and though it runs --locked, there isn't really a good way to get Nix to "reach" that lock file.

What I would like is a way to supply a prebuilt .efi file, made by a Cargo build running separately, to the build script (by say an environment variable holding a path to the built EFI).

https://github.com/rust-osdev/bootloader/blob/9ea5b3dd3a5ecc94060af50bf67e7f8854262760/build.rs#L70-L91

So instead of building the EFI in the build script, it could be done outside and copied into that output directory. If this sounds sensible, I would be willing to open a PR to do this. I would believe similar options would need to be made for each of the BIOS stages for consistency.


Alternatively, since this crate requires a nightly compiler anyway, if this crate used artifact binary dependencies to build each of the bootloader stages and used those built versions in the compiler since that means the same lockfile is used for those builds. This would solve the problem completely, I have tested that Nix can build Rust packages with artifact dependencies just fine with no extra configurations. If this is feasible it would likely be preferable.

Langage dominant
Rust
Étoiles
1.7k
Forks
241
Merge moyen
2 j 19 h
PR mergées (30 j)
2

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de rust-osdev/bootloader

Toutes les issues de rust-osdev/bootloader

Issues similaires

Plus d'issues Rust

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.