2019-01-29 03:51:45 +03:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
inherit (lib) mkIf mkMerge mkOption types;
|
2020-03-28 22:27:00 +03:00
|
|
|
inherit (pkgs) imageBuilder;
|
2019-01-29 03:51:45 +03:00
|
|
|
cfg = config.mobile.hardware.socs;
|
2020-03-28 22:27:00 +03:00
|
|
|
initialGapSize =
|
|
|
|
# Start of the "magic" location bs=1024 seek=8
|
|
|
|
(imageBuilder.size.MiB 8) +
|
|
|
|
# Current u-boot size: 483K, so let's leave a *bunch* of room.
|
|
|
|
(imageBuilder.size.MiB 2)
|
|
|
|
;
|
2019-01-29 03:51:45 +03:00
|
|
|
in
|
|
|
|
{
|
|
|
|
options.mobile = {
|
2020-03-11 23:40:43 +03:00
|
|
|
hardware.socs.allwinner-a64.enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "enable when SOC is Allwinner A64";
|
|
|
|
};
|
2019-01-29 03:51:45 +03:00
|
|
|
hardware.socs.allwinner-r18.enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "enable when SOC is Allwinner-R18";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkMerge [
|
2020-03-11 23:40:43 +03:00
|
|
|
{
|
|
|
|
mobile = mkIf cfg.allwinner-a64.enable {
|
|
|
|
system.system = "aarch64-linux";
|
2020-03-28 22:27:00 +03:00
|
|
|
quirks.u-boot = {
|
|
|
|
soc.family = "allwinner";
|
|
|
|
inherit initialGapSize;
|
|
|
|
};
|
2020-03-11 23:40:43 +03:00
|
|
|
};
|
|
|
|
}
|
2019-01-29 03:51:45 +03:00
|
|
|
{
|
|
|
|
mobile = mkIf cfg.allwinner-r18.enable {
|
|
|
|
system.system = "aarch64-linux";
|
2020-03-28 22:27:00 +03:00
|
|
|
quirks.u-boot = {
|
|
|
|
soc.family = "allwinner";
|
|
|
|
inherit initialGapSize;
|
|
|
|
};
|
2019-01-29 03:51:45 +03:00
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
}
|