3 then echo "Please run as root"
6 # Setup fstab mount points
7 cat <<'EOF' >> /etc/fstab
8 /dev /opt/chroot/coriolis/dev none bind 0 0
9 /dev/pts /opt/chroot/coriolis/dev/pts none bind 0 0
10 /proc /opt/chroot/coriolis/proc none bind 0 0
11 /sys /opt/chroot/coriolis/sys none bind 0 0
12 /tmp /opt/chroot/coriolis/tmp none bind 0 0
14 # Create coriolis chroot dir in /opt
15 mkdir
-p /opt
/chroot
/coriolis
16 # Install debootstrap and schroot via apt
17 apt
install -y debootstrap schroot
18 # Install debian/buster chroot using debootstrap
19 /usr
/sbin
/debootstrap buster
/opt
/chroot
/coriolis \
20 http
://ftp.uk.debian.org
/debian
21 # Mount all chroot mount points from fstab
22 mount
/opt
/chroot
/coriolis
/dev
23 mount
/opt
/chroot
/coriolis
/dev
/pts
24 mount
/opt
/chroot
/coriolis
/proc
25 mount
/opt
/chroot
/coriolis
/sys
26 mount
/opt
/chroot
/coriolis
/tmp
27 echo "coriolis2" > /opt
/chroot
/coriolis
/etc
/debian_chroot
28 # Install apt dependencies in the chroot
29 chroot
/opt
/chroot
/coriolis
/bin
/bash
<< EOF
30 echo Installing necessary apt dependencies in the chroot
33 apt-get install -y automake binutils-dev bison build-essential \
34 sysvinit-utils sysvinit-core \
35 ccache clang cmake doxygen dvipng flex gcc git graphviz \
36 imagemagick libboost-all-dev libboost-python-dev libbz2-dev \
37 libmpfr-dev libgmp-dev libmotif-dev libreadline-dev \
38 libqwt-dev libtool libx11-dev libxaw7-dev libxml2-dev \
39 python2.7 python2.7-dev \
40 libxpm-dev libxt-dev python3.7 python3-jinja2 python3-pip \
41 python3-setuptools python-dev python-qt4 python-sphinx \
42 qt4-dev-tools rapidjson-dev tcl tcl-dev tcl-tclreadline \
43 texlive texlive-fonts-extra texlive-lang-french \
44 texlive-latex-extra texlive-pictures xfig yosys zlib1g-dev
46 # yeah don't add systemd in a chroot. not funny joke
47 apt-get remove -y systemd
49 # Create user with same UID in the chroot
50 useradd -m -p `python3 -c 'import crypt; print (crypt.crypt("1234","Fx"))'` \
51 -s /bin/bash $SUDO_USER -k /etc/skel
53 Added user ${SUDO_USER} with \e[1;91mpassword: 1234\e[0m"
56 \e[1;91mPlease use command 'passwd ${SUDO_USER}' to change this immediately after this script is run for security purposes.\e[0m
59 # Add convenience variable to chroot user .bash_profile
60 echo -e 'export PATH=/usr/lib/ccache:"\044PATH"\nexport DISPLAY=:0.0\nexport ALLIANCE_TOP=/home/$SUDO_USER/alliance/install\nexport YOSYS_TOP=/home/$SUDO_USER/yosys\nexport LD_LIBRARY_PATH=\044{ALLIANCE_TOP}/lib:\044{LD_LIBRARY_PATH}\nexport LD_LIBRARY_PATH=\044{ALLIANCE_TOP}/lib64:\044{LD_LIBRARY_PATH}' > /home/$SUDO_USER/.bash_profile
61 chown $SUDO_USER /home/$SUDO_USER/.bash_profile
62 chgrp $SUDO_USER /home/$SUDO_USER/.bash_profile
64 echo -e "Added 'export PATH=/usr/lib/ccache:\"\044PATH\"\nexport DISPLAY=:0.0' to /home/$SUDO_USER/.bash_profile to speed up rebuilds"
67 # Add coriolis config to schroot.conf
68 cat <<EOF >>/etc/schroot/schroot.conf
70 description=Debian Buster for Coriolis
71 directory=/opt/chroot/coriolis
72 groups=sbuild-security,$SUDO_USER,users
75 echo "Adding the following coriolis section to /etc/schroot/schroot.conf:
78 description=Debian Buster for Coriolis
79 directory=/opt/chroot/coriolis
80 groups=sbuild-security,$SUDO_USER,users
82 This enables you to chroot into coriolis as an unprivileged user by running
83 'schroot -c coriolis /bin/bash'
86 # Build and install yosys from source
87 # note that a specific version of yosys is needed for ls180 at the moment
88 chroot
/opt
/chroot
/coriolis
/bin
/bash
<< EOF
90 apt-get build-dep yosys -y
91 apt-get remove yosys -y
93 runuser
$SUDO_USER --preserve-environment -c 'schroot -c coriolis /bin/bash << EOF
95 git clone https://github.com/cliffordwolf/yosys.git
97 git checkout 049e3abf9baf795e69b9ecb9c4f19de6131f8418
102 chroot
/opt
/chroot
/coriolis
/bin
/bash
<< EOF
103 cd /home/$SUDO_USER/yosys
107 # Install coriolis2 from source
108 runuser
$SUDO_USER --preserve-environment -c 'schroot -c coriolis /bin/bash << EOF
111 mkdir -p /home/$SUDO_USER/coriolis-2.x/src
112 cd /home/$SUDO_USER/coriolis-2.x/src
113 git clone https://gitlab.lip6.fr/vlsi-eda/coriolis.git
116 ./bootstrap/ccb.py --project=coriolis --make="-j$(nproc) install"
118 # Setup and test coriolisenv
119 /home/$SUDO_USER/coriolis-2.x/src/coriolis/bootstrap/coriolisEnv.py > /home/$SUDO_USER/coriolisenv
120 source /home/$SUDO_USER/.bash_profile
121 source /home/$SUDO_USER/coriolisenv
124 # Install alliance from source
125 runuser
$SUDO_USER --preserve-environment -c 'schroot -c coriolis /bin/bash << EOF
128 git clone https://gitlab.lip6.fr/vlsi-eda/alliance.git
129 mkdir -p /home/$SUDO_USER/alliance/build /home/$SUDO_USER/alliance/install
130 mv alliance/alliance/src alliance
131 rm -rf alliance/alliance
134 cd /home/$SUDO_USER/alliance/build
135 ../src/configure --prefix=/home/$SUDO_USER/alliance/install --enable-alc-shared
138 chroot
/opt
/chroot
/coriolis
/bin
/bash
<< EOF
139 cd /home/$SUDO_USER/alliance/build
140 source /home/$SUDO_USER/coriolisenv
144 # Install and configure alliance-check-toolkit
145 runuser
$SUDO_USER --preserve-environment -c 'schroot -c coriolis /bin/bash << EOF
147 git clone https://gitlab.lip6.fr/vlsi-eda/alliance-check-toolkit.git
149 touch alliance-check-toolkit/etc/mk/users.d/user-$SUDO_USER.mk
150 cat <<EOG >>alliance-check-toolkit/etc/mk/users.d/user-$SUDO_USER.mk
151 export CORIOLIS_TOP=/home/$SUDO_USER/coriolis-2.x/Linux.x86_64/Release.Shared/install
152 export ALLIANCE_TOP=/home/$SUDO_USER/alliance/install
153 export CHECK_TOOLKIT=/home/$SUDO_USER/alliance-check-toolkit
154 export YOSYS_TOP=/home/$SUDO_USER/yosys
156 source /home/$SUDO_USER/.bash_profile
157 cd alliance-check-toolkit/benchs/ARM/cmos
160 \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