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"]; # nix.sandboxPaths = ["/opt"];
{ pkgs ? import <nixpkgs> {}}: { pkgs ? import <nixpkgs> {}}:
{ target, variant }:
let let
artiqPkgs = import ./default.nix { inherit pkgs; }; artiqPkgs = import ./default.nix { inherit pkgs; };
@ -41,18 +42,19 @@ let
buildenv = import ./artiq-dev.nix { inherit pkgs; }; buildenv = import ./artiq-dev.nix { inherit pkgs; };
in pkgs.stdenv.mkDerivation { in pkgs.stdenv.mkDerivation {
name = "artiq-board-kasli-tester"; name = "artiq-board-${target}-${variant}";
src = null; src = null;
phases = [ "buildPhase" "installPhase" ]; phases = [ "buildPhase" "installPhase" ];
buildPhase = 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 = installPhase =
'' ''
mkdir $out TARGET_DIR=$out/${pkgs.python3Packages.python.sitePackages}/artiq/binaries/${target}-${variant}
cp artiq_kasli/tester/gateware/top.bit $out mkdir -p $TARGET_DIR
cp artiq_kasli/tester/software/bootloader/bootloader.bin $out cp artiq_${target}/${variant}/gateware/top.bit $TARGET_DIR
cp artiq_kasli/tester/software/runtime/runtime.{elf,fbi} $out 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> {}}: { pkgs ? import <nixpkgs> {}}:
{ artiqSrc, boardBinaries }: { artiqSrc, boardBinaries, target, variant }:
with pkgs; with pkgs;
let let
target = "kasli";
variant = "tester";
fakeCondaSource = runCommand "fake-conda-source-${target}-${variant}" { } fakeCondaSource = runCommand "fake-conda-source-${target}-${variant}" { }
'' ''
cp --no-preserve=mode,ownership -R ${artiqSrc} $out cp --no-preserve=mode,ownership -R ${artiqSrc} $out
@ -47,7 +44,7 @@ let
set -e set -e
SOC_PREFIX=\$PREFIX/site-packages/artiq/binaries/${target}-${variant} SOC_PREFIX=\$PREFIX/site-packages/artiq/binaries/${target}-${variant}
mkdir -p \$SOC_PREFIX mkdir -p \$SOC_PREFIX
cp ${boardBinaries}/* \$SOC_PREFIX cp ${boardBinaries}/${pkgs.python3Packages.python.sitePackages}/artiq/binaries/${target}-${variant}/* \$SOC_PREFIX
EOF EOF
chmod 755 $out/fake-conda/build.sh chmod 755 $out/fake-conda/build.sh
''; '';

View File

@ -1,17 +1,21 @@
{ pkgs ? import <nixpkgs> {}}: { pkgs ? import <nixpkgs> {}}:
let let
artiqPkgs = import ./default.nix { inherit pkgs; }; artiqPkgs = import ./default.nix { inherit pkgs; };
artiq-board-kasli-tester = import ./artiq-board.nix { inherit pkgs; };
jobs = rec { jobs = rec {
conda-artiq = import ./conda-build.nix { inherit pkgs; } { conda-artiq = import ./conda-build.nix { inherit pkgs; } {
name = "conda-artiq"; name = "conda-artiq";
src = ../.; src = ../.;
recipe = "conda/artiq"; 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; } { conda-artiq-board-kasli-tester = import ./conda-board.nix { inherit pkgs; } {
artiqSrc = ../.; artiqSrc = ../.;
boardBinaries = artiq-board-kasli-tester; boardBinaries = artiq-board-kasli-tester;
target = "kasli";
variant = "tester";
}; };
} // artiqPkgs; } // artiqPkgs;
in in