coriolis-install, cp-scripts-to-chroot: adjusted names to align with the rest of...
authorAndrey Miroshnikov <andrey@technepisteme.xyz>
Fri, 1 Oct 2021 18:40:53 +0000 (19:40 +0100)
committerAndrey Miroshnikov <andrey@technepisteme.xyz>
Fri, 1 Oct 2021 18:40:53 +0000 (19:40 +0100)
coriolis-install [new file with mode: 0755]
cp-scripts-to-chroot [new file with mode: 0755]

diff --git a/coriolis-install b/coriolis-install
new file mode 100755 (executable)
index 0000000..ef3ec55
--- /dev/null
@@ -0,0 +1,117 @@
+#!/bin/bash
+
+if [ "$EUID" -eq 0 ]; then
+  echo "Please run as a normal user!"
+  echo "This script is NOT intended to run as root."
+  exit
+fi
+
+echo "Current USER=$USER"
+
+# Install apt dependencies
+echo Installing necessary apt dependencies in the chroot
+sudo apt-get update -y
+sudo apt-get upgrade -y
+sudo apt-get install -y automake binutils-dev bison build-essential \
+       sysvinit-utils sysvinit-core \
+       ccache clang cmake doxygen dvipng flex gcc git graphviz \
+       imagemagick libboost-all-dev libboost-python-dev libbz2-dev \
+       libmpfr-dev libgmp-dev libmotif-dev libreadline-dev \
+       libqwt-dev libtool libx11-dev libxaw7-dev libxml2-dev \
+       python2.7 python2.7-dev \
+       libxpm-dev libxt-dev python3.7 python3-jinja2 python3-pip \
+       python3-setuptools python-dev python-qt4 python-sphinx \
+       qt4-dev-tools rapidjson-dev tcl tcl-dev tcl-tclreadline \
+       texlive texlive-fonts-extra texlive-lang-french \
+       texlive-latex-extra texlive-pictures xfig zlib1g-dev
+
+# Add convenience variable to chroot user .bash_profile
+vars_for_bash_profile="export PATH=/usr/lib/ccache:\044PATH
+export DISPLAY=:0.0
+export ALLIANCE_TOP=/home/$USER/alliance/install
+export YOSYS_TOP=/home/$USER/yosys
+export LD_LIBRARY_PATH=\044{ALLIANCE_TOP}/lib:\044{LD_LIBRARY_PATH}
+export LD_LIBRARY_PATH=\044{ALLIANCE_TOP}/lib64:\044{LD_LIBRARY_PATH}"
+
+echo -e "$vars_for_bash_profile" > /home/$USER/.bash_profile
+
+echo "Setting /home/$USER/.bash_profile file to (for faster rebuilds):
+$vars_for_bash_profile"
+
+sudo chown $USER /home/$USER/.bash_profile
+sudo chgrp $USER /home/$USER/.bash_profile
+
+# Build and install yosys from source
+# note that a specific version of yosys is needed for ls180 at the moment
+echo "deb-src http://ftp.debian.org/debian buster main" > /etc/apt/sources.list.d/bustersrc.list
+sudo apt-get update -y
+sudo apt-get build-dep yosys -y
+
+cd /home/$USER
+git clone https://github.com/cliffordwolf/yosys.git
+cd yosys
+git checkout 049e3abf9baf795e69b9ecb9c4f19de6131f8418
+make config-clang
+# WAY too heavy a load (18+) - make -j$(nproc)
+make
+
+cd /home/$USER/yosys
+sudo make install
+
+# Install coriolis2 from source
+cd /home/$USER
+source .bash_profile
+mkdir -p /home/$USER/coriolis-2.x/src
+cd /home/$USER/coriolis-2.x/src
+git clone https://gitlab.lip6.fr/vlsi-eda/coriolis.git
+cd coriolis
+# check out Libre-SOC 180nm ASIC version
+#git checkout devel
+git checkout LS180_RC7_FINAL
+# guaranteed to fail ./bootstrap/ccb.py --project=coriolis --make="-j$(nproc) install"
+./bootstrap/ccb.py --project=coriolis --make="-j1 install"
+
+# Setup and test coriolisenv
+/home/$USER/coriolis-2.x/src/coriolis/bootstrap/coriolisEnv.py > /home/$USER/coriolisenv
+source /home/$USER/.bash_profile
+source /home/$USER/coriolisenv
+
+# Install alliance from source
+cd /home/$USER
+source coriolisenv
+git clone https://gitlab.lip6.fr/vlsi-eda/alliance.git
+mkdir -p /home/$USER/alliance/build /home/$USER/alliance/install
+mv alliance/alliance/src alliance
+rm -rf alliance/alliance
+cd alliance/src
+./autostuff
+cd /home/$USER/alliance/build
+../src/configure --prefix=/home/$USER/alliance/install --enable-alc-shared
+
+cd /home/$USER/alliance/build
+source /home/$USER/coriolisenv
+#make and install locally as local user
+make -j1 install
+
+# Install and configure alliance-check-toolkit
+cd /home/$USER
+git clone https://gitlab.lip6.fr/vlsi-eda/alliance-check-toolkit.git
+source coriolisenv
+touch alliance-check-toolkit/etc/mk/users.d/user-$USER.mk
+cat <<EOG >>alliance-check-toolkit/etc/mk/users.d/user-$USER.mk
+export CORIOLIS_TOP=/home/$USER/coriolis-2.x/Linux.x86_64/Release.Shared/install
+export ALLIANCE_TOP=/home/$USER/alliance/install
+export CHECK_TOOLKIT=/home/$USER/alliance-check-toolkit
+export YOSYS_TOP=/home/$USER/yosys
+EOG
+source /home/$USER/.bash_profile
+cd alliance-check-toolkit/benchs/adder/cmos
+make lvx
+echo -e "
+\e[1;91mSelect File -> Open Cell or press CTRL + o then enter as the cell name 'arm_chip_cts_r' without the single quotation marks.\e[0m
+"
+make cgt
+
+cd /home/$USER/
+sudo chown -R $USER *
+sudo chgrp -R $USER *
diff --git a/cp-scripts-to-chroot b/cp-scripts-to-chroot
new file mode 100755 (executable)
index 0000000..20ec540
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/bash
+if [ "$EUID" -ne 0 ]
+  then echo "Please run as root"
+  exit
+fi
+if [ -z "$1"  ]
+  then echo "Need arg $1 to specify which chroot to copy scripts to!"
+  exit
+fi
+
+chrootdir="$1"
+
+if [ -e /opt/chroot/$chrootdir ]; then
+
+       cur_dir=$(pwd | grep -o '[^/]*$')
+       if [ "$cur_dir" == "dev-env-setup" ]; then
+               echo "Copy over the dev-env-setup scripts to $chrootdir environment"
+               cp -R ../dev-env-setup /opt/chroot/$chrootdir/home/$SUDO_USER/
+               chown -R $SUDO_USER /opt/chroot/$chrootdir/home/$SUDO_USER/dev-env-setup
+               chgrp -R $SUDO_USER /opt/chroot/$chrootdir/home/$SUDO_USER/dev-env-setup
+       else
+               echo "This script must be run from dev-env-setup directory!"
+       fi
+else
+       echo "$chrootdir environment does not exist, cannot copy scripts!"
+fi
+