From 1530f9f45782803316be120993c66dd242ade6f7 Mon Sep 17 00:00:00 2001 From: Yann Sionneau Date: Sat, 4 Apr 2015 16:27:43 +0200 Subject: [PATCH] travis: generate kc705 and pipistrello binaries in container env --- .travis.yml | 7 +++---- .travis/get-anaconda.sh | 1 + .travis/get-toolchain.sh | 23 ++++++++++++++++----- .travis/get-xilinx.sh | 38 ++++++++++++++++++++++++++++------ conda/artiq/build.sh | 44 +++++++++++++++++++++++++++++++--------- conda/artiq/meta.yaml | 2 ++ setup.py | 2 +- 7 files changed, 91 insertions(+), 26 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8fa5ccfb1..bec5ffcff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,21 +1,20 @@ language: python python: - '3.4' +sudo: false env: global: - MSCDIR=$TRAVIS_BUILD_DIR/misoc - PATH=$HOME/miniconda/bin:/usr/local/llvm-or1k/bin:$PATH - - CC=gcc-4.7 - - CXX=g++-4.7 - BUILD_SOC=1 - secure: "DUk/Ihg8KbbzEgPF0qrHqlxU8e8eET9i/BtzNvFddIGX4HP/P2qz0nk3cVkmjuWhqJXSbC22RdKME9qqPzw6fJwJ6dpJ3OR6dDmSd7rewavq+niwxu52PVa+yK8mL4yf1terM7QQ5tIRf+yUL9qGKrZ2xyvEuRit6d4cFep43Ws=" before_install: + - mkdir -p $HOME/.mlabs - if [ $TRAVIS_PULL_REQUEST != false ]; then BUILD_SOC=0; fi - - ./.travis/get-toolchain.sh + - . ./.travis/get-toolchain.sh - if [ $BUILD_SOC -ne 0 ]; then ./.travis/get-xilinx.sh; fi - ./.travis/get-anaconda.sh - source $HOME/miniconda/bin/activate py34 - - sudo apt-get install --force-yes -y iverilog - conda install pip coverage binstar migen cython - pip install coveralls install: diff --git a/.travis/get-anaconda.sh b/.travis/get-anaconda.sh index 9e746e616..992c3d31a 100755 --- a/.travis/get-anaconda.sh +++ b/.travis/get-anaconda.sh @@ -9,3 +9,4 @@ conda info -a conda install conda-build jinja2 conda create -q -n py34 python=$TRAVIS_PYTHON_VERSION conda config --add channels fallen +conda config --add channels https://conda.binstar.org/fallen/channel/dev diff --git a/.travis/get-toolchain.sh b/.travis/get-toolchain.sh index 23ff13bf4..7f736aa23 100755 --- a/.travis/get-toolchain.sh +++ b/.travis/get-toolchain.sh @@ -1,10 +1,23 @@ #!/bin/sh -sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test -sudo apt-add-repository -y "deb http://www.phys.ethz.ch/~robertjo/artiq-dev ./" -sudo apt-add-repository -y "deb http://archive.ubuntu.com/ubuntu saucy main universe" -sudo apt-get -qq --force-yes -y update -sudo apt-get install --force-yes -y gcc-4.7 g++-4.7 artiq-dev +packages="https://people.phys.ethz.ch/~robertjo/artiq-dev/or1k-gcc_20141105-1_amd64.deb +https://people.phys.ethz.ch/~robertjo/artiq-dev/or1k-binutils_20141105-1_amd64.deb +http://us.archive.ubuntu.com/ubuntu/pool/universe/i/iverilog/iverilog_0.9.7-1_amd64.deb" + +mkdir -p packages + +for p in $packages +do + wget $p + pkg_name=$(echo $p | sed -e 's!.*/\(.*\)\.deb!\1\.deb!') + dpkg -x $pkg_name packages +done + +export PATH=$PWD/packages/usr/local/bin:$PWD/packages/usr/bin:$PATH +export LD_LIBRARY_PATH=$PWD/packages/usr/lib/x86_64-linux-gnu:$PWD/packages/usr/local/x86_64-unknown-linux-gnu/or1k-elf/lib:$LD_LIBRARY_PATH + +echo -e "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $HOME/.mlabs/build_settings.sh + or1k-elf-as --version or1k-elf-gcc --version clang --version diff --git a/.travis/get-xilinx.sh b/.travis/get-xilinx.sh index b8ec01992..c37aead48 100755 --- a/.travis/get-xilinx.sh +++ b/.travis/get-xilinx.sh @@ -1,9 +1,35 @@ #!/bin/sh -wget http://www.phys.ethz.ch/~robertjo/xilinx_ise_14.7_s3_s6.tar.gz.gpg +wget http://sionneau.net/artiq/Xilinx/xilinx_ise_14.7_s3_s6.tar.gz.gpg echo "$secret" | gpg --passphrase-fd 0 xilinx_ise_14.7_s3_s6.tar.gz.gpg -sudo tar -C / -xzf xilinx_ise_14.7_s3_s6.tar.gz -wget http://www.phys.ethz.ch/~robertjo/xilinx_webpack.lic.gpg -echo "$secret" | gpg --passphrase-fd 0 xilinx_webpack.lic.gpg -mkdir ~/.Xilinx -mv xilinx_webpack.lic ~/.Xilinx/Xilinx.lic +tar -C $HOME/ -xzf xilinx_ise_14.7_s3_s6.tar.gz +wget http://sionneau.net/artiq/Xilinx/Xilinx_Vivado_2015_1_k7.tar.gz.gpg +echo "$secret" | gpg --passphrase-fd 0 Xilinx_Vivado_2015_1_k7.tar.gz.gpg +tar -C $HOME/ -xzf Xilinx_Vivado_2015_1_k7.tar.gz + +# Relocate Vivado from /opt to $HOME +for i in $(grep -Rsn "/opt/Xilinx" $HOME/Xilinx | cut -d':' -f1) +do + sed -i -e "s!/opt!$HOME!g" $i +done + +# Relocate ISE from /opt to $HOME +for i in $(grep -Rsn "/opt/Xilinx" $HOME/opt | cut -d':' -f1) +do + sed -i -e "s!/opt/Xilinx!$HOME/opt/Xilinx!g" $i +done + +wget http://sionneau.net/artiq/Xilinx/Xilinx.lic.gpg +echo "$secret" | gpg --passphrase-fd 0 Xilinx.lic.gpg +mkdir -p ~/.Xilinx +mv Xilinx.lic ~/.Xilinx/Xilinx.lic + +# Tell mibuild where Vivado is installed +echo "MISOC_EXTRA_VIVADO_CMDLINE=\"-Ob vivado_path $HOME/Xilinx/Vivado\"" >> $HOME/.mlabs/build_settings.sh +echo "MISOC_EXTRA_ISE_CMDLINE=\"-Ob ise_path $HOME/opt/Xilinx/\"" >> $HOME/.mlabs/build_settings.sh + +# Lie to Vivado by hooking the ioctl used to retrieve mac address for license verification +git clone https://github.com/fallen/impersonate_macaddress +make -C impersonate_macaddress +echo "export MACADDR=$macaddress" >> $HOME/.mlabs/build_settings.sh +echo "export LD_PRELOAD=$PWD/impersonate_macaddress/impersonate_macaddress.so" >> $HOME/.mlabs/build_settings.sh diff --git a/conda/artiq/build.sh b/conda/artiq/build.sh index 5abb0dea4..e6c049b18 100755 --- a/conda/artiq/build.sh +++ b/conda/artiq/build.sh @@ -1,19 +1,43 @@ #!/bin/bash +BUILD_SETTINGS_FILE=$HOME/.mlabs/build_settings.sh + +if [ -f $BUILD_SETTINGS_FILE ] +then + source $BUILD_SETTINGS_FILE +fi + ARTIQ_GUI=1 $PYTHON setup.py install --single-version-externally-managed --record=record.txt git clone --recursive https://github.com/m-labs/misoc -git clone https://github.com/GadgetFactory/Papilio-Loader export MSCDIR=$SRC_DIR/misoc -cd $SRC_DIR/misoc; python make.py -X ../soc -t artiq_ppro build-headers build-bios; cd - -make -C soc/runtime runtime.fbi -cd $SRC_DIR/misoc; python make.py -X $SRC_DIR/soc -t artiq_ppro build-bitstream; cd - + ARTIQ_PREFIX=$PREFIX/lib/python3.4/site-packages/artiq BIN_PREFIX=$ARTIQ_PREFIX/binaries/ mkdir -p $ARTIQ_PREFIX/misc -cp misc/99-ppro.rules $ARTIQ_PREFIX/misc/ -mkdir -p $BIN_PREFIX/ppro $BIN_PREFIX/kc705 -cp $SRC_DIR/misoc/build/artiq_ppro-up-papilio_pro.bin $BIN_PREFIX/ppro -cp $SRC_DIR/misoc/software/bios/bios.bin $BIN_PREFIX/ppro -cp soc/runtime/runtime.fbi $BIN_PREFIX/ppro +mkdir -p $BIN_PREFIX/kc705 $BIN_PREFIX/pipistrello + +# build for KC705 + +cd $SRC_DIR/misoc; python make.py -X ../soc -t artiq_kc705 build-headers build-bios; cd - +make -C soc/runtime clean runtime.fbi +cd $SRC_DIR/misoc; python make.py -X ../soc -t artiq_kc705 $MISOC_EXTRA_VIVADO_CMDLINE build-bitstream; cd - + +# build for Pipistrello + +cd $SRC_DIR/misoc; python make.py -X ../soc -t artiq_pipistrello build-headers build-bios; cd - +make -C soc/runtime clean runtime.fbi +cd $SRC_DIR/misoc; python make.py -X ../soc -t artiq_pipistrello $MISOC_EXTRA_ISE_CMDLINE build-bitstream; cd - + +# install KC705 binaries + +cp soc/runtime/runtime.fbi $BIN_PREFIX/kc705/ +cp $SRC_DIR/misoc/software/bios/bios.bin $BIN_PREFIX/kc705/ +cp $SRC_DIR/misoc/build/artiq_kc705-nist_qc1-kc705.bin $BIN_PREFIX/kc705/ + +# install Pipistrello binaries + +cp soc/runtime/runtime.fbi $BIN_PREFIX/pipistrello/ +cp $SRC_DIR/misoc/software/bios/bios.bin $BIN_PREFIX/pipistrello/ +cp $SRC_DIR/misoc/build/artiq_pipistrello-nist_qc1-pipistrello.bin $BIN_PREFIX/pipistrello/ + cp artiq/frontend/artiq_flash.sh $PREFIX/bin -cp Papilio-Loader/xc3sprog/trunk/bscan_spi/bscan_spi_lx9_papilio.bit $BIN_PREFIX/ppro diff --git a/conda/artiq/meta.yaml b/conda/artiq/meta.yaml index d902460c1..8c6530eb8 100644 --- a/conda/artiq/meta.yaml +++ b/conda/artiq/meta.yaml @@ -29,6 +29,7 @@ requirements: - setuptools - numpy - migen + - pyelftools run: - python - llvmlite-or1k @@ -41,6 +42,7 @@ requirements: - h5py - dateutil - pydaqmx + - pyelftools - gbulb-artiq # [not win] - cairoplot3-artiq # [not win] diff --git a/setup.py b/setup.py index 0b86af88c..1d4ebc068 100755 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ import os requirements = [ "sphinx", "sphinx-argparse", "pyserial", "numpy", "scipy", - "python-dateutil", "prettytable", "h5py", "pydaqmx" + "python-dateutil", "prettytable", "h5py", "pydaqmx", "pyelftools" ] scripts = [