Skip to content

Commit

Permalink
Fix cross-compilation issue with xmlstarlet
Browse files Browse the repository at this point in the history
  • Loading branch information
danielfullmer committed Jan 11, 2023
1 parent c9ad9b2 commit a6079bc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions modules/devices.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,16 @@ in {
"esp" # L4TLauncher
];
xpathMatch = lib.concatMapStringsSep " or " (p: "@name = \"${p}\"") partitionsToRemove;
filterPartitions = basefile: pkgs.runCommand "flash.xml" { nativeBuildInputs = [ pkgs.xmlstarlet ]; } ''
# It's unclear why cross-compiles appear to need pkgs.buildPackages.xmlstarlet instead of just xmlstarlet in nativeBuildInputs
filterPartitions = basefile: pkgs.runCommand "flash.xml" { nativeBuildInputs = [ pkgs.buildPackages.xmlstarlet ]; } ''
xmlstarlet ed -d '//partition[${xpathMatch}]' ${basefile} >$out
'';
in mkMerge [
(mkIf (cfg.som == "orin-agx") {
targetBoard = mkDefault "jetson-agx-orin-devkit";
# We don't flash the sdmmc with kernel/initrd/etc at all. Just let it be a
# regular NixOS machine instead of having some weird partition structure.
partitionTemplate = mkDefault (pkgs.runCommand "flash.xml" { nativeBuildInputs = [ pkgs.xmlstarlet ]; } ''
partitionTemplate = mkDefault (pkgs.runCommand "flash.xml" { nativeBuildInputs = [ pkgs.buildPackages.xmlstarlet ]; } ''
xmlstarlet ed -d '//device[@type="sdmmc_user"]' \
${pkgs.nvidia-jetpack.bspSrc}/bootloader/t186ref/cfg/flash_t234_qspi_sdmmc.xml \
>$out
Expand All @@ -73,7 +74,7 @@ in {
"esp" # L4TLauncher
];
xpathMatch = lib.concatMapStringsSep " or " (p: "@name = \"${p}\"") partitionsToRemove;
in mkDefault (pkgs.runCommand "flash.xml" { nativeBuildInputs = [ pkgs.xmlstarlet ]; } ''
in mkDefault (pkgs.runCommand "flash.xml" { nativeBuildInputs = [ pkgs.buildPackages.xmlstarlet ]; } ''
xmlstarlet ed -d '//partition[${xpathMatch}]' \
${pkgs.nvidia-jetpack.bspSrc}/bootloader/t186ref/cfg/flash_t194_sdmmc.xml \
>$out
Expand Down

0 comments on commit a6079bc

Please sign in to comment.