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

Aarch64 Netboot #32031

Merged
merged 1 commit into from Dec 12, 2017
Merged

Aarch64 Netboot #32031

merged 1 commit into from Dec 12, 2017

Conversation

grahamc
Copy link
Member

@grahamc grahamc commented Nov 25, 2017

Some old patches I've had kicking around, and need to upstream ... :)

Here to clean them up and solicit feedback.


boot.loader.grub.version = 2;

config = rec {
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm going to restore the grub version for not-aarch64-linux.

Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't it also be '2' for aarch64?

Copy link
Member Author

Choose a reason for hiding this comment

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

Turns out we don't need this, anyway. Defaults to 2.

# Don't build the GRUB menu builder script, since we don't need it
# here and it causes a cyclic dependency.
boot.loader.grub.enable = false;

# !!! Hack - attributes expected by other modules.
system.boot.loader.kernelFile = "bzImage";
environment.systemPackages = [ pkgs.grub2 pkgs.grub2_efi pkgs.syslinux ];
Copy link
Member Author

@grahamc grahamc Nov 25, 2017

Choose a reason for hiding this comment

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

I'm going to restore these packages for not aarch64, but I don't think they build on aarch64. I wonder what that means for # !!! Hack - attributes expected by other modules..

Copy link
Contributor

@dezgeg dezgeg Nov 25, 2017

Choose a reason for hiding this comment

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

git grep kernelTarget already gives the answer to "bzImage", so whatever uses that should be refactored to use kernelTarget.

Copy link
Member Author

Choose a reason for hiding this comment

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

nixos/modules/system/activation/top-level.nix
32:        "${config.system.boot.loader.kernelFile}";
173:    system.boot.loader.kernelFile = mkOption {

nixos/modules/installer/cd-dvd/iso-image.nix
269:    system.boot.loader.kernelFile = "bzImage";

nixos/modules/installer/cd-dvd/system-tarball-sheevaplug.nix
85:  system.boot.loader.kernelFile = "uImage";
153:    { source = config.boot.kernelPackages.kernel + "/" + config.system.boot.loader.kernelFile;
154:      target = "/boot/" + config.system.boot.loader.kernelFile;

nixos/modules/installer/cd-dvd/system-tarball-pc.nix
82:    [ { source = config.boot.kernelPackages.kernel + "/" + config.system.boot.loader.kernelFile;
83:        target = "/boot/" + config.system.boot.loader.kernelFile;

nixos/modules/installer/cd-dvd/system-tarball-fuloong2f.nix
139:    { source = config.boot.kernelPackages.kernel + "/" + config.system.boot.loader.kernelFile;
140:      target = "/boot/" + config.system.boot.loader.kernelFile;
155:  system.boot.loader.kernelFile = "vmlinux";

nixos/modules/installer/netboot/netboot.nix
30:    system.boot.loader.kernelFile = if pkgs.stdenv.system == "aarch64-linux"
90:      kernel ${system.boot.loader.kernelFile} init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}

nixos/modules/system/boot/loader/generations-dir/generations-dir.nix
62:    system.boot.loader.kernelFile = platform.kernelTarget;

nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix
46:    system.boot.loader.kernelFile = platform.kernelTarget;

I'm not sure I want to take this on in this PR 😅

Copy link
Member Author

Choose a reason for hiding this comment

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

Eh ... might as well ...

Copy link
Contributor

Choose a reason for hiding this comment

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

Well you could change it to system.boot.loader.kernelFile = platform.kernelTarget; and call it a day.

Copy link
Contributor

@dezgeg dezgeg Nov 25, 2017

Choose a reason for hiding this comment

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

As for the packages, grub2_efi should does build on AArch64.

BTW, don't you need to use mkIf to not end up with infinite recursion?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't, systemPackages doesn't impact pkgs here. Fixed up the kernelTarget issue, added grub2_efi on aarch64.

system.build.netbootIpxeScript = pkgs.writeTextDir "netboot.ipxe" "#!ipxe\nkernel bzImage init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}\ninitrd initrd\nboot";
system.build.netbootIpxeScript = pkgs.writeTextDir "netboot.ipxe" ''
#!ipxe
kernel ${system.boot.loader.kernelFile} init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}
Copy link
Member Author

Choose a reason for hiding this comment

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

The only thing changing here is bzImage is becoming variable.

@@ -442,7 +442,8 @@ in

virtualisation.pathsInNixDB = [ config.system.build.toplevel ];

virtualisation.qemu.options = [ "-vga std" "-usbdevice tablet" ];
virtualisation.qemu.options = [ "-machine gic-version=host" "-cpu host"
"-machine virt" "-device virtio-gpu" ];
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure these are useful, I don't think they ever worked. I plan on removing these changes.

@@ -81,10 +81,21 @@ stdenv.mkDerivation rec {
done
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure these are useful. Thoughts?

@@ -164,18 +164,15 @@ let
chmod u+w -R ../source
Copy link
Member Author

Choose a reason for hiding this comment

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

I think these changes have been incorporated already.

@@ -12227,7 +12227,7 @@ with pkgs;
qemu_xen = lowPrio (qemu.override { x86Only = true; xenSupport = true; xen = xen-slim; });
qemu_xen-light = lowPrio (qemu.override { x86Only = true; xenSupport = true; xen = xen-light; });

qemu_test = lowPrio (qemu.override { x86Only = true; nixosTestRunner = true; });
qemu_test = lowPrio (qemu.override { x86Only = false; nixosTestRunner = true; });
Copy link
Member Author

Choose a reason for hiding this comment

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

This might depend on my changes to pkgs/applications/virtualization/qemu/default.nix ... thoughts?

@@ -126,6 +126,30 @@ in rec {
'';
};

netboot.aarch64-linux = let build = (import lib/eval-config.nix {
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't you need to do something special here in case the supportedSystems parameter passed to the file doesn't include aarch64?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Member Author

@grahamc grahamc left a comment

Choose a reason for hiding this comment

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

Ok, other than my one comment this should be good to go.

@@ -1,6 +1,6 @@
{ nixpkgs ? { outPath = ./..; revCount = 56789; shortRev = "gfedcba"; }
, stableBranch ? false
, supportedSystems ? [ "x86_64-linux" ]
, supportedSystems ? [ "x86_64-linux" "aarch64-linux" ]
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not certain we want to do this yet. Thoughts?

@grahamc
Copy link
Member Author

grahamc commented Nov 26, 2017

@grahamc grahamc changed the title WIP: assorted aarch64 patches Aarch64 Netboot Dec 12, 2017
@grahamc grahamc merged commit 3cad1ab into master Dec 12, 2017
@grahamc grahamc deleted the unstable-aarch64 branch December 12, 2017 22:44
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

3 participants