The efi boot stub code should only be run if it is enabled
This commit is contained in:
parent
6b2a14d698
commit
20d4dee426
@ -1,9 +1,42 @@
|
|||||||
{pkgs, config, ...}:
|
{pkgs, config, ...}:
|
||||||
|
|
||||||
###### interface
|
with pkgs.lib;
|
||||||
let
|
|
||||||
inherit (pkgs.lib) mkOption mkIf;
|
|
||||||
|
|
||||||
|
let
|
||||||
|
efiBootStubBuilder = pkgs.substituteAll {
|
||||||
|
src = ./efi-boot-stub-builder.sh;
|
||||||
|
isExecutable = true;
|
||||||
|
inherit (pkgs) bash;
|
||||||
|
path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep pkgs.glibc] ++ (pkgs.stdenv.lib.optionals config.boot.loader.efiBootStub.runEfibootmgr [pkgs.efibootmgr pkgs.module_init_tools]);
|
||||||
|
inherit (config.boot.loader.efiBootStub) efiSysMountPoint runEfibootmgr installStartupNsh efiDisk efiPartition;
|
||||||
|
|
||||||
|
efiShell = if config.boot.loader.efiBootStub.installShell then
|
||||||
|
if pkgs.stdenv.isi686 then
|
||||||
|
pkgs.fetchurl {
|
||||||
|
url = "https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/Ia32/Shell_Full.efi";
|
||||||
|
sha256 = "1gv6kyaspczdp7x8qnx5x76ilriaygkfs99ay7ihhdi6riclkhfl";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
pkgs.fetchurl {
|
||||||
|
url = "https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi";
|
||||||
|
sha256 = "1g18z84rlavxr5gsrh2g942rfr6znv9fs3fqww5m7dhmnysgyv8p";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
null;
|
||||||
|
|
||||||
|
kernelFile = platform.kernelTarget;
|
||||||
|
targetArch = if pkgs.stdenv.isi686 then
|
||||||
|
"IA32"
|
||||||
|
else if pkgs.stdenv.isx86_64 then
|
||||||
|
"X64"
|
||||||
|
else
|
||||||
|
throw "Unsupported architecture";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Temporary check, for nixos to cope both with nixpkgs stdenv-updates and trunk
|
||||||
|
platform = pkgs.stdenv.platform;
|
||||||
|
in
|
||||||
|
{
|
||||||
options = {
|
options = {
|
||||||
boot = {
|
boot = {
|
||||||
loader = {
|
loader = {
|
||||||
@ -75,52 +108,8 @@ let
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
in
|
config = mkIf config.boot.loader.efiBootStub.enable {
|
||||||
|
assertions = [ { assertion = ! config.boot.kernelPackages.kernel ? features || config.boot.kernelPackages.kernel.features ? efiBootStub; message = "This kernel does not support the EFI boot stub"; } ];
|
||||||
###### implementation
|
|
||||||
let
|
|
||||||
efiBootStubBuilder = pkgs.substituteAll {
|
|
||||||
src = ./efi-boot-stub-builder.sh;
|
|
||||||
isExecutable = true;
|
|
||||||
inherit (pkgs) bash;
|
|
||||||
path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep pkgs.glibc] ++ (pkgs.stdenv.lib.optionals config.boot.loader.efiBootStub.runEfibootmgr [pkgs.efibootmgr pkgs.module_init_tools]);
|
|
||||||
inherit (config.boot.loader.efiBootStub) efiSysMountPoint runEfibootmgr installStartupNsh efiDisk efiPartition;
|
|
||||||
|
|
||||||
efiShell = if config.boot.loader.efiBootStub.installShell then
|
|
||||||
if pkgs.stdenv.isi686 then
|
|
||||||
pkgs.fetchurl {
|
|
||||||
url = "https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/Ia32/Shell_Full.efi";
|
|
||||||
sha256 = "1gv6kyaspczdp7x8qnx5x76ilriaygkfs99ay7ihhdi6riclkhfl";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
pkgs.fetchurl {
|
|
||||||
url = "https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi";
|
|
||||||
sha256 = "1g18z84rlavxr5gsrh2g942rfr6znv9fs3fqww5m7dhmnysgyv8p";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
null;
|
|
||||||
|
|
||||||
kernelFile = platform.kernelTarget;
|
|
||||||
targetArch = if pkgs.stdenv.isi686 then
|
|
||||||
"IA32"
|
|
||||||
else if pkgs.stdenv.isx86_64 then
|
|
||||||
"X64"
|
|
||||||
else
|
|
||||||
throw "Unsupported architecture";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Temporary check, for nixos to cope both with nixpkgs stdenv-updates and trunk
|
|
||||||
platform = pkgs.stdenv.platform;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
#assertions = [ { assertion = ! config.boot.kernelPackages.kernel ? features || config.boot.kernelPackages.kernel.features ? efiBootStub; message = "This kernel does not support the EFI boot stub"; } ];
|
|
||||||
|
|
||||||
require = [
|
|
||||||
options
|
|
||||||
|
|
||||||
# config.system.build
|
|
||||||
# ../system/system-options.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
system = {
|
system = {
|
||||||
build.installBootLoader = efiBootStubBuilder;
|
build.installBootLoader = efiBootStubBuilder;
|
||||||
@ -130,5 +119,6 @@ in
|
|||||||
(isYes "EFI_STUB")
|
(isYes "EFI_STUB")
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user