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`
|
|
|
|
|
|
|
|
|
2023-03-03 21:04:39 +01:00
|
|
|
{ lib, pkgs, config, ...}:
|
|
|
|
let
|
|
|
|
inherit (lib) mkEnableOption mkOption types isDerivation hasAttr ;
|
|
|
|
in {
|
|
|
|
options = {
|
|
|
|
boot = {
|
2023-03-03 23:43:44 +01:00
|
|
|
};
|
2023-03-03 23:52:33 +01:00
|
|
|
hardware = {
|
2023-03-03 21:04:39 +01:00
|
|
|
dts = {
|
2023-08-07 22:43:12 +02:00
|
|
|
src = mkOption {
|
2023-12-09 16:51:30 +01:00
|
|
|
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
|
|
|
};
|
2023-03-03 21:04:39 +01:00
|
|
|
includes = mkOption {
|
|
|
|
default = [];
|
2023-08-07 22:43:12 +02:00
|
|
|
description = "List of directories to search for DTS includes (.dtsi files)";
|
2023-03-03 21:04:39 +01:00
|
|
|
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\"";
|
2023-03-03 21:04:39 +01:00
|
|
|
type = types.nonEmptyStr;
|
|
|
|
};
|
2023-11-05 16:11:58 +01:00
|
|
|
ram = {
|
|
|
|
startAddress = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-03-03 21:04:39 +01:00
|
|
|
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-03-03 21:04:39 +01: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"; };
|
2023-03-03 21:04:39 +01:00
|
|
|
radios = mkOption {
|
2023-08-07 22:43:12 +02:00
|
|
|
description = ''
|
|
|
|
Kernel modules (from mac80211 package) required for the
|
|
|
|
wireless devices on this board
|
|
|
|
'';
|
2023-03-03 21:04:39 +01:00
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [];
|
|
|
|
example = ["ath9k" "ath10k"];
|
|
|
|
};
|
2024-02-02 20:50:13 +01:00
|
|
|
rootDevice = mkOption {
|
|
|
|
description = "Full path to preferred root device";
|
|
|
|
type = types.str;
|
|
|
|
example = "/dev/mtdblock3";
|
|
|
|
};
|
2024-04-21 17:26:31 +02:00
|
|
|
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" ];
|
2024-08-23 19:37:43 +02:00
|
|
|
default = [ ];
|
2024-04-21 17:26:31 +02:00
|
|
|
};
|
2023-03-03 21:04:39 +01:00
|
|
|
networkInterfaces = mkOption {
|
|
|
|
type = types.attrsOf types.anything;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|