From 157993ad92afa9d759f01be23a7bf13a62adc758 Mon Sep 17 00:00:00 2001 From: Daniel Fullmer Date: Tue, 20 Aug 2024 17:13:24 -0700 Subject: [PATCH 1/2] Add pre/post hooks to custom phases --- modules/default.nix | 4 ++++ pkgs/board-automation/default.nix | 4 ++++ pkgs/cuda-packages/default.nix | 4 ++++ pkgs/flash-tools/default.nix | 4 ++++ pkgs/jetson-benchmarks/default.nix | 4 ++++ pkgs/l4t/default.nix | 4 ++++ pkgs/ota-utils/default.nix | 4 ++++ 7 files changed, 28 insertions(+) diff --git a/modules/default.nix b/modules/default.nix index c724203e..ad161b54 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -235,9 +235,13 @@ in name = "l4t-core-wrapper"; phases = [ "installPhase" ]; installPhase = '' + runHook preInstall + mkdir -p $out/lib ln -s ${l4t-core}/lib/libnvrm_gpu.so $out/lib/libnvrm_gpu.so ln -s ${l4t-core}/lib/libnvrm_mem.so $out/lib/libnvrm_mem.so + + runHook postInstall ''; }; in diff --git a/pkgs/board-automation/default.nix b/pkgs/board-automation/default.nix index 4bc09cb5..0149566c 100644 --- a/pkgs/board-automation/default.nix +++ b/pkgs/board-automation/default.nix @@ -27,7 +27,11 @@ stdenv.mkDerivation { ''; installPhase = '' + runHook preInstall + mkdir -p $out/bin cp tools/board_automation/* $out/bin + + runHook postInstall ''; } diff --git a/pkgs/cuda-packages/default.nix b/pkgs/cuda-packages/default.nix index a36232fa..5338d484 100644 --- a/pkgs/cuda-packages/default.nix +++ b/pkgs/cuda-packages/default.nix @@ -152,7 +152,11 @@ let ''; installPhase = '' + runHook preInstall + cp -r . $out + + runHook postInstall ''; meta = { diff --git a/pkgs/flash-tools/default.nix b/pkgs/flash-tools/default.nix index f1119ed8..6c84f4e6 100644 --- a/pkgs/flash-tools/default.nix +++ b/pkgs/flash-tools/default.nix @@ -94,8 +94,12 @@ let noDumpEnvVars = true; installPhase = '' + runHook preInstall + mkdir -p $out cp -r . $out/ + + runHook postInstall ''; # Stuff to put into PATH for flash.sh diff --git a/pkgs/jetson-benchmarks/default.nix b/pkgs/jetson-benchmarks/default.nix index 3a68d2a2..4f3a756d 100644 --- a/pkgs/jetson-benchmarks/default.nix +++ b/pkgs/jetson-benchmarks/default.nix @@ -95,6 +95,8 @@ stdenvNoCC.mkDerivation { substituteInPlace utils/utilities.py --replace "/usr/src/tensorrt" "${cudaPackages.tensorrt}" ''; installPhase = '' + runHook preInstall + mkdir -p models cp -r $models/. models @@ -104,6 +106,8 @@ stdenvNoCC.mkDerivation { mkdir -p $out/bin cp -r ${./scripts}/. $out/bin chmod +x $out/bin/* + + runHook postInstall ''; postFixup = '' wrapProgram $out/bin/run-jetson-benchmarks \ diff --git a/pkgs/l4t/default.nix b/pkgs/l4t/default.nix index 851ab9c5..4dac7081 100644 --- a/pkgs/l4t/default.nix +++ b/pkgs/l4t/default.nix @@ -84,7 +84,11 @@ let ''; installPhase = '' + runHook preInstall + cp -r . $out + + runHook postInstall ''; meta = { diff --git a/pkgs/ota-utils/default.nix b/pkgs/ota-utils/default.nix index f3374f42..1ae85711 100644 --- a/pkgs/ota-utils/default.nix +++ b/pkgs/ota-utils/default.nix @@ -10,6 +10,8 @@ stdenvNoCC.mkDerivation { dontBuild = true; installPhase = '' + runHook preInstall + mkdir -p $out/bin $out/share cp ${./ota-setup-efivars.sh} $out/bin/ota-setup-efivars cp ${./ota-apply-capsule-update.sh} $out/bin/ota-apply-capsule-update @@ -28,5 +30,7 @@ stdenvNoCC.mkDerivation { # patchShebangs does not seem to work here for some reason substituteInPlace $out/bin/* --replace '#!/usr/bin/env bash' '#!${bash}/bin/bash' + + runHook postInstall ''; } From 9d718ce9f889a11a5e9060b59b86e3a7df8b1967 Mon Sep 17 00:00:00 2001 From: Daniel Fullmer Date: Tue, 20 Aug 2024 17:14:27 -0700 Subject: [PATCH 2/2] Improve message for OTA updates --- pkgs/ota-utils/ota-apply-capsule-update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/ota-utils/ota-apply-capsule-update.sh b/pkgs/ota-utils/ota-apply-capsule-update.sh index c15ce421..eb60644c 100644 --- a/pkgs/ota-utils/ota-apply-capsule-update.sh +++ b/pkgs/ota-utils/ota-apply-capsule-update.sh @@ -22,6 +22,6 @@ sync /boot/EFI/UpdateCapsule/TEGRA_BL.Cap set_efi_var OsIndications-8be4df61-93ca-11d2-aa0d-00e098032b8c "\x07\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00" -echo "New Jetson firmware will be applied during the next reboot." +echo "An update for Jetson firmware will be applied during the next reboot." echo "The next reboot may take an extra 5 minutes or so." echo "Do not disconnect power during the reboot, or the firmware upgrade will not be applied"