Bake the git commit inside the uboot env file

This commit is contained in:
Rodrigo Arias 2024-07-03 13:58:18 +02:00
parent 2442bdf3f5
commit 7c25f76f8b

View File

@ -1,4 +1,4 @@
{ config, lib, pkgs, modulesPath, ... }: { config, lib, pkgs, modulesPath, self, ... }:
{ {
imports = [ imports = [
@ -175,8 +175,12 @@
uboot-env = let uboot-env = let
init = "${config.system.build.toplevel}/init"; init = "${config.system.build.toplevel}/init";
initrd = "${config.system.build.initialRamdisk}/initrd"; initrd = "${config.system.build.initialRamdisk}/initrd";
rev = if self ? rev then self.rev
else throw ("Refusing to build from a dirty Git tree!");
in prev.runCommand "uboot.txt" {} '' in prev.runCommand "uboot.txt" {} ''
cat > $out <<EOF cat > $out <<EOF
# Git commit: ${rev}
# Create pmem of 3 GiB [0x140000000, 0x200000000) # Create pmem of 3 GiB [0x140000000, 0x200000000)
fdt mknode / pmem@0x140000000 fdt mknode / pmem@0x140000000
fdt set /pmem@0x140000000 compatible "pmem-region" fdt set /pmem@0x140000000 compatible "pmem-region"