From 5208cb3ebd0c5396e4eb43be51ee589cd048c583 Mon Sep 17 00:00:00 2001 From: Josh Hoffer Date: Mon, 3 Jun 2024 11:02:42 -0700 Subject: [PATCH] Apply nixpkgs-fmt --- device-pkgs/default.nix | 74 ++++++++++++------------ modules/flash-script.nix | 18 +++--- pkgs/optee-ftpm_manufacturer/default.nix | 11 ++-- 3 files changed, 51 insertions(+), 52 deletions(-) diff --git a/device-pkgs/default.nix b/device-pkgs/default.nix index acd0107..419cd60 100644 --- a/device-pkgs/default.nix +++ b/device-pkgs/default.nix @@ -95,20 +95,20 @@ let # Needed for signing inherit (cfg.firmware.secureBoot) requiredSystemFeatures; } '' - export BOARDID=${variant.boardid} - export BOARDSKU=${variant.boardsku} - export FAB=${variant.fab} - export BOARDREV=${variant.boardrev} - ${lib.optionalString (variant.chipsku != null) '' - export CHIP_SKU=${toString variant.chipsku} - ''} - export CHIPREV=${variant.chiprev} + export BOARDID=${variant.boardid} + export BOARDSKU=${variant.boardsku} + export FAB=${variant.fab} + export BOARDREV=${variant.boardrev} + ${lib.optionalString (variant.chipsku != null) '' + export CHIP_SKU=${toString variant.chipsku} + ''} + export CHIPREV=${variant.chiprev} - ${cfg.firmware.secureBoot.preSignCommands} + ${cfg.firmware.secureBoot.preSignCommands} - ${mkFlashScript (args // { flashArgs = [ "--no-root-check" "--no-flash" ] ++ (args.flashArgs or flashArgs); }) } + ${mkFlashScript (args // { flashArgs = [ "--no-root-check" "--no-flash" ] ++ (args.flashArgs or flashArgs); }) } - cp -r ./ $out + cp -r ./ $out ''; # TODO: Do we also need these? Set in l4t_create_images_for_kernel_flash.sh # export RAMCODE_ID @@ -216,32 +216,32 @@ let (mkFlashScript { flashCommands = cfg.firmware.secureBoot.preSignCommands + lib.concatMapStringsSep "\n" (v: with v; '' - BOARDID=${boardid} BOARDSKU=${boardsku} FAB=${fab} BOARDREV=${boardrev} FUSELEVEL=${fuselevel} CHIPREV=${chiprev} ${lib.optionalString (chipsku != null) "CHIP_SKU=${builtins.toString chipsku}"} ./flash.sh ${lib.optionalString (partitionTemplate != null) "-c flash.xml"} --no-root-check --no-flash --sign ${builtins.toString flashArgs} - - # TODO: ideally we would add chipsku to the boardspec for flashFromDevice to match against but - # tegra-boardspec does not read the chipsku from EEPROM so we cannot match against it. - # The CHIP_SKU only determines BPFFILE which is the same within a given SOM family (orin-nx, orin-nano, etc.); - # since we already seperate Orin NX and Orin Nano, we don't have to worry about using incorrect BPFFILE. - outdir=$out/${boardid}-${fab}-${boardsku}-${boardrev}-${if fuselevel == "fuselevel_production" then "1" else "0"}-${chiprev}-- - mkdir -p $outdir - - cp -v bootloader/signed/flash.idx $outdir/ - - # Copy files referenced by flash.idx - while IFS=", " read -r partnumber partloc start_location partsize partfile partattrs partsha; do - if [[ "$partfile" != "" ]]; then - if [[ -f "bootloader/signed/$partfile" ]]; then - cp -v "bootloader/signed/$partfile" $outdir/ - elif [[ -f "bootloader/$partfile" ]]; then - cp -v "bootloader/$partfile" $outdir/ - else - echo "Unable to find $partfile" - exit 1 - fi - fi - done < bootloader/signed/flash.idx - - rm -rf bootloader/signed + BOARDID=${boardid} BOARDSKU=${boardsku} FAB=${fab} BOARDREV=${boardrev} FUSELEVEL=${fuselevel} CHIPREV=${chiprev} ${lib.optionalString (chipsku != null) "CHIP_SKU=${builtins.toString chipsku}"} ./flash.sh ${lib.optionalString (partitionTemplate != null) "-c flash.xml"} --no-root-check --no-flash --sign ${builtins.toString flashArgs} + + # TODO: ideally we would add chipsku to the boardspec for flashFromDevice to match against but + # tegra-boardspec does not read the chipsku from EEPROM so we cannot match against it. + # The CHIP_SKU only determines BPFFILE which is the same within a given SOM family (orin-nx, orin-nano, etc.); + # since we already seperate Orin NX and Orin Nano, we don't have to worry about using incorrect BPFFILE. + outdir=$out/${boardid}-${fab}-${boardsku}-${boardrev}-${if fuselevel == "fuselevel_production" then "1" else "0"}-${chiprev}-- + mkdir -p $outdir + + cp -v bootloader/signed/flash.idx $outdir/ + + # Copy files referenced by flash.idx + while IFS=", " read -r partnumber partloc start_location partsize partfile partattrs partsha; do + if [[ "$partfile" != "" ]]; then + if [[ -f "bootloader/signed/$partfile" ]]; then + cp -v "bootloader/signed/$partfile" $outdir/ + elif [[ -f "bootloader/$partfile" ]]; then + cp -v "bootloader/$partfile" $outdir/ + else + echo "Unable to find $partfile" + exit 1 + fi + fi + done < bootloader/signed/flash.idx + + rm -rf bootloader/signed '') cfg.firmware.variants; }); diff --git a/modules/flash-script.nix b/modules/flash-script.nix index d3bc29e..c9c6b11 100644 --- a/modules/flash-script.nix +++ b/modules/flash-script.nix @@ -385,24 +385,24 @@ in ]; orin-agx = [ - { boardid = "3701"; boardsku = "0000"; fab = "300"; boardrev = ""; fuselevel = "fuselevel_production"; chiprev = ""; chipsku="00:00:00:D0"; } - { boardid = "3701"; boardsku = "0004"; fab = "300"; boardrev = ""; fuselevel = "fuselevel_production"; chiprev = ""; chipsku="00:00:00:D2"; } # 32GB - { boardid = "3701"; boardsku = "0005"; fab = "000"; boardrev = ""; fuselevel = "fuselevel_production"; chiprev = ""; chipsku="00:00:00:D0"; } # 64GB + { boardid = "3701"; boardsku = "0000"; fab = "300"; boardrev = ""; fuselevel = "fuselevel_production"; chiprev = ""; chipsku = "00:00:00:D0"; } + { boardid = "3701"; boardsku = "0004"; fab = "300"; boardrev = ""; fuselevel = "fuselevel_production"; chiprev = ""; chipsku = "00:00:00:D2"; } # 32GB + { boardid = "3701"; boardsku = "0005"; fab = "000"; boardrev = ""; fuselevel = "fuselevel_production"; chiprev = ""; chipsku = "00:00:00:D0"; } # 64GB ]; orin-agx-industrial = [ - { boardid = "3701"; boardsku = "0008"; fab = "300"; boardrev = ""; fuselevel = "fuselevel_production"; chiprev = ""; chipsku="00:00:00:90"; } + { boardid = "3701"; boardsku = "0008"; fab = "300"; boardrev = ""; fuselevel = "fuselevel_production"; chiprev = ""; chipsku = "00:00:00:90"; } ]; orin-nx = [ - { boardid = "3767"; boardsku = "0000"; fab = "000"; boardrev = ""; fuselevel = "fuselevel_production"; chiprev = ""; chipsku="00:00:00:D3";} # Orin NX 16GB - { boardid = "3767"; boardsku = "0001"; fab = "000"; boardrev = ""; fuselevel = "fuselevel_production"; chiprev = ""; chipsku="00:00:00:D4";} # Orin NX 8GB + { boardid = "3767"; boardsku = "0000"; fab = "000"; boardrev = ""; fuselevel = "fuselevel_production"; chiprev = ""; chipsku = "00:00:00:D3"; } # Orin NX 16GB + { boardid = "3767"; boardsku = "0001"; fab = "000"; boardrev = ""; fuselevel = "fuselevel_production"; chiprev = ""; chipsku = "00:00:00:D4"; } # Orin NX 8GB ]; orin-nano = [ - { boardid = "3767"; boardsku = "0003"; fab = "000"; boardrev = ""; fuselevel = "fuselevel_production"; chiprev = ""; chipsku="00:00:00:D5"; } # Orin Nano 8GB - { boardid = "3767"; boardsku = "0004"; fab = "000"; boardrev = ""; fuselevel = "fuselevel_production"; chiprev = ""; chipsku="00:00:00:D6"; } # Orin Nano 4GB - { boardid = "3767"; boardsku = "0005"; fab = "000"; boardrev = ""; fuselevel = "fuselevel_production"; chiprev = ""; chipsku="00:00:00:D5"; } # Orin Nano devkit module + { boardid = "3767"; boardsku = "0003"; fab = "000"; boardrev = ""; fuselevel = "fuselevel_production"; chiprev = ""; chipsku = "00:00:00:D5"; } # Orin Nano 8GB + { boardid = "3767"; boardsku = "0004"; fab = "000"; boardrev = ""; fuselevel = "fuselevel_production"; chiprev = ""; chipsku = "00:00:00:D6"; } # Orin Nano 4GB + { boardid = "3767"; boardsku = "0005"; fab = "000"; boardrev = ""; fuselevel = "fuselevel_production"; chiprev = ""; chipsku = "00:00:00:D5"; } # Orin Nano devkit module ]; }.${cfg.som} )) else lib.mkOptionDefault [ ]; diff --git a/pkgs/optee-ftpm_manufacturer/default.nix b/pkgs/optee-ftpm_manufacturer/default.nix index 0e369cd..000c497 100644 --- a/pkgs/optee-ftpm_manufacturer/default.nix +++ b/pkgs/optee-ftpm_manufacturer/default.nix @@ -1,9 +1,8 @@ -{ - opteeClient, - stdenvNoCC, - python3, - fetchFromGitHub, - openssl +{ opteeClient +, stdenvNoCC +, python3 +, fetchFromGitHub +, openssl }: let # Latest 1.5.1 release fails in x509.Name.build likely due