2020-01-13 00:09:02 +03:00
|
|
|
# This module handles well-known "vendor" partitions.
|
|
|
|
#
|
|
|
|
# Relevant upstream documentation:
|
|
|
|
# * https://www.kernel.org/doc/html/v4.14/driver-api/firmware/fw_search_path.html
|
|
|
|
#
|
|
|
|
# Note that we'll be using `firmware_class.path=/vendor/firmware` on the
|
|
|
|
# command-line to make the firmware path known ASAP without requiring run-time
|
|
|
|
# configuration. The NixOS stage-2 will configure `/sys/module/firmware_class/parameters/path`
|
|
|
|
# as expected.
|
|
|
|
{ config, lib, ... }:
|
|
|
|
|
|
|
|
let
|
2020-05-24 09:40:25 +03:00
|
|
|
inherit (lib) types;
|
|
|
|
inherit (config.mobile.system) vendor;
|
2020-01-13 00:09:02 +03:00
|
|
|
in
|
2020-05-24 09:40:25 +03:00
|
|
|
{
|
|
|
|
options = {
|
|
|
|
mobile.system.vendor.partition = lib.mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
|
|
|
description = "Path to a partition with firmware files built-in to the device";
|
|
|
|
internal = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
config = lib.mkIf (vendor.partition != null) {
|
|
|
|
boot.kernelParams = [
|
|
|
|
"firmware_class.path=/vendor/firmware"
|
|
|
|
];
|
|
|
|
|
2020-01-13 00:09:02 +03:00
|
|
|
boot.specialFileSystems = {
|
|
|
|
"/vendor" = {
|
2020-05-24 09:40:25 +03:00
|
|
|
device = vendor.partition;
|
2020-01-13 00:09:02 +03:00
|
|
|
fsType = "ext4";
|
2020-03-29 22:23:26 +03:00
|
|
|
options = [ "ro" "nosuid" "noexec" "nodev" ];
|
2020-01-13 00:09:02 +03:00
|
|
|
};
|
|
|
|
};
|
2020-05-24 09:40:25 +03:00
|
|
|
};
|
|
|
|
}
|