From db4f098c02f3597d6fe696fc9741a9c3824e0505 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Mon, 23 Dec 2024 11:21:58 +0000 Subject: [PATCH] add fit bootloader this is for the belkin rt3200, whose uboot doesn't do extlinux but can load a fit from a ubifs. It adds the a kernel+dtb as /boot/fit --- modules/outputs.nix | 1 + modules/outputs/boot-fit.nix | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 modules/outputs/boot-fit.nix diff --git a/modules/outputs.nix b/modules/outputs.nix index da5cdac..6da7daa 100644 --- a/modules/outputs.nix +++ b/modules/outputs.nix @@ -14,6 +14,7 @@ in ./outputs/squashfs.nix ./outputs/vmroot.nix ./outputs/boot-extlinux.nix + ./outputs/boot-fit.nix ./outputs/uimage.nix ./outputs/updater ]; diff --git a/modules/outputs/boot-fit.nix b/modules/outputs/boot-fit.nix new file mode 100644 index 0000000..cf998ba --- /dev/null +++ b/modules/outputs/boot-fit.nix @@ -0,0 +1,27 @@ +{ + config +, pkgs +, lib +, ... +}: +let + inherit (lib) mkIf mkEnableOption mkOption types concatStringsSep; + inherit (pkgs.pseudofile) dir symlink; + cfg = config.boot.loader.fit; + o = config.system.outputs; + cmdline = concatStringsSep " " config.boot.commandLine; + wantsDtb = config.hardware.dts ? src && config.hardware.dts.src != null; +in { + options.boot.loader.fit.enable = mkEnableOption "FIT in /boot"; + + config = mkIf cfg.enable { + system.outputs.bootfiles = pkgs.runCommand "boot-fit" {} '' + mkdir $out + cd $out + cp ${o.uimage} fit + ''; + filesystem = dir { + boot = symlink config.system.outputs.bootfiles; + }; + }; +}