2020-12-18 02:13:28 +03:00
|
|
|
{ config, lib, pkgs, modules, baseModules, ... }:
|
2020-12-16 02:02:00 +03:00
|
|
|
|
|
|
|
# This module provides the `stage-0` build output.
|
|
|
|
# It is the same configuration, with minor customizations.
|
|
|
|
|
|
|
|
let
|
|
|
|
inherit (lib) mkOption types;
|
|
|
|
inherit (config.mobile.quirks) supportsStage-0;
|
2020-12-18 02:13:28 +03:00
|
|
|
kernelVersionSupportsKexec =
|
|
|
|
if pkgs.targetPlatform.system == "aarch64-linux"
|
|
|
|
then (lib.versionAtLeast (config.mobile.boot.stage-1.kernel.package.version) "4.8")
|
|
|
|
else true
|
|
|
|
;
|
2020-12-16 02:02:00 +03:00
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
mobile.quirks.supportsStage-0 = mkOption {
|
|
|
|
type = types.bool;
|
2020-12-18 02:13:28 +03:00
|
|
|
default = kernelVersionSupportsKexec;
|
|
|
|
defaultText = "(Varies per platform; aarch64 depends on kernel version.)";
|
2020-12-16 02:02:00 +03:00
|
|
|
description = ''
|
|
|
|
Set to false when a device cannot use `kexec` to kexec into a system.
|
2020-12-18 02:13:28 +03:00
|
|
|
|
|
|
|
A default value will be selected according to the platform and
|
|
|
|
`mobile.boot` kernel selected.
|
2020-12-16 02:02:00 +03:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
|
|
|
system.build.stage-0 = (import ../lib/eval-config.nix {
|
|
|
|
inherit baseModules;
|
|
|
|
modules = modules ++ [{
|
|
|
|
mobile.boot.stage-1.stage = if supportsStage-0 then 0 else 1;
|
|
|
|
}];
|
|
|
|
}).config;
|
|
|
|
};
|
|
|
|
}
|