liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

hardware.nix (3060B)


      1 ## Hardware-dependent options
      2 ## ==========================
      3 ##
      4 ## These are attributes of the hardware not of the application
      5 ## you want to run on it, and would usually be set in the "device" file:
      6 ## :file:`devices/manuf-model/default.nix`
      7 
      8 
      9 { lib, pkgs, config, ...}:
     10 let
     11   inherit (lib) mkEnableOption mkOption types isDerivation hasAttr ;
     12 in {
     13   options = {
     14     boot = {
     15     };
     16     hardware = {
     17       dts = {
     18         src = mkOption {
     19           type = types.nullOr types.path;
     20           description = ''
     21             If the device requires an external device tree to be loaded
     22             alongside the kernel, this is the path to the device tree source
     23             (we usually get these from OpenWrt). This value may be null if the
     24             platform creates the device tree - currently this is the case
     25             only for QEMU.
     26           '';
     27         };
     28         includes = mkOption {
     29           default = [];
     30           description = "List of directories to search for DTS includes (.dtsi files)";
     31           type = types.listOf types.path;
     32         };
     33       };
     34       defaultOutput = mkOption {
     35         description = "\"Default\" output: what gets built for this device when outputs.default is requested. Typically this is \"mtdimage\" or \"vmroot\"";
     36         type = types.nonEmptyStr;
     37       };
     38       ram = {
     39         startAddress = mkOption {
     40           type = types.int;
     41         };
     42       };
     43 
     44       flash = {
     45         # start address and size of whichever partition (often
     46         # called "firmware") we're going to overwrite with our
     47         # kernel uimage and root fs. Not the entire flash, as
     48         # that often also contains the bootloader, data for
     49         # for wireless devices, etc
     50         address = mkOption {
     51           description = ''
     52             Start address of whichever partition (often
     53             called "firmware") we're going to overwrite with our
     54             kernel uimage and root fs. Usually not the entire flash, as
     55             we don't want to clobber the bootloader, calibration data etc
     56           '';
     57           type = types.ints.unsigned;
     58         };
     59         size = mkOption {
     60           type = types.ints.unsigned;
     61           description = "Size in bytes of the firmware partition";
     62         };
     63         eraseBlockSize = mkOption {
     64           description = "Flash erase block size in bytes";
     65           type = types.ints.unsigned;
     66         };
     67       };
     68       loadAddress = mkOption { type = types.ints.unsigned; default = null; };
     69       entryPoint = mkOption { type = types.ints.unsigned; };
     70       radios = mkOption {
     71         description = ''
     72           Kernel modules (from mac80211 package) required for the
     73           wireless devices on this board
     74         '';
     75         type = types.listOf types.str;
     76         default = [];
     77         example = ["ath9k" "ath10k"];
     78       };
     79       rootDevice = mkOption {
     80         description = "Full path to preferred root device";
     81         type = types.str;
     82         example = "/dev/mtdblock3";
     83       };
     84       networkInterfaces = mkOption {
     85         type = types.attrsOf types.anything;
     86       };
     87     };
     88   };
     89 }