Fix correct commit hash for release 0.7.0 of openXC7
[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 # this really doesn't work properly, antlr is still not correctly
28 # detected, (missing ANTLRconfig.cmake) but at least fasm falls back
29 # to the python version
30 sudo apt install cmake default-jre-headless uuid-dev libantlr4-runtime-dev
31
32 apt-get install -y wget
33 wget https://files.pythonhosted.org/packages/78/4c/94fb3bdb87bea21406c0e5da375f0b10d7b1e4b5103cea453a2de23b5d61/fasm-0.0.2.post88.tar.gz
34 tar -xvzf fasm-0.0.2.post88.tar.gz
35 cd fasm-0.0.2.post88
36 python3 setup.py install
37 cd ..
38
39 ### Build prjxray
40
41 cd prjxray
42 git checkout 18b92012afe2b03f3f975a78c4372c74b60dca0c
43 git submodule update --init --recursive
44 mkdir build; cd build
45 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/nextpnr-xilinx ..
46 make -j$(nproc)
47 make install
48 install -d -m 0755 /usr/local/nextpnr-xilinx/build/tools
49 install -m 0755 tools/{bitread,bittool,frame_address_decoder,gen_part_base_yaml,segmatch,xc7frames2bit,xc7patch} \
50 /usr/local/nextpnr-xilinx/build/tools
51 cd ..
52 cp -dpr utils /usr/local/nextpnr-xilinx
53 sed -i -e '/^# Vivado /,$d' /usr/local/nextpnr-xilinx/utils/environment.sh
54 python3 setup.py develop
55 cd ..
56
57 ## Steps to compile prjxray-db
58
59 ### Install prjxray-db
60
61 cd prjxray-db
62 git archive --format=tar --prefix=database/ \
63 0a0addedd73e7e4139d52a6d8db4258763e0f1f3 | \
64 tar -C /usr/local/nextpnr-xilinx -xf -
65 cd ..
66
67 ## Steps to compile nextpnr-xilinx
68
69 ### Necessary software to install
70
71 apt-get install -y libboost-thread-dev libboost-iostreams-dev \
72 libboost-program-options-dev libeigen3-dev libboost-python-dev \
73 libboost-filesystem-dev
74
75 ### Build nextpnr-xilinx
76
77 cd nextpnr-xilinx
78 git checkout 565588a69ea95a52f7c7592f4ed81d9bef6cfb60
79 git submodule init
80 git submodule update
81 cmake -DARCH=xilinx -DBUILD_GUI=OFF \
82 -DCMAKE_INSTALL_PREFIX=/usr/local/nextpnr-xilinx .
83 make -j$(nproc)
84 make install
85 ln -s xc7a100tcsg324-1 xilinx/external/prjxray-db/artix7/xc7a100t
86 python3 xilinx/python/bbaexport.py --device xc7a100tcsg324-1 \
87 --bba xilinx/xc7a100t.bba
88 ./bbasm --l xilinx/xc7a100t.bba xilinx/xc7a100t.bin
89 install -d -m 0755 /usr/local/nextpnr-xilinx/share/xilinx
90 install -m 0755 xilinx/xc7a100t.bin /usr/local/nextpnr-xilinx/share/xilinx
91 export XRAY_DIR=/usr/local/nextpnr-xilinx
92 cd ..
93
94 cd /home/$SUDO_USER/src/nextpnr-xilinx
95 chown -R $SUDO_USER .
96 chgrp -R $SUDO_USER .
97