liminix/modules/hardware.nix

103 lines
3.6 KiB
Nix
Raw Permalink Normal View History

2023-08-09 23:27:37 +02:00
## Hardware-dependent options
## ==========================
##
## These are attributes of the hardware not of the application
## you want to run on it, and would usually be set in the "device" file:
## :file:`devices/manuf-model/default.nix`
{ lib, pkgs, config, ...}:
let
inherit (lib) mkEnableOption mkOption types isDerivation hasAttr ;
in {
options = {
boot = {
};
hardware = {
dts = {
2023-08-07 22:43:12 +02:00
src = mkOption {
type = types.nullOr types.path;
description = ''
If the device requires an external device tree to be loaded
alongside the kernel, this is the path to the device tree source
(we usually get these from OpenWrt). This value may be null if the
platform creates the device tree - currently this is the case
only for QEMU.
'';
2023-08-07 22:43:12 +02:00
};
includes = mkOption {
default = [];
2023-08-07 22:43:12 +02:00
description = "List of directories to search for DTS includes (.dtsi files)";
type = types.listOf types.path;
};
};
defaultOutput = mkOption {
2023-12-11 20:02:30 +01:00
description = "\"Default\" output: what gets built for this device when outputs.default is requested. Typically this is \"mtdimage\" or \"vmroot\"";
type = types.nonEmptyStr;
};
ram = {
startAddress = mkOption {
type = types.int;
};
};
flash = {
2023-03-07 23:03:31 +01:00
# start address and size of whichever partition (often
# called "firmware") we're going to overwrite with our
# kernel uimage and root fs. Not the entire flash, as
# that often also contains the bootloader, data for
# for wireless devices, etc
2023-08-07 22:43:12 +02:00
address = mkOption {
description = ''
Start address of whichever partition (often
called "firmware") we're going to overwrite with our
kernel uimage and root fs. Usually not the entire flash, as
we don't want to clobber the bootloader, calibration data etc
'';
2023-11-12 21:39:06 +01:00
type = types.ints.unsigned;
2023-08-07 22:43:12 +02:00
};
size = mkOption {
2023-11-12 21:39:06 +01:00
type = types.ints.unsigned;
2023-08-07 22:43:12 +02:00
description = "Size in bytes of the firmware partition";
};
eraseBlockSize = mkOption {
description = "Flash erase block size in bytes";
2023-11-12 21:39:06 +01:00
type = types.ints.unsigned;
2023-08-07 22:43:12 +02:00
};
};
2023-11-12 19:47:31 +01:00
loadAddress = mkOption { type = types.ints.unsigned; default = null; };
2023-11-12 19:50:47 +01:00
entryPoint = mkOption { type = types.ints.unsigned; };
2024-02-27 20:47:46 +01:00
alignment = mkOption { type = types.nullOr types.ints.unsigned; default = null; description = "Alignment passed to `mkimage` for FIT"; };
radios = mkOption {
2023-08-07 22:43:12 +02:00
description = ''
Kernel modules (from mac80211 package) required for the
wireless devices on this board
'';
type = types.listOf types.str;
default = [];
example = ["ath9k" "ath10k"];
};
rootDevice = mkOption {
description = "Full path to preferred root device";
type = types.str;
example = "/dev/mtdblock3";
};
alternativeRootDevice = mkOption {
description = "Full path to alternative preferred root device (the B partition of your rootfs)";
type = types.nullOr types.str;
example = "ubi_b:rootfs";
default = null;
};
ubi.mtds = mkOption {
description = "List of MTD device to attach";
type = types.listOf types.str;
example = [ "ubi_a" "ubi_b" "data" ];
default = [ ];
};
networkInterfaces = mkOption {
type = types.attrsOf types.anything;
};
};
};
}