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

system/boot: add includeDefaultModules option #111452

Merged
merged 1 commit into from Feb 7, 2021

Conversation

urbas
Copy link
Contributor

@urbas urbas commented Jan 31, 2021

Motivation for this change

I am trying to build NixOS for Raspberry Pi 3 with boot.kernelPackages = pkgs.linuxPackages_rpi3 (this is needed to support dt overlays and Python GPIO libraries as the mainline kernel doesn't support these yet).

It turns out that linuxPackages_rpi3 doesn't come with a lot of kernel modules that are added by NixOS configuration by default (see below for a detailed list of missing modules [1]). This means that the NixOS build fails with the following error:

root module: ahci
modprobe: FATAL: Module ahci not found in directory /nix/store/cirrb8rzsqsc91l9mwyglxqik2ia3vzk-linux-5.4.79-1.20201201-modules/lib/modules/5.4.79

This change allows us to omit the default modules and add just those that are provided by the platform-specific list of supported kernel modules.

Things done

I have built an SD image with this change and verified that it boots on a Raspberry Pi 3B (I was able to ssh into it and run my regular services on it).

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • 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 nixpkgs-review --run "nixpkgs-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)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

[1] The list of missing modules in the RPi3 kernel:

ahci
sata_nv
sata_via
sata_sis
sata_uli
ata_piix
pata_marvell
uhci_hcd
ehci_pci
ohci_pci
xhci_pci

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Jan 31, 2021

The change looks good to me.
By the way, this note is from NixOS prehistory (at least 12 years old):

# Note: most of these (especially the SATA/PATA modules)
# shouldn't be included by default since nixos-generate-config
# detects them, but I'm keeping them for now for backwards
# compatibility.

It's probably a good time to remove them.

@urbas urbas force-pushed the linuxPackages_rpi3-missing-ahci-module branch from eee6aeb to c5ca243 Compare January 31, 2021 13:50
@urbas
Copy link
Contributor Author

urbas commented Jan 31, 2021

The change looks good to me.
By the way, this note is from NixOS prehistory (at least 12 years old):
...
It's probably a good time to remove them.

Hah, that's an impressive age. If this list of modules survived 12+ years, it's probably here to stay. 😅

I removed the comment now.

@urbas
Copy link
Contributor Author

urbas commented Feb 6, 2021

@rnhmjoj: this PR should be ready to go now.

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Feb 7, 2021

Can you keep the comment? I'd like to try removing some of the modules in another PR: unlike 12 years ago there are tests for the installer and initrd that can help testing this change.

@urbas urbas force-pushed the linuxPackages_rpi3-missing-ahci-module branch from c5ca243 to 95df164 Compare February 7, 2021 08:52
@urbas
Copy link
Contributor Author

urbas commented Feb 7, 2021

No problem, the comments are back. @rnhmjoj, please take another look.

@urbas urbas force-pushed the linuxPackages_rpi3-missing-ahci-module branch from 95df164 to 2c769d7 Compare February 7, 2021 11:14
Copy link
Contributor

@rnhmjoj rnhmjoj left a comment

Choose a reason for hiding this comment

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

The diff looked already good. I just run a bunch of initrd tests, with and without includeDefaultModules, and all seems well.

@rnhmjoj rnhmjoj merged commit 237d5fa into NixOS:master Feb 7, 2021
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

2 participants