Skip to content

Instantly share code, notes, and snippets.

@mikalstill
Forked from mithro/clone-n-update-litex.sh
Last active December 4, 2016 01:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikalstill/c4f6cc1aee7c694c107e8bd3ea399e03 to your computer and use it in GitHub Desktop.
Save mikalstill/c4f6cc1aee7c694c107e8bd3ea399e03 to your computer and use it in GitHub Desktop.
Script to get all the enjoy-digital repos and set up a conda environment for using them in
#! /bin/bash
if [ "`whoami`" = "root" ]
then
echo "Running the script as root is not permitted"
exit 1
fi
CALLED=$_
[[ "${BASH_SOURCE[0]}" != "${0}" ]] && SOURCED=1 || SOURCED=0
SETUP_SRC=$(realpath ${BASH_SOURCE[0]})
SETUP_DIR=$(dirname $SETUP_SRC)
TOP_DIR=$(realpath $SETUP_DIR/..)
if [ $SOURCED = 1 ]; then
echo "You must run this script, rather then try to source it."
echo "$SETUP_SRC"
return
fi
set -x
set -e
echo "####################################"
echo "# Installing dependencies"
echo "####################################"
echo "Installing apt packages for simulation"
sudo apt-get install build-essential libsdl1.2-dev libftdi-dev atftpd openvpn
echo
ARCHS="or1k lm32"
echo "Installing conda for toolchains"
echo "===================================="
CONDA_DIR=$PWD/conda
export PATH=$CONDA_DIR/bin:$PATH
(
if [ ! -d $CONDA_DIR ]; then
wget -c https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod a+x Miniconda3-latest-Linux-x86_64.sh
./Miniconda3-latest-Linux-x86_64.sh -p $CONDA_DIR -b
conda config --set always_yes yes --set changeps1 no
conda update -q conda
fi
conda config --add channels timvideos
for ARCH in $ARCHS; do
conda install binutils-${ARCH}-elf
conda install gcc-${ARCH}-elf
conda install gdb-${ARCH}-elf
done
conda install verilator
conda install openocd
conda install flterm
)
echo "------------------------------------"
echo
function git-fetch-all {
for i in $(git remote); do git fetch -p $i ; done
}
# Get HDMI2USB-mode-switch so we can do the programming
echo "Installing mode switch"
echo "===================================="
if [ ! -d "HDMI2USB-mode-switch" ]; then
sudo apt-get install fxload
git clone https://github.com/timvideos/HDMI2USB-mode-switch.git
fi
(
cd HDMI2USB-mode-switch
git-fetch-all
git status
git merge origin/master
python setup.py develop
cd udev
sudo make install
sudo make reload
)
echo "------------------------------------"
echo
echo "####################################"
echo "# Getting lite repos"
echo "####################################"
LITE_REPOS="
litex
litedram
liteeth
litejpeg
litepcie
litesata
litescope
liteusb
litevideo
"
for REPO in $LITE_REPOS; do
echo "$REPO"
echo "===================================="
if [ ! -d $REPO ]; then
git clone --recursive https://github.com/enjoy-digital/$REPO.git
fi
(
cd $REPO
git-fetch-all
git status
git merge origin/master
git submodule update --init --recursive
git submodule -q foreach git fetch origin
python setup.py develop
)
echo "------------------------------------"
echo
done
echo "####################################"
echo "# Getting soc repos"
echo "####################################"
SOC_REPOS="
arty-soc
nexys-soc
opsis-soc
scarab-soc
"
for REPO in $SOC_REPOS; do
echo "$REPO"
echo "===================================="
if [ ! -d $REPO ]; then
git clone https://github.com/enjoy-digital/$REPO.git
fi
(
cd $REPO
git-fetch-all
if [ -z "$(git status --porcelain)" ]; then
git merge origin/master
else
echo "$REPO is dirty, not updating..."
git status
fi
)
echo "------------------------------------"
echo
done
echo
echo "####################################"
echo "# Finished setup!"
echo "####################################"
echo
echo "Enter environment:"
echo "export PATH=$PWD/conda/bin:\$PATH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment