forked from M-Labs/artiq
1
0
Fork 0

nix: place board binaries where artiq_flash looks for them

This commit is contained in:
Sebastien Bourdeauducq 2019-02-11 19:05:33 +08:00
parent c32bf770ab
commit ed030704d2
3 changed files with 16 additions and 13 deletions

View File

@ -2,6 +2,7 @@
# nix.sandboxPaths = ["/opt"];
{ pkgs ? import <nixpkgs> {}}:
{ 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
'';
}

View File

@ -1,12 +1,9 @@
{ pkgs ? import <nixpkgs> {}}:
{ 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
'';

View File

@ -1,17 +1,21 @@
{ pkgs ? import <nixpkgs> {}}:
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