Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grub: Support 32bit EFI on 64bit platforms #54625

Merged
merged 1 commit into from Mar 21, 2019

Conversation

FlorianFranzen
Copy link
Contributor

@FlorianFranzen FlorianFranzen commented Jan 26, 2019

Motivation for this change

With these changes it is possible to boot, install and run a 64bit NixOS on 64bit machines with a 32bit EFI. Example for such systems are the first few generations of Intel Apple Mac Pros or certain Intel Atom based systems.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How well did you test this?

nixos/modules/system/boot/loader/loader.nix Outdated Show resolved Hide resolved
nixos/modules/installer/cd-dvd/iso-image.nix Outdated Show resolved Hide resolved
pkgs/tools/misc/grub/2.0x.nix Outdated Show resolved Hide resolved
@FlorianFranzen
Copy link
Contributor Author

FlorianFranzen commented Jan 26, 2019

I clearly mixed up the branches. I have a client running a version of this patch. I will post the correct branch once I have access to it in a few hours.

@infinisil The architecture of the EFI boot loader has to be changed on the install ISO, so that the ISO is bootable on these systems. The same config flag is then used to install the correct architecture of grub. Because it affects the ISO as well as grub, I decided to use a generic boot loader flag. Systemd-boot does not support this kind of booting, I could add an assert to systemd-boot to make that clear.

@samueldr samueldr self-requested a review January 26, 2019 19:32
@samueldr
Copy link
Member

samueldr commented Jan 26, 2019

I'm waiting for the update to review and test, but let's ask anyway: do you have a ready-to-use qemu invocation that uses the ia32 EFI bootloader to boot the aarch64 x86_64 system?

@FlorianFranzen
Copy link
Contributor Author

@samueldr This is x86 only so, no. And I am not sure how well you can emulated mixed EFI systems with qemu in general.

@infinisil I uploaded the correct patch now. Any feedback is welcome.

@samueldr
Copy link
Member

@samueldr This is x86 only so, no.

D'oh! I meant ia32 to boot x86_64... Too many arches. (I edited my previous comment.)

And I am not sure how well you can emulated mixed EFI systems with qemu in general.

Turns out that using a 32-bit Tianocore build is all that's required. Once the build is set to forcei686, building a 32 bit Tianocore and starting as follows works. Trying to boot a x86_64-only iso with the same setup fails.

$ nix-build -A pkgsi686Linux.OVMF.fd
$ nix-build nixos/release.nix -A iso_minimal.x86_64-linux
$ qemu-system-x86_64 -enable-kvm -bios ./result-fd/FV/OVMF.fd -cdrom ./result/iso/*-x86_64-linux.iso  -m 1024

image

Seems to work fine, and from light reading online it's pretty much verified that boards with a 32 bit UEFI would behave the same way than that qemu invocation.

As far as working, 👍 this PR seems to work as intended, at least for the iso image.

@matthewbauer could you validate whether the changes including the name targetPkgs could cause issues with cross-compilation?

@FlorianFranzen
Copy link
Contributor Author

Seems like we just missed the windows for 19.03. I assumed mixed (U)EFI support seems to be on the agenda of at least a few people.

@matthewbauer Did you have time to look at this yet? If targetPkgs hits to close to home, I can name it anything else.

@samueldr Anything else I can do to move this along?

@FlorianFranzen
Copy link
Contributor Author

@matthewbauer: Thank you for your feedback. I added the proposed changes.

@FlorianFranzen
Copy link
Contributor Author

@infinisil Would you mind taking another look, so we can get this merged?

@infinisil infinisil dismissed their stale review March 9, 2019 13:30

I reviewed pretty much irrelevant code, so this is fine

@infinisil
Copy link
Member

@GrahamcOfBorg test installer.simpleUefiGrub

@FlorianFranzen
Copy link
Contributor Author

Glad to hear that. What is missing to get this merged?

@matthewbauer
Copy link
Member

I think we should backport this to 19.03

@samueldr
Copy link
Member

samueldr commented Apr 1, 2019

Done,

[release-19.03 de621d4] grub: Support 32bit EFI on 64bit x86 platforms
Date: Mon Jan 28 12:00:58 2019 +0100
2 files changed, 29 insertions(+), 18 deletions(-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants