coriolis-install, cp-scripts-to-chroot: adjusted names to align with the rest of...
[dev-env-setup.git] / coriolis-install
1 #!/bin/bash
2
3 if [ "$EUID" -eq 0 ]; then
4 echo "Please run as a normal user!"
5 echo "This script is NOT intended to run as root."
6 exit
7 fi
8
9 echo "Current USER=$USER"
10
11 # Install apt dependencies
12 echo Installing necessary apt dependencies in the chroot
13 sudo apt-get update -y
14 sudo apt-get upgrade -y
15 sudo apt-get install -y automake binutils-dev bison build-essential \
16 sysvinit-utils sysvinit-core \
17 ccache clang cmake doxygen dvipng flex gcc git graphviz \
18 imagemagick libboost-all-dev libboost-python-dev libbz2-dev \
19 libmpfr-dev libgmp-dev libmotif-dev libreadline-dev \
20 libqwt-dev libtool libx11-dev libxaw7-dev libxml2-dev \
21 python2.7 python2.7-dev \
22 libxpm-dev libxt-dev python3.7 python3-jinja2 python3-pip \
23 python3-setuptools python-dev python-qt4 python-sphinx \
24 qt4-dev-tools rapidjson-dev tcl tcl-dev tcl-tclreadline \
25 texlive texlive-fonts-extra texlive-lang-french \
26 texlive-latex-extra texlive-pictures xfig zlib1g-dev
27
28 # Add convenience variable to chroot user .bash_profile
29 vars_for_bash_profile="export PATH=/usr/lib/ccache:\044PATH
30 export DISPLAY=:0.0
31 export ALLIANCE_TOP=/home/$USER/alliance/install
32 export YOSYS_TOP=/home/$USER/yosys
33 export LD_LIBRARY_PATH=\044{ALLIANCE_TOP}/lib:\044{LD_LIBRARY_PATH}
34 export LD_LIBRARY_PATH=\044{ALLIANCE_TOP}/lib64:\044{LD_LIBRARY_PATH}"
35
36 echo -e "$vars_for_bash_profile" > /home/$USER/.bash_profile
37
38 echo "Setting /home/$USER/.bash_profile file to (for faster rebuilds):
39 $vars_for_bash_profile"
40
41 sudo chown $USER /home/$USER/.bash_profile
42 sudo chgrp $USER /home/$USER/.bash_profile
43
44 # Build and install yosys from source
45 # note that a specific version of yosys is needed for ls180 at the moment
46 echo "deb-src http://ftp.debian.org/debian buster main" > /etc/apt/sources.list.d/bustersrc.list
47 sudo apt-get update -y
48 sudo apt-get build-dep yosys -y
49
50 cd /home/$USER
51 git clone https://github.com/cliffordwolf/yosys.git
52 cd yosys
53 git checkout 049e3abf9baf795e69b9ecb9c4f19de6131f8418
54 make config-clang
55 # WAY too heavy a load (18+) - make -j$(nproc)
56 make
57
58 cd /home/$USER/yosys
59 sudo make install
60
61 # Install coriolis2 from source
62 cd /home/$USER
63 source .bash_profile
64 mkdir -p /home/$USER/coriolis-2.x/src
65 cd /home/$USER/coriolis-2.x/src
66 git clone https://gitlab.lip6.fr/vlsi-eda/coriolis.git
67 cd coriolis
68 # check out Libre-SOC 180nm ASIC version
69 #git checkout devel
70 git checkout LS180_RC7_FINAL
71 # guaranteed to fail ./bootstrap/ccb.py --project=coriolis --make="-j$(nproc) install"
72 ./bootstrap/ccb.py --project=coriolis --make="-j1 install"
73
74 # Setup and test coriolisenv
75 /home/$USER/coriolis-2.x/src/coriolis/bootstrap/coriolisEnv.py > /home/$USER/coriolisenv
76 source /home/$USER/.bash_profile
77 source /home/$USER/coriolisenv
78
79 # Install alliance from source
80 cd /home/$USER
81 source coriolisenv
82 git clone https://gitlab.lip6.fr/vlsi-eda/alliance.git
83 mkdir -p /home/$USER/alliance/build /home/$USER/alliance/install
84 mv alliance/alliance/src alliance
85 rm -rf alliance/alliance
86 cd alliance/src
87 ./autostuff
88 cd /home/$USER/alliance/build
89 ../src/configure --prefix=/home/$USER/alliance/install --enable-alc-shared
90
91 cd /home/$USER/alliance/build
92 source /home/$USER/coriolisenv
93 #make and install locally as local user
94 make -j1 install
95
96 # Install and configure alliance-check-toolkit
97 cd /home/$USER
98 git clone https://gitlab.lip6.fr/vlsi-eda/alliance-check-toolkit.git
99 source coriolisenv
100 touch alliance-check-toolkit/etc/mk/users.d/user-$USER.mk
101 cat <<EOG >>alliance-check-toolkit/etc/mk/users.d/user-$USER.mk
102 export CORIOLIS_TOP=/home/$USER/coriolis-2.x/Linux.x86_64/Release.Shared/install
103 export ALLIANCE_TOP=/home/$USER/alliance/install
104 export CHECK_TOOLKIT=/home/$USER/alliance-check-toolkit
105 export YOSYS_TOP=/home/$USER/yosys
106 EOG
107 source /home/$USER/.bash_profile
108 cd alliance-check-toolkit/benchs/adder/cmos
109 make lvx
110 echo -e "
111 \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
112 "
113 make cgt
114
115 cd /home/$USER/
116 sudo chown -R $USER *
117 sudo chgrp -R $USER *