|
| 1 | +#!/bin/bash |
| 2 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 3 | +# or more contributor license agreements. See the NOTICE file |
| 4 | +# distributed with this work for additional information |
| 5 | +# regarding copyright ownership. The ASF licenses this file |
| 6 | +# to you under the Apache License, Version 2.0 (the |
| 7 | +# "License"); you may not use this file except in compliance |
| 8 | +# with the License. You may obtain a copy of the License at |
| 9 | +# |
| 10 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +# |
| 12 | +# Unless required by applicable law or agreed to in writing, |
| 13 | +# software distributed under the License is distributed on an |
| 14 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | +# KIND, either express or implied. See the License for the |
| 16 | +# specific language governing permissions and limitations |
| 17 | +# under the License. |
| 18 | + |
| 19 | +set -e |
| 20 | + |
| 21 | +install_path="/opt/csi-nn2" |
| 22 | + |
| 23 | +# Clone CSI-NN2 Compute Library source code |
| 24 | +git clone --depth 1 --branch 1.12.2 https://github.com/T-head-Semi/csi-nn2.git ${install_path} |
| 25 | + |
| 26 | +# download cross-compiler when not building natively. |
| 27 | +# riscv gcc toolchain will be downloaded to "/path/csi-nn2/tools/gcc-toolchain". |
| 28 | +cd ${install_path} |
| 29 | +./script/download_toolchain.sh |
| 30 | + |
| 31 | +# download custom QEMU to "/path/csi-nn2/tools/qemu". |
| 32 | +./script/download_qemu.sh |
| 33 | + |
| 34 | +# build csinn2 lib for x86 and c906 |
| 35 | +# lib will be installed in /path/csi-nn2/install |
| 36 | +# for x86 |
| 37 | +make -j4; cd x86_build; make install; cd - |
| 38 | +# for c906 |
| 39 | +mkdir -p riscv_build; cd riscv_build |
| 40 | +cmake ../ -DBUILD_RISCV=ON; make -j4; make install; cd - |
| 41 | + |
0 commit comments