a6add73883d3a7400d958ab1d950884bccfe7d9e
[dev-env-setup.git] / nextpnr-xilinx-install
1 #!/bin/bash
2 if [ "$EUID" -ne 0 ]
3 then echo "Please run as root using 'sudo bash'"
4 exit
5 fi
6
7 # change into $SUDO_USER home directory
8 cd /home/$SUDO_USER
9 mkdir -p src/nextpnr-xilinx
10 cd src/nextpnr-xilinx
11
12 apt-get install -y libcurl3-gnutls git git-man
13
14 git clone https://github.com/f4pga/prjxray.git
15 git clone https://github.com/SymbiFlow/prjxray-db.git
16 git clone https://github.com/gatecat/nextpnr-xilinx.git
17
18 ## Steps to compile prjxray
19
20 ### Necessary software to install
21
22 apt-get install -y build-essential make cmake python3 python3-setuptools \
23 python3-dev python3-numpy cython3 python3-pip
24
25 pip3 install textx
26
27 apt-get install -y wget
28 wget https://files.pythonhosted.org/packages/78/4c/94fb3bdb87bea21406c0e5da375f0b10d7b1e4b5103cea453a2de23b5d61/fasm-0.0.2.post88.tar.gz
29 tar -xvzf fasm-0.0.2.post88.tar.gz
30 cd fasm-0.0.2.post88
31 python3 setup.py install
32 cd ..
33
34 ### Build prjxray
35
36 cd prjxray
37 git checkout 18b92012afe2b03f3f975a78c4372c74b60dca0c
38 git submodule update --init --recursive
39 mkdir build; cd build
40 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/nextpnr-xilinx ..
41 make -j$(nproc)
42 make install
43 install -d -m 0755 /usr/local/nextpnr-xilinx/build/tools
44 install -m 0755 tools/{bitread,bittool,frame_address_decoder,gen_part_base_yaml,segmatch,xc7frames2bit,xc7patch} \
45 /usr/local/nextpnr-xilinx/build/tools
46 cd ..
47 cp -dpr utils /usr/local/nextpnr-xilinx
48 sed -i -e '/^# Vivado /,$d' /usr/local/nextpnr-xilinx/utils/environment.sh
49 python3 setup.py develop
50 cd ..
51
52 ## Steps to compile prjxray-db
53
54 ### Install prjxray-db
55
56 cd prjxray-db
57 git archive --format=tar --prefix=database/ \
58 0a0addedd73e7e4139d52a6d8db4258763e0f1f3 | \
59 tar -C /usr/local/nextpnr-xilinx -xf -
60 cd ..
61
62 ## Steps to compile nextpnr-xilinx
63
64 ### Necessary software to install
65
66 apt-get install -y libboost-thread-dev libboost-iostreams-dev \
67 libboost-program-options-dev libeigen3-dev libboost-python-dev \
68 libboost-filesystem-dev
69
70 ### Build nextpnr-xilinx
71
72 cd nextpnr-xilinx
73 git checkout 565588a69ea95a52f7c7592f4ed81d9bef6cfb60
74 git submodule init
75 git submodule update
76 cmake -DARCH=xilinx -DBUILD_GUI=OFF \
77 -DCMAKE_INSTALL_PREFIX=/usr/local/nextpnr-xilinx .
78 make -j$(nproc)
79 make install
80 ln -s xc7a100tcsg324-1 xilinx/external/prjxray-db/artix7/xc7a100t
81 python3 xilinx/python/bbaexport.py --device xc7a100tcsg324-1 \
82 --bba xilinx/xc7a100t.bba
83 ./bbasm --l xilinx/xc7a100t.bba xilinx/xc7a100t.bin
84 install -d -m 0755 /usr/local/nextpnr-xilinx/share/xilinx
85 install -m 0755 xilinx/xc7a100t.bin /usr/local/nextpnr-xilinx/share/xilinx
86 export XRAY_DIR=/usr/local/nextpnr-xilinx
87 cd ..
88
89 cd /home/$SUDO_USER/src/nextpnr-xilinx
90 chown -R $SUDO_USER .
91 chgrp -R $SUDO_USER .
92