From 3713545aca79365cba20d7873b6e51044890b4e8 Mon Sep 17 00:00:00 2001 From: Tristan Ross Date: Sun, 5 Jan 2025 08:24:39 -0800 Subject: [PATCH] starfive visionfive2: allow uboot and opensbi patches overrides --- starfive/visionfive/v2/firmware.nix | 32 +++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/starfive/visionfive/v2/firmware.nix b/starfive/visionfive/v2/firmware.nix index 06299de..b629115 100644 --- a/starfive/visionfive/v2/firmware.nix +++ b/starfive/visionfive/v2/firmware.nix @@ -5,15 +5,29 @@ in { options = { hardware.visionfive2 = { - opensbi.src = lib.mkOption { - description = "VisionFive2 OpenSBI source"; - type = lib.types.nullOr lib.types.package; - default = null; + opensbi = { + src = lib.mkOption { + description = "VisionFive2 OpenSBI source"; + type = lib.types.nullOr lib.types.package; + default = null; + }; + patches = lib.mkOption { + description = "List of patches to apply to the VisionFive2 OpenSBI source"; + type = lib.types.nullOr (lib.types.listOf lib.types.package); + default = null; + }; }; - uboot.src = lib.mkOption { - description = "VisionFive2 U-boot source"; - type = lib.types.nullOr lib.types.package; - default = null; + uboot = { + src = lib.mkOption { + description = "VisionFive2 U-boot source"; + type = lib.types.nullOr lib.types.package; + default = null; + }; + patches = lib.mkOption { + description = "List of patches to apply to the VisionFive2 U-boot source"; + type = lib.types.nullOr (lib.types.listOf lib.types.package); + default = null; + }; }; }; }; @@ -22,10 +36,12 @@ in system.build = { opensbi = (pkgs.callPackage ./opensbi.nix {}).overrideAttrs (f: p: { src = if cfg.opensbi.src != null then cfg.opensbi.src else p.src; + patches = if cfg.opensbi.patches != null then cfg.opensbi.patches else (p.patches or []); }); uboot = (pkgs.callPackage ./uboot.nix { inherit (config.system.build) opensbi; }).overrideAttrs (f: p: { src = if cfg.uboot.src != null then cfg.uboot.src else p.src; + patches = if cfg.uboot.patches != null then cfg.uboot.patches else (p.patches or []); }); updater-flash = pkgs.writeShellApplication {