From ed030704d28ee4723cba93a9e8cd817230e94eb6 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 11 Feb 2019 19:05:33 +0800 Subject: [PATCH] nix: place board binaries where artiq_flash looks for them --- nix/artiq-board.nix | 14 ++++++++------ nix/conda-board.nix | 7 ++----- nix/release.nix | 8 ++++++-- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/nix/artiq-board.nix b/nix/artiq-board.nix index 944044ecb..b6a8a4091 100644 --- a/nix/artiq-board.nix +++ b/nix/artiq-board.nix @@ -2,6 +2,7 @@ # nix.sandboxPaths = ["/opt"]; { pkgs ? import {}}: +{ target, variant }: let artiqPkgs = import ./default.nix { inherit pkgs; }; @@ -41,18 +42,19 @@ let buildenv = import ./artiq-dev.nix { inherit pkgs; }; in pkgs.stdenv.mkDerivation { - name = "artiq-board-kasli-tester"; + name = "artiq-board-${target}-${variant}"; src = null; phases = [ "buildPhase" "installPhase" ]; buildPhase = '' - ${buildenv}/bin/artiq-dev -c "CARGO_HOME=${cargoVendored} python -m artiq.gateware.targets.kasli -V tester" + ${buildenv}/bin/artiq-dev -c "CARGO_HOME=${cargoVendored} python -m artiq.gateware.targets.${target} -V ${variant} --gateware-toolchain-path /home/sb/opt/Xilinx/Vivado" ''; installPhase = '' - mkdir $out - cp artiq_kasli/tester/gateware/top.bit $out - cp artiq_kasli/tester/software/bootloader/bootloader.bin $out - cp artiq_kasli/tester/software/runtime/runtime.{elf,fbi} $out + TARGET_DIR=$out/${pkgs.python3Packages.python.sitePackages}/artiq/binaries/${target}-${variant} + mkdir -p $TARGET_DIR + cp artiq_${target}/${variant}/gateware/top.bit $TARGET_DIR + cp artiq_${target}/${variant}/software/bootloader/bootloader.bin $TARGET_DIR + cp artiq_${target}/${variant}/software/runtime/runtime.{elf,fbi} $TARGET_DIR ''; } diff --git a/nix/conda-board.nix b/nix/conda-board.nix index 51775887d..7f222f6c8 100644 --- a/nix/conda-board.nix +++ b/nix/conda-board.nix @@ -1,12 +1,9 @@ { pkgs ? import {}}: -{ artiqSrc, boardBinaries }: +{ artiqSrc, boardBinaries, target, variant }: with pkgs; let - target = "kasli"; - variant = "tester"; - fakeCondaSource = runCommand "fake-conda-source-${target}-${variant}" { } '' cp --no-preserve=mode,ownership -R ${artiqSrc} $out @@ -47,7 +44,7 @@ let set -e SOC_PREFIX=\$PREFIX/site-packages/artiq/binaries/${target}-${variant} mkdir -p \$SOC_PREFIX - cp ${boardBinaries}/* \$SOC_PREFIX + cp ${boardBinaries}/${pkgs.python3Packages.python.sitePackages}/artiq/binaries/${target}-${variant}/* \$SOC_PREFIX EOF chmod 755 $out/fake-conda/build.sh ''; diff --git a/nix/release.nix b/nix/release.nix index ba91ff029..56023fe63 100644 --- a/nix/release.nix +++ b/nix/release.nix @@ -1,17 +1,21 @@ { pkgs ? import {}}: let artiqPkgs = import ./default.nix { inherit pkgs; }; - artiq-board-kasli-tester = import ./artiq-board.nix { inherit pkgs; }; jobs = rec { conda-artiq = import ./conda-build.nix { inherit pkgs; } { name = "conda-artiq"; src = ../.; recipe = "conda/artiq"; }; - inherit artiq-board-kasli-tester; + artiq-board-kasli-tester = import ./artiq-board.nix { inherit pkgs; } { + target = "kasli"; + variant = "tester"; + }; conda-artiq-board-kasli-tester = import ./conda-board.nix { inherit pkgs; } { artiqSrc = ../.; boardBinaries = artiq-board-kasli-tester; + target = "kasli"; + variant = "tester"; }; } // artiqPkgs; in