liminix

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

default.nix (2275B)


      1 ## Boot blessing via Zyxel
      2 ## =======================
      3 ## Boot blessing is the process to bless a particular boot configuration
      4 ## It is commonly encountered in devices with redundant partitions
      5 ## for automatic recovery of broken upgrades.
      6 ## This is also known as A/B schemas, where A represents the primary partition
      7 ## and B the secondary partition used for recovery.
      8 ## To use boot blessing on Liminix, you need to have the support of
      9 ## your bootloader to help you boot on the secondary partition in case of
     10 ## failure on the primary partition. The exact details are specifics to your device.
     11 ## See the Zyxel NWA50AX for an example.
     12 ## TODO: generalize this module.
     13 { config, lib, pkgs, ... }:
     14 let
     15   inherit (lib) mkOption types;
     16   inherit (pkgs) liminix;
     17 in
     18 {
     19   options.boot.zyxel-dual-image = mkOption {
     20     type = liminix.lib.types.serviceDefn;
     21   };
     22 
     23   config.boot.zyxel-dual-image = liminix.callService ./service.nix {
     24     ensureActiveImage = mkOption {
     25       type = types.enum [ "primary" "secondary" ];
     26       default = "primary";
     27       description = ''At boot, ensure that the active image is the one specified.
     28 
     29         If you are already on a broken image, you need to manually boot
     30         into the right image via `atgo <image index>` in U-Boot.
     31       '';
     32     };
     33 
     34     kernelCommandLineSource = mkOption {
     35       type = types.enum [ "/proc/cmdline" "/proc/device-tree/chosen/bootargs" ];
     36       default = "/proc/device-tree/chosen/bootargs";
     37       description = ''Kernel command line arguments source file.
     38         On MIPS, Liminix embeds the kernel command line in /proc/device-tree/chosen/bootargs-override.
     39 
     40         In this instance, it does not get concatenated with `/proc/cmdline`.
     41         Therefore you may prefer to source it from another place, like `/proc/device-tree/chosen/bootargs`.
     42       '';
     43     };
     44 
     45     primaryMtdPartition = mkOption {
     46       type = types.str;
     47       description = "Primary MTD partition device node, i.e. for image 0.";
     48     };
     49 
     50     secondaryMtdPartition = mkOption {
     51       type = types.str;
     52       description = "Secondary MTD partition device node, i.e. for image 1.";
     53     };
     54 
     55     bootConfigurationMtdPartition = mkOption {
     56       type = types.str;
     57       description = "Boot configuration MTD partition device node.";
     58     };
     59   };
     60 }