From 62f116b3168e4064d4960c4ca59933f7f4276fd6 Mon Sep 17 00:00:00 2001 From: Daniel Fullmer Date: Sat, 7 Oct 2023 17:00:43 -0700 Subject: [PATCH] Move packages and patches into their own directories --- UPGRADE_CHECKLIST.md | 2 +- default.nix | 36 +++++++++---------- device-pkgs.nix => device-pkgs/default.nix | 0 .../flash-script.nix | 0 .../fuse-script.nix | 0 modules/flash-script.nix | 11 ++---- .../uefi-default-keys.dts | 0 .../board-automation/board-automation.patch | 0 .../board-automation/default.nix | 0 .../cuda-packages/default.nix | 0 vpi2.patch => pkgs/cuda-packages/vpi2.patch | 0 .../flash-from-device/default.nix | 2 +- .../flash-from-device/flash-from-device.sh | 0 .../flash-tools/default.nix | 0 .../flash-tools/flash-tools-secureboot.patch | 0 .../flash-tools/flash-tools.patch | 0 ...0001-disable-disruptive-system_check.patch | 0 .../jetson-benchmarks}/default.nix | 0 .../scripts/run-all-jetson-benchmarks | 0 .../scripts/run-jetson-benchmarks | 0 .../scripts/run-resnet-jetson-benchmarks | 0 l4t.nix => pkgs/l4t/default.nix | 0 ...repend-foo-bar-baz-to-TEEC_LOAD_PATH.patch | 0 .../0001-nvoptee-no-install-makefile.patch | 0 ...ro-status-code-on-TEEC_InvokeCommand.patch | 0 optee.nix => pkgs/optee/default.nix | 0 {ota-utils => pkgs/ota-utils}/default.nix | 0 .../ota-utils}/ota-apply-capsule-update.sh | 0 .../ota-utils}/ota-check-firmware.sh | 0 .../ota-utils}/ota-setup-efivars.sh | 0 .../ota-utils}/ota_helpers.func | 0 .../python-jetson/default.nix | 0 .../samples/cuda-samples.patch | 0 samples.nix => pkgs/samples/default.nix | 0 .../tegra-eeprom-tool/default.nix | 0 .../capsule-authentication.patch | 0 .../uefi-firmware/default.nix | 6 ++++ .../uefi-firmware/edk2-openssl-patches.nix | 0 .../uefi-firmware/edk2-uefi-dtb.patch | 0 39 files changed, 28 insertions(+), 29 deletions(-) rename device-pkgs.nix => device-pkgs/default.nix (100%) rename flash-script.nix => device-pkgs/flash-script.nix (100%) rename fuse-script.nix => device-pkgs/fuse-script.nix (100%) rename uefi-default-keys.dts => modules/uefi-default-keys.dts (100%) rename board-automation.patch => pkgs/board-automation/board-automation.patch (100%) rename board-automation.nix => pkgs/board-automation/default.nix (100%) rename cuda-packages.nix => pkgs/cuda-packages/default.nix (100%) rename vpi2.patch => pkgs/cuda-packages/vpi2.patch (100%) rename flash-from-device.nix => pkgs/flash-from-device/default.nix (92%) rename flash-from-device.sh => pkgs/flash-from-device/flash-from-device.sh (100%) rename flash-tools.nix => pkgs/flash-tools/default.nix (100%) rename flash-tools-secureboot.patch => pkgs/flash-tools/flash-tools-secureboot.patch (100%) rename flash-tools.patch => pkgs/flash-tools/flash-tools.patch (100%) rename {jetson-benchmarks => pkgs/jetson-benchmarks}/0001-disable-disruptive-system_check.patch (100%) rename {jetson-benchmarks => pkgs/jetson-benchmarks}/default.nix (100%) rename {jetson-benchmarks => pkgs/jetson-benchmarks}/scripts/run-all-jetson-benchmarks (100%) rename {jetson-benchmarks => pkgs/jetson-benchmarks}/scripts/run-jetson-benchmarks (100%) rename {jetson-benchmarks => pkgs/jetson-benchmarks}/scripts/run-resnet-jetson-benchmarks (100%) rename l4t.nix => pkgs/l4t/default.nix (100%) rename 0001-Don-t-prepend-foo-bar-baz-to-TEEC_LOAD_PATH.patch => pkgs/optee/0001-Don-t-prepend-foo-bar-baz-to-TEEC_LOAD_PATH.patch (100%) rename 0001-nvoptee-no-install-makefile.patch => pkgs/optee/0001-nvoptee-no-install-makefile.patch (100%) rename 0002-Exit-with-non-zero-status-code-on-TEEC_InvokeCommand.patch => pkgs/optee/0002-Exit-with-non-zero-status-code-on-TEEC_InvokeCommand.patch (100%) rename optee.nix => pkgs/optee/default.nix (100%) rename {ota-utils => pkgs/ota-utils}/default.nix (100%) rename {ota-utils => pkgs/ota-utils}/ota-apply-capsule-update.sh (100%) rename {ota-utils => pkgs/ota-utils}/ota-check-firmware.sh (100%) rename {ota-utils => pkgs/ota-utils}/ota-setup-efivars.sh (100%) rename {ota-utils => pkgs/ota-utils}/ota_helpers.func (100%) rename python-jetson.nix => pkgs/python-jetson/default.nix (100%) rename cuda-samples.patch => pkgs/samples/cuda-samples.patch (100%) rename samples.nix => pkgs/samples/default.nix (100%) rename tegra-eeprom-tool.nix => pkgs/tegra-eeprom-tool/default.nix (100%) rename capsule-authentication.patch => pkgs/uefi-firmware/capsule-authentication.patch (100%) rename uefi-firmware.nix => pkgs/uefi-firmware/default.nix (97%) rename edk2-openssl-patches.nix => pkgs/uefi-firmware/edk2-openssl-patches.nix (100%) rename edk2-uefi-dtb.patch => pkgs/uefi-firmware/edk2-uefi-dtb.patch (100%) diff --git a/UPGRADE_CHECKLIST.md b/UPGRADE_CHECKLIST.md index df290a98..6666b481 100644 --- a/UPGRADE_CHECKLIST.md +++ b/UPGRADE_CHECKLIST.md @@ -8,7 +8,7 @@ - [ ] Grep for "sha256 = ", see if there is anything else not covered - [ ] Grep for the previous version strings e.g. "35.3.1" - [ ] Compare files from `unpackedDebs` before and after -- [ ] Ensure the soc variants in device-pkgs.nix match those in jetson_board_spec.cfg from BSP +- [ ] Ensure the soc variants in device-pkgs/default.nix match those in jetson_board_spec.cfg from BSP - [ ] Ensure logic in ota-utils/ota_helpers.func matches nvidia-l4t-init/opt/nvidia/nv-l4t-bootloader-config.sh ### Testing diff --git a/default.nix b/default.nix index 8f31b1b5..2e7b830c 100644 --- a/default.nix +++ b/default.nix @@ -36,34 +36,34 @@ let ${lib.concatStringsSep "\n" (lib.mapAttrsToList (n: p: "echo Unpacking ${n}; dpkg -x ${p.src} $out/${n}") debs.t234)} ''; - inherit (pkgsAarch64.callPackages ./uefi-firmware.nix { inherit l4tVersion; }) + inherit (pkgsAarch64.callPackages ./pkgs/uefi-firmware { inherit l4tVersion; }) edk2-jetson uefi-firmware; - inherit (pkgsAarch64.callPackages ./optee.nix { + inherit (pkgsAarch64.callPackages ./pkgs/optee { # Nvidia's recommended toolchain is gcc9: # https://nv-tegra.nvidia.com/r/gitweb?p=tegra/optee-src/nv-optee.git;a=blob;f=optee/atf_and_optee_README.txt;h=591edda3d4ec96997e054ebd21fc8326983d3464;hb=5ac2ab218ba9116f1df4a0bb5092b1f6d810e8f7#l33 stdenv = pkgsAarch64.gcc9Stdenv; inherit bspSrc l4tVersion; }) buildTOS buildOpteeTaDevKit opteeClient; - flash-tools = callPackage ./flash-tools.nix { + flash-tools = callPackage ./pkgs/flash-tools { inherit bspSrc l4tVersion; }; - board-automation = callPackage ./board-automation.nix { + board-automation = callPackage ./pkgs/board-automation { inherit bspSrc l4tVersion; }; - python-jetson = python3.pkgs.callPackage ./python-jetson.nix { }; + python-jetson = python3.pkgs.callPackage ./pkgs/python-jetson { }; - tegra-eeprom-tool = pkgsAarch64.callPackage ./tegra-eeprom-tool.nix { }; - tegra-eeprom-tool-static = pkgsAarch64.pkgsStatic.callPackage ./tegra-eeprom-tool.nix { }; + tegra-eeprom-tool = pkgsAarch64.callPackage ./pkgs/tegra-eeprom-tool { }; + tegra-eeprom-tool-static = pkgsAarch64.pkgsStatic.callPackage ./pkgs/tegra-eeprom-tool { }; - l4t = callPackages ./l4t.nix { inherit debs l4tVersion; }; + l4t = callPackages ./pkgs/l4t { inherit debs l4tVersion; }; - cudaPackages = callPackages ./cuda-packages.nix { inherit debs cudaVersion autoAddOpenGLRunpathHook l4t; }; + cudaPackages = callPackages ./pkgs/cuda-packages { inherit debs cudaVersion autoAddOpenGLRunpathHook l4t; }; - samples = callPackages ./samples.nix { inherit debs cudaVersion autoAddOpenGLRunpathHook l4t cudaPackages; }; + samples = callPackages ./pkgs/samples { inherit debs cudaVersion autoAddOpenGLRunpathHook l4t cudaPackages; }; kernel = callPackage ./kernel { inherit (l4t) l4t-xusb-firmware; kernelPatches = []; }; kernelPackagesOverlay = self: super: { @@ -74,15 +74,15 @@ let rtkernel = callPackage ./kernel { inherit (l4t) l4t-xusb-firmware; kernelPatches = []; realtime = true; }; rtkernelPackages = (pkgs.linuxPackagesFor rtkernel).extend kernelPackagesOverlay; - nxJetsonBenchmarks = pkgs.callPackage ./jetson-benchmarks/default.nix { + nxJetsonBenchmarks = pkgs.callPackage ./pkgs/jetson-benchmarks { targetSom = "nx"; inherit cudaPackages; }; - xavierAgxJetsonBenchmarks = pkgs.callPackage ./jetson-benchmarks/default.nix { + xavierAgxJetsonBenchmarks = pkgs.callPackage ./pkgs/jetson-benchmarks { targetSom = "xavier-agx"; inherit cudaPackages; }; - orinAgxJetsonBenchmarks = pkgs.callPackage ./jetson-benchmarks/default.nix { + orinAgxJetsonBenchmarks = pkgs.callPackage ./pkgs/jetson-benchmarks { targetSom = "orin-agx"; inherit cudaPackages; }; @@ -105,16 +105,16 @@ let networking.hostName = "${c.som}-${c.carrierBoard}"; # Just so it sets the flash binary name. }) supportedConfigurations; - flashFromDevice = callPackage ./flash-from-device.nix { + flashFromDevice = callPackage ./pkgs/flash-from-device { inherit pkgsAarch64 tegra-eeprom-tool-static; }; - # Packages whose contents are paramterized by NixOS configuration - devicePkgsFromNixosConfig = callPackage ./device-pkgs.nix { + # Packages whose contents are parameterized by NixOS configuration + devicePkgsFromNixosConfig = callPackage ./device-pkgs { inherit l4tVersion pkgsAarch64 flash-tools flashFromDevice edk2-jetson uefi-firmware buildTOS buildOpteeTaDevKit opteeClient bspSrc; }; - otaUtils = callPackage ./ota-utils { + otaUtils = callPackage ./pkgs/ota-utils { inherit tegra-eeprom-tool l4tVersion; }; in rec { @@ -148,7 +148,7 @@ in rec { flash-generic = writeShellApplication { name = "flash-generic"; - text = callPackage ./flash-script.nix { + text = callPackage ./device-pkgs/flash-script.nix { inherit flash-tools uefi-firmware; flashCommands = '' ${runtimeShell} diff --git a/device-pkgs.nix b/device-pkgs/default.nix similarity index 100% rename from device-pkgs.nix rename to device-pkgs/default.nix diff --git a/flash-script.nix b/device-pkgs/flash-script.nix similarity index 100% rename from flash-script.nix rename to device-pkgs/flash-script.nix diff --git a/fuse-script.nix b/device-pkgs/fuse-script.nix similarity index 100% rename from fuse-script.nix rename to device-pkgs/fuse-script.nix diff --git a/modules/flash-script.nix b/modules/flash-script.nix index 4f2478e0..f9c64125 100644 --- a/modules/flash-script.nix +++ b/modules/flash-script.nix @@ -290,22 +290,15 @@ in export pkDefault=$(od -t x1 -An "${cfg.firmware.uefi.secureBoot.defaultPkEslFile}") export kekDefault=$(od -t x1 -An "${cfg.firmware.uefi.secureBoot.defaultKekEslFile}") export dbDefault=$(od -t x1 -An "${cfg.firmware.uefi.secureBoot.defaultDbEslFile}") - substituteAll ${../uefi-default-keys.dts} keys.dts + substituteAll ${./uefi-default-keys.dts} keys.dts dtc -I dts -O dtb keys.dts -o $out ''; in lib.optional cfg.firmware.uefi.secureBoot.enrollDefaultKeys uefiDefaultKeysDtbo; hardware.nvidia-jetpack.flashScriptOverrides.fuseArgs = lib.mkAfter [ cfg.flashScriptOverrides.configFileName ]; - hardware.nvidia-jetpack.firmware.uefi.edk2NvidiaPatches = [ - # Have UEFI use the device tree compiled into the firmware, instead of - # using one from the kernel-dtb partition. - # See: https://github.com/anduril/jetpack-nixos/pull/18 - ../edk2-uefi-dtb.patch - ]; - # These are from l4t_generate_soc_bup.sh, plus some additional ones found in the wild. - hardware.nvidia-jetpack.firmware.variants = lib.mkOptionDefault (rec { + hardware.nvidia-jetpack.firmware.variants = lib.mkOptionDefault ({ xavier-agx = [ { boardid="2888"; boardsku="0001"; fab="400"; boardrev="D.0"; fuselevel="fuselevel_production"; chiprev="2"; } { boardid="2888"; boardsku="0001"; fab="400"; boardrev="E.0"; fuselevel="fuselevel_production"; chiprev="2"; } # 16GB diff --git a/uefi-default-keys.dts b/modules/uefi-default-keys.dts similarity index 100% rename from uefi-default-keys.dts rename to modules/uefi-default-keys.dts diff --git a/board-automation.patch b/pkgs/board-automation/board-automation.patch similarity index 100% rename from board-automation.patch rename to pkgs/board-automation/board-automation.patch diff --git a/board-automation.nix b/pkgs/board-automation/default.nix similarity index 100% rename from board-automation.nix rename to pkgs/board-automation/default.nix diff --git a/cuda-packages.nix b/pkgs/cuda-packages/default.nix similarity index 100% rename from cuda-packages.nix rename to pkgs/cuda-packages/default.nix diff --git a/vpi2.patch b/pkgs/cuda-packages/vpi2.patch similarity index 100% rename from vpi2.patch rename to pkgs/cuda-packages/vpi2.patch diff --git a/flash-from-device.nix b/pkgs/flash-from-device/default.nix similarity index 92% rename from flash-from-device.nix rename to pkgs/flash-from-device/default.nix index 3f0b0a10..8fdf4945 100644 --- a/flash-from-device.nix +++ b/pkgs/flash-from-device/default.nix @@ -18,6 +18,6 @@ runCommand "flash-from-device" {} '' EOF cat ${./flash-from-device.sh} >> $out/bin/flash-from-device substituteInPlace $out/bin/flash-from-device \ - --replace "@ota_helpers_func@" "${./ota-utils/ota_helpers.func}" + --replace "@ota_helpers_func@" "${../ota-utils/ota_helpers.func}" chmod +x $out/bin/flash-from-device '' diff --git a/flash-from-device.sh b/pkgs/flash-from-device/flash-from-device.sh similarity index 100% rename from flash-from-device.sh rename to pkgs/flash-from-device/flash-from-device.sh diff --git a/flash-tools.nix b/pkgs/flash-tools/default.nix similarity index 100% rename from flash-tools.nix rename to pkgs/flash-tools/default.nix diff --git a/flash-tools-secureboot.patch b/pkgs/flash-tools/flash-tools-secureboot.patch similarity index 100% rename from flash-tools-secureboot.patch rename to pkgs/flash-tools/flash-tools-secureboot.patch diff --git a/flash-tools.patch b/pkgs/flash-tools/flash-tools.patch similarity index 100% rename from flash-tools.patch rename to pkgs/flash-tools/flash-tools.patch diff --git a/jetson-benchmarks/0001-disable-disruptive-system_check.patch b/pkgs/jetson-benchmarks/0001-disable-disruptive-system_check.patch similarity index 100% rename from jetson-benchmarks/0001-disable-disruptive-system_check.patch rename to pkgs/jetson-benchmarks/0001-disable-disruptive-system_check.patch diff --git a/jetson-benchmarks/default.nix b/pkgs/jetson-benchmarks/default.nix similarity index 100% rename from jetson-benchmarks/default.nix rename to pkgs/jetson-benchmarks/default.nix diff --git a/jetson-benchmarks/scripts/run-all-jetson-benchmarks b/pkgs/jetson-benchmarks/scripts/run-all-jetson-benchmarks similarity index 100% rename from jetson-benchmarks/scripts/run-all-jetson-benchmarks rename to pkgs/jetson-benchmarks/scripts/run-all-jetson-benchmarks diff --git a/jetson-benchmarks/scripts/run-jetson-benchmarks b/pkgs/jetson-benchmarks/scripts/run-jetson-benchmarks similarity index 100% rename from jetson-benchmarks/scripts/run-jetson-benchmarks rename to pkgs/jetson-benchmarks/scripts/run-jetson-benchmarks diff --git a/jetson-benchmarks/scripts/run-resnet-jetson-benchmarks b/pkgs/jetson-benchmarks/scripts/run-resnet-jetson-benchmarks similarity index 100% rename from jetson-benchmarks/scripts/run-resnet-jetson-benchmarks rename to pkgs/jetson-benchmarks/scripts/run-resnet-jetson-benchmarks diff --git a/l4t.nix b/pkgs/l4t/default.nix similarity index 100% rename from l4t.nix rename to pkgs/l4t/default.nix diff --git a/0001-Don-t-prepend-foo-bar-baz-to-TEEC_LOAD_PATH.patch b/pkgs/optee/0001-Don-t-prepend-foo-bar-baz-to-TEEC_LOAD_PATH.patch similarity index 100% rename from 0001-Don-t-prepend-foo-bar-baz-to-TEEC_LOAD_PATH.patch rename to pkgs/optee/0001-Don-t-prepend-foo-bar-baz-to-TEEC_LOAD_PATH.patch diff --git a/0001-nvoptee-no-install-makefile.patch b/pkgs/optee/0001-nvoptee-no-install-makefile.patch similarity index 100% rename from 0001-nvoptee-no-install-makefile.patch rename to pkgs/optee/0001-nvoptee-no-install-makefile.patch diff --git a/0002-Exit-with-non-zero-status-code-on-TEEC_InvokeCommand.patch b/pkgs/optee/0002-Exit-with-non-zero-status-code-on-TEEC_InvokeCommand.patch similarity index 100% rename from 0002-Exit-with-non-zero-status-code-on-TEEC_InvokeCommand.patch rename to pkgs/optee/0002-Exit-with-non-zero-status-code-on-TEEC_InvokeCommand.patch diff --git a/optee.nix b/pkgs/optee/default.nix similarity index 100% rename from optee.nix rename to pkgs/optee/default.nix diff --git a/ota-utils/default.nix b/pkgs/ota-utils/default.nix similarity index 100% rename from ota-utils/default.nix rename to pkgs/ota-utils/default.nix diff --git a/ota-utils/ota-apply-capsule-update.sh b/pkgs/ota-utils/ota-apply-capsule-update.sh similarity index 100% rename from ota-utils/ota-apply-capsule-update.sh rename to pkgs/ota-utils/ota-apply-capsule-update.sh diff --git a/ota-utils/ota-check-firmware.sh b/pkgs/ota-utils/ota-check-firmware.sh similarity index 100% rename from ota-utils/ota-check-firmware.sh rename to pkgs/ota-utils/ota-check-firmware.sh diff --git a/ota-utils/ota-setup-efivars.sh b/pkgs/ota-utils/ota-setup-efivars.sh similarity index 100% rename from ota-utils/ota-setup-efivars.sh rename to pkgs/ota-utils/ota-setup-efivars.sh diff --git a/ota-utils/ota_helpers.func b/pkgs/ota-utils/ota_helpers.func similarity index 100% rename from ota-utils/ota_helpers.func rename to pkgs/ota-utils/ota_helpers.func diff --git a/python-jetson.nix b/pkgs/python-jetson/default.nix similarity index 100% rename from python-jetson.nix rename to pkgs/python-jetson/default.nix diff --git a/cuda-samples.patch b/pkgs/samples/cuda-samples.patch similarity index 100% rename from cuda-samples.patch rename to pkgs/samples/cuda-samples.patch diff --git a/samples.nix b/pkgs/samples/default.nix similarity index 100% rename from samples.nix rename to pkgs/samples/default.nix diff --git a/tegra-eeprom-tool.nix b/pkgs/tegra-eeprom-tool/default.nix similarity index 100% rename from tegra-eeprom-tool.nix rename to pkgs/tegra-eeprom-tool/default.nix diff --git a/capsule-authentication.patch b/pkgs/uefi-firmware/capsule-authentication.patch similarity index 100% rename from capsule-authentication.patch rename to pkgs/uefi-firmware/capsule-authentication.patch diff --git a/uefi-firmware.nix b/pkgs/uefi-firmware/default.nix similarity index 97% rename from uefi-firmware.nix rename to pkgs/uefi-firmware/default.nix index 8c480135..5022f7dc 100644 --- a/uefi-firmware.nix +++ b/pkgs/uefi-firmware/default.nix @@ -64,7 +64,13 @@ let url = "https://github.com/NVIDIA/edk2-nvidia/commit/9604259b0d11c049f6a3eb5365a3ae10cfb9e6d9.patch"; hash = "sha256-IfnTrQnkxFXbeHDfmQd4Umpbp9MKZI1OKi7H1Ujg8K8="; }) + ./capsule-authentication.patch + + # Have UEFI use the device tree compiled into the firmware, instead of + # using one from the kernel-dtb partition. + # See: https://github.com/anduril/jetpack-nixos/pull/18 + ./edk2-uefi-dtb.patch ]; postPatch = lib.optionalString errorLevelInfo '' sed -i 's#PcdDebugPrintErrorLevel|.*#PcdDebugPrintErrorLevel|0x8000004F#' Platform/NVIDIA/NVIDIA.common.dsc.inc diff --git a/edk2-openssl-patches.nix b/pkgs/uefi-firmware/edk2-openssl-patches.nix similarity index 100% rename from edk2-openssl-patches.nix rename to pkgs/uefi-firmware/edk2-openssl-patches.nix diff --git a/edk2-uefi-dtb.patch b/pkgs/uefi-firmware/edk2-uefi-dtb.patch similarity index 100% rename from edk2-uefi-dtb.patch rename to pkgs/uefi-firmware/edk2-uefi-dtb.patch