commit dde8386f7583cbb4145b9b484c39c737cb3c1578
parent c59364d6239c6e7f514a22289498d484a5d433f9
Author: Raito Bezarius <masterancpp@gmail.com>
Date: Mon, 4 Dec 2023 14:07:30 +0100
builders/uimage: support aligning the FIT
This is necessary when writing to a MTD partition with a certain erasesize.
Diffstat:
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/modules/hardware.nix b/modules/hardware.nix
@@ -67,6 +67,7 @@ in {
};
loadAddress = mkOption { type = types.ints.unsigned; default = null; };
entryPoint = mkOption { type = types.ints.unsigned; };
+ alignment = mkOption { type = types.ints.unsigned; default = null; description = "Alignment passed to `mkimage` for FIT"; };
radios = mkOption {
description = ''
Kernel modules (from mac80211 package) required for the
diff --git a/modules/outputs.nix b/modules/outputs.nix
@@ -111,7 +111,7 @@ in
};
uimage = liminix.builders.uimage {
commandLine = concatStringsSep " " config.boot.commandLine;
- inherit (config.hardware) loadAddress entryPoint;
+ inherit (config.hardware) loadAddress entryPoint alignment;
inherit (config.boot) imageFormat;
inherit (o) kernel dtb;
};
diff --git a/pkgs/kernel/uimage.nix b/pkgs/kernel/uimage.nix
@@ -20,6 +20,7 @@ in {
, extraName ? "" # e.g. socFamily
, loadAddress
, imageFormat
+, alignment ? null
, dtb ? null
} : stdenv.mkDerivation {
name = "kernel.image";
@@ -70,7 +71,7 @@ in {
};
};
_VARS
- mkimage -f mkimage.its kernel.uimage
+ mkimage -f mkimage.its ${lib.optionalString (alignment != null) "-B 0x${lib.toHexString alignment}"} kernel.uimage
mkimage -l kernel.uimage
'';