├── CHANGELOG ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── build_riscv_toolchain.sh ├── build_yocto_linux.sh ├── circt_init.sh ├── deploy_riscv64fedora_qemu.sh ├── gem5 └── dumprv ├── get_openroad.sh ├── get_v8_env.sh ├── install_cmake.sh ├── llvm ├── README.md ├── build_llvm.json └── build_llvm.py ├── mirror-iscas-ac-cn.sha256sum ├── openeuler └── README.md ├── openjdk-rv64 ├── Dockerfile ├── Makefile ├── build_ext_libs_64.sh ├── build_jdk.sh ├── docker_bootstrap.sh ├── manual_install_deps.sh ├── prepare_downloads.sh └── run_jdk.sh ├── openjdk ├── Dockerfile ├── Makefile ├── build_ext_libs_32.sh ├── build_jdk.sh ├── docker_bootstrap.sh ├── manual_install_deps.sh ├── prepare_downloads.sh └── run_jdk.sh ├── set_git_shortcuts.sh ├── v8-rv-dis-repl.sh ├── v8team ├── README ├── github-ci.sh ├── log-code.txt.gz ├── log-to-wiki.sh ├── output.txt.gz └── parse-dump.sh └── zfinx ├── build_zfinx.sh └── zfinx_regression_test.sh /CHANGELOG: -------------------------------------------------------------------------------- 1 | v0.1 2 | ---- 3 | 4 | Initial empty version. 5 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributors 2 | 3 | NOTE: Please add your name and email to this list after your PR merged. 4 | 5 | ## Contributor List 6 | 7 | Wei Wu (吴伟) 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2020 tiger 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PLCT Toolbox 2 | 3 | 本仓库包含了一些PLCT实验室在日常工作中,为了节约自己的时间,拯救自己的假期而做的一系列自动化/脚本尝试。 4 | 5 | 主要包含: 6 | - GCC、LLVM 等各种开源工具链的一键构建等。 7 | - QEMU、Spike 等模拟器和辅助工具的一键构建。 8 | - RISC-V 的实验环境的构建和拉取。 9 | - 其它PLCT内部常用的 code snippets、工具的配置等。 10 | 11 | ## 使用方法 12 | 13 | TODO 14 | 15 | 每个脚本都有脚本内注释,可以参考。 16 | 17 | -------------------------------------------------------------------------------- /build_riscv_toolchain.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script is extracted from docs in riscv-gnu-toolchain repo. 4 | 5 | set -e 6 | 7 | PREFIX="$HOME/opt/riscv" 8 | 9 | git clone --recursive https://github.com/riscv/riscv-gnu-toolchain 10 | 11 | cd riscv-gnu-toolchain 12 | 13 | ./configure --prefix="${PREFIX}" 14 | make newlib -j $(nproc) 15 | make linux -j $(nproc) 16 | 17 | export PATH="$PATH:$PREFIX/bin" 18 | export RISCV="$PREFIX" 19 | 20 | echo If you want to use it in future works, add 21 | echo 22 | echo export PATH=\"\$PATH:$PREFIX/bin\" 23 | echo export RISCV=\"$PREFIX\" 24 | echo 25 | echo to your \'.bashrc\' file. 26 | 27 | -------------------------------------------------------------------------------- /build_yocto_linux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This is a script extracts all RISCV64GC related commands 4 | # from by RISC-V Foundation. 5 | # Publish date of the RISC-V manual: 2019-05-31 6 | 7 | # Zephyr is skipped. 8 | 9 | echo "Auto run commands in " 10 | echo " Author: RISC-V Foundation; Date: 2019-05-31" 11 | 12 | # 8.1 13 | 14 | echo "Assume we are on Ubuntu 18.04" 15 | sudo apt install autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev \ 16 | gawk build-essential bison flex texinfo gperf libtool patchutils bc \ 17 | zlib1g-dev libexpat-dev git 18 | 19 | mkdir riscv64-linux || true 20 | pushd riscv64-linux 21 | 22 | # 8.2 23 | # NOTICE: In mainland China repo clone is a pain in your _. 24 | # JUST USE YOUR OVERSEA NODES. 25 | 26 | git clone --recursive --depth 3 https://github.com/riscv/riscv-gnu-toolchain 27 | git clone --recursive --depth 3 https://github.com/qemu/qemu 28 | git clone --recursive --depth 3 https://github.com/torvalds/linux 29 | git clone --recursive --depth 3 https://github.com/riscv/riscv-pk 30 | git clone --recursive --depth 3 https://github.com/michaeljclark/busybear-linux 31 | 32 | # use subshell for convinence. 33 | 34 | ( cd riscv-gnu-toolchain 35 | # pick an install path, e.g. /opt/riscv64 36 | ./configure --prefix=/opt/riscv64 --with-abi=lp64 37 | make newlib -j $(nproc) 38 | make linux -j $(nproc) 39 | # export variables 40 | export PATH="$PATH:/opt/riscv64/bin" 41 | export RISCV="/opt/riscv64" 42 | ) 43 | 44 | (cd qemu 45 | git checkout v3.0.0 46 | ./configure --target-list=riscv64-softmmu 47 | make -j $(nproc) 48 | sudo make install 49 | ) 50 | 51 | (cd linux 52 | git checkout v4.19-rc3 53 | cp ../busybear-linux/conf/linux.config .config 54 | make ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu- olddefconfig 55 | 56 | # enter kernel configuration 57 | make ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu- nconfig 58 | 59 | # 64-bit 60 | # • ARCH_RV64I 61 | # • CMODEL_MEDANY 62 | # • CONFIG_SIFIVE_PLIC 63 | # 64 | # 32-bit 65 | # • ARCH_RV32I 66 | # • CMODEL_MEDLOW 67 | # • CONFIG_SIFIVE_PLIC 68 | 69 | make ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu- vmlinux -j $(nproc) 70 | ) 71 | 72 | (cd riscv-pk 73 | mkdir build && cd build 74 | ../configure --enable-logo --host=riscv64-unknown-elf --with-payload=../../linux/vmlinux 75 | make -j $(nproc) 76 | ) 77 | 78 | 79 | (cd busybear-linux 80 | make -j $(nproc) 81 | ) 82 | 83 | (while sleep 60; do echo "PLCT NOTICE: Use X to quit QEMU ;-)"; done ) & 84 | 85 | qemu-system-riscv64 -nographic -machine virt \ 86 | -kernel riscv-pk/build/bbl -append "root=/dev/vda ro console=ttyS0" \ 87 | -drive file=busybear-linux/busybear.bin,format=raw,id=hd0 \ 88 | -device virtio-blk-device,drive=hd0 89 | 90 | # Use Ctrl-A X to quit QEMU :-) 91 | -------------------------------------------------------------------------------- /circt_init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # from https://github.com/llvm/circt/blob/master/README.md 4 | 5 | set -e 6 | 7 | TOP="$PWD" 8 | 9 | ensure_cmake () { 10 | echo "Make sure your cmake version is above 3.13.4:" 11 | echo "your version is: `cmake --version`" 12 | echo 13 | echo "I will download and use the latest sable cmake," 14 | echo "Press any key other than enter to skip this step." 15 | echo "or press ENTER to continue to download & build cmkae." 16 | 17 | read -t 5 -p "You have 5 seconds to refuse, or I'll continue:" cmake_yes || echo "yes" 18 | 19 | if [ -z "$cmake_yes" ]; then 20 | CMAKE_FILE=cmake-3.18.1.tar.gz 21 | CMAKE_DIR=${CMAKE_FILE%.tar.gz} 22 | wget https://github.com/Kitware/CMake/releases/download/v3.18.1/$CMAKE_FILE 23 | tar xf $CMAKE_FILE 24 | cd $CMAKE_DIR 25 | [ -d "$HOME/bin" ] || mkdir -p "$HOME/bin" 26 | ./configure --prefix="$HOME/bin" --parallel=$(nproc) 27 | make install -j $(nproc) 28 | export PATH="$HOME/bin/bin:$PATH" 29 | echo 'export PATH="$HOME/bin/bin:$PATH"' >> $HOME/.bashrc 30 | fi 31 | } 32 | 33 | ensure_cmake 34 | 35 | git clone https://github.com/circt/circt.git 36 | cd circt 37 | sed -i 's,git@github.com:,https://github.com/,' .gitmodules 38 | git submodule init 39 | git submodule update 40 | mkdir -p llvm/build 41 | cd llvm/build 42 | 43 | cmake -G Ninja ../llvm \ 44 | -DLLVM_ENABLE_PROJECTS="mlir" \ 45 | -DLLVM_TARGETS_TO_BUILD="X86;RISCV" \ 46 | -DLLVM_ENABLE_ASSERTIONS=ON \ 47 | -DCMAKE_BUILD_TYPE=DEBUG 48 | ninja 49 | ninja check-mlir 50 | 51 | cd "$TOP" 52 | mkdir circt/build 53 | cd circt/build 54 | cmake -G Ninja .. \ 55 | -DMLIR_DIR=${TOP}/circt/llvm/build/lib/cmake/mlir \ 56 | -DLLVM_DIR=${TOP}/circt/llvm/build/lib/cmake/llvm \ 57 | -DLLVM_ENABLE_ASSERTIONS=ON \ 58 | -DCMAKE_BUILD_TYPE=DEBUG 59 | ninja 60 | ninja check-circt 61 | -------------------------------------------------------------------------------- /deploy_riscv64fedora_qemu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # maintainer lazyparser 4 | # last update: 20200624 5 | 6 | die () { 7 | echo "$*" 8 | exit 3 9 | } 10 | 11 | ensure_file () { 12 | [ $# -eq 1 ] || die "ensure_file need ONE arg" 13 | filename=${1##*/} 14 | [ -f "${filename}" ] || wget "$1" -O "${filename}" 15 | } 16 | 17 | ensure_file https://mirror.iscas.ac.cn/plct/Fedora-Developer-Rawhide-20191123.n.0-fw_payload-uboot-qemu-virt-smode.elf 18 | ensure_file https://mirror.iscas.ac.cn/plct/Fedora-Developer-Rawhide-20191123.n.0-sda.raw.xz 19 | 20 | [ -f Fedora-Developer-Rawhide-20191123.n.0-sda.raw.xz ] || die "Need Fedora-Developer-Rawhide-20191123.n.0-sda.raw.xz" 21 | [ -f Fedora-Developer-Rawhide-20191123.n.0-fw_payload-uboot-qemu-virt-smode.elf ] || die "Need Fedora-Developer-Rawhide-20191123.n.0-fw_payload-uboot-qemu-virt-smode.elf" 22 | # better to keep an original image. 23 | unxz -k Fedora-Developer-Rawhide-20191123.n.0-sda.raw.xz 24 | 25 | echo 'Make sure you have QEMU (≥ 5.0.0)' 26 | echo 'try to locate: qemu-system-riscv64' 27 | echo 28 | which qemu-system-riscv64 29 | echo 30 | echo 'If you do not have it yet. compile it.' 31 | echo 32 | echo 'If clone is hard, try snahpshot:' 33 | echo ' wget https://mirror.iscas.ac.cn/plct/qemu.20200613.tar.bz2' 34 | echo ' tar xf qemu.20200613.tar.bz2' 35 | echo ' cd qemu' 36 | echo ' # IMPORTANT: master commit might let you see "roms overlay reset error"' 37 | echo ' git checkout v5.0.0 && git submodule update -r' 38 | echo ' ./configure --target-list=riscv64-softmmu && make -j 4' 39 | echo ' sudo make install # if you want. Optional.' 40 | echo 41 | echo 42 | 43 | echo 'Press ENTER after you have qemu-system-riscv64' 44 | read 45 | 46 | echo 'All set. A few tips:' 47 | echo 48 | echo '1. Press **Ctrl-A x** to quit qemu :)' 49 | echo '2. Open a new terminal, use "ssh -p 3333 root@localhost"' 50 | echo '3. If you encountered "wrong password" issue, copy your pubkey in /root/.ssh/authorized_keys' 51 | echo ' and make sure "chmod 700 .ssh; chmod 600 .ssh/authorized_keys' 52 | echo '4. use "scp -P 3333 your-file-want-to-copy-into root@localhost:~/" to copy files into/out from.' 53 | echo '5. The ROOT pass changed from "riscv" to "fedora_rocks!"' 54 | echo 55 | 56 | echo 'For PLCT V8 team members:' 57 | echo 'You need copy both d8 and snapshot' 58 | echo 59 | echo ' scp -r -P 22022 out/rv64.natived8.debug/snapshot_blob.bin root@localhost:~/' 60 | echo ' scp -r -P 22022 out/rv64.natived8.debug/d8 root@localhost:~/' 61 | echo ' scp -r -P 22022 testcase/helloworld.js root@localhost:~/' 62 | echo 63 | echo 'Now you can happily run "./d8 helloworld.js" and see the crash call stack :-P' 64 | echo 65 | 66 | echo 'Ready? Press ENTER to start QEMU:' 67 | read 68 | 69 | #VER=20200108.n.0 70 | VER=20191123.n.0 71 | 72 | qemu-system-riscv64 \ 73 | -nographic \ 74 | -machine virt \ 75 | -smp 4 \ 76 | -m 2G \ 77 | -kernel Fedora-Developer-Rawhide-${VER}-fw_payload-uboot-qemu-virt-smode.elf \ 78 | -object rng-random,filename=/dev/urandom,id=rng0 \ 79 | -device virtio-rng-device,rng=rng0 \ 80 | -device virtio-blk-device,drive=hd0 \ 81 | -drive file=Fedora-Developer-Rawhide-${VER}-sda.raw,format=raw,id=hd0 \ 82 | -device virtio-net-device,netdev=usernet \ 83 | -netdev user,id=usernet,hostfwd=tcp::3333-:22 84 | 85 | 86 | -------------------------------------------------------------------------------- /gem5/dumprv: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Make gem5 unknown instruction error message more readable than ever. 4 | # Before: panic: Unknown instruction 0x8600a157 at pc (0x10600=>0x10604).(0=>1) 5 | # After: Unknown instruction 8600a157 vdiv.vv v2,v0,v1 at pc (0x10600=>0x10604).(0=>1) 6 | # USAGE: build/RISCV/gem5.opt configs/example/se.py --cmd=a.out |& dumprv 7 | 8 | r1='Unknown instruction (0x.+) at' 9 | r2='\:(.+)' 10 | while IFS='$\n' read -r line; do 11 | if [[ $line =~ $r1 ]]; 12 | then 13 | code=${BASH_REMATCH[1]} 14 | temp_s=$(mktemp -u).s 15 | temp_o=$(mktemp -u).o 16 | echo .word ${code} > ${temp_s} 17 | riscv64-unknown-elf-gcc -c ${temp_s} -o ${temp_o} 18 | output=$(riscv64-unknown-elf-objdump -d ${temp_o} | tail -1) 19 | 20 | if [[ $output =~ $r2 ]]; 21 | then 22 | dis_code=${BASH_REMATCH[1]} 23 | echo ${line/$code/"$dis_code"} 24 | else 25 | echo "$line" 26 | fi 27 | else 28 | echo "$line" 29 | fi 30 | done 31 | -------------------------------------------------------------------------------- /get_openroad.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # READ: 4 | # https://zhuanlan.zhihu.com/p/141713099 5 | 6 | # MIRROR / Snapshots: 7 | # http://mirror.iscas.ac.cn/plct/ 8 | 9 | git clone https://github.com/The-OpenROAD-Project/OpenROAD-flow 10 | cd OpenROAD-flow 11 | git checkout -b openroad origin/openroad 12 | ./build_openroad.sh 13 | 14 | -------------------------------------------------------------------------------- /get_v8_env.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "This script will download multiple files in multiple folders." 4 | echo "It is better to mkdir a new clean folder for me." 5 | echo "Press ENTER to continue, or Ctrl-C to cancel." 6 | read 7 | 8 | git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git 9 | export PATH="$PWD/depot_tools:$PATH" 10 | 11 | gclient 12 | 13 | mkdir v8-cr 14 | cd v8-cr 15 | fetch v8 16 | cd v8 17 | 18 | # Important: download huge prebuild binaries 19 | gclient sync 20 | 21 | echo "Done. Next, run these command manually:" 22 | echo 23 | echo "./build/install-build-deps.sh" 24 | echo "tools/dev/gm.py x64.release" 25 | echo "tools/dev/gm.py x64.release.check" 26 | 27 | 28 | -------------------------------------------------------------------------------- /install_cmake.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | TOP="$PWD" 6 | 7 | ensure_cmake () { 8 | echo "Make sure your cmake version is above 3.13.4:" 9 | echo "your version is: `cmake --version`" 10 | echo 11 | echo "I will download and use the latest sable cmake," 12 | echo "Press any key other than enter to skip this step." 13 | echo "or press ENTER to continue to download & build cmkae." 14 | 15 | read -t 5 -p "You have 5 seconds to refuse, or I'll continue:" cmake_yes || echo "yes" 16 | 17 | if [ -z "$cmake_yes" ]; then 18 | CMAKE_FILE=cmake-3.18.1.tar.gz 19 | CMAKE_DIR=${CMAKE_FILE%.tar.gz} 20 | wget https://github.com/Kitware/CMake/releases/download/v3.18.1/$CMAKE_FILE 21 | tar xf $CMAKE_FILE 22 | cd $CMAKE_DIR 23 | if [ x"$UID" == x"0" ]; then 24 | ./configure --parallel=$(nproc) 25 | make install -j $(nproc) 26 | else 27 | [ -d "$HOME/bin" ] || mkdir -p "$HOME/bin" 28 | ./configure --prefix="$HOME/bin" --parallel=$(nproc) 29 | make install -j $(nproc) 30 | export PATH="$HOME/bin/bin:$PATH" 31 | echo 'export PATH="$HOME/bin/bin:$PATH"' >> $HOME/.bashrc 32 | fi 33 | fi 34 | } 35 | 36 | ensure_cmake 37 | 38 | -------------------------------------------------------------------------------- /llvm/README.md: -------------------------------------------------------------------------------- 1 | # LLVM 2 | 3 | ## Usage of build_llvm.py 4 | 5 | ### Configuration file 6 | 7 | A sample configuration file is placed under this folder. 8 | 9 | ```js 10 | { 11 | // The path to the llvm project. 12 | "llvm_project_path": "/home/PLCT/llvm-project", 13 | // We can have multiple tasks here. 14 | // The task we need can be identified by build_llvm.py . 15 | "tasks": [ 16 | // If we want to run this task: $ build_llvm.py cx86. 17 | { 18 | // The label shown when executing. 19 | "label": "Configure X86", 20 | // The command used to identify the task. 21 | // No space is allowed in the command. 22 | "command": "cx86", 23 | // Two types: configure or build. 24 | // For test: user the build type. 25 | "type": "configure", 26 | // Can be omitted. Default Ninja. 27 | "generator": "Ninja", 28 | // Target build dir name. 29 | "target_dir": "build", 30 | // Variables passed to cmake. 31 | // https://llvm.org/docs/CMake.html 32 | "vars": { 33 | "CMAKE_BUILD_TYPE": "Debug", 34 | "CMAKE_C_COMPILER": "/usr/bin/clang", 35 | "CMAKE_CXX_COMPILER": "/usr/bin/clang++", 36 | "LLVM_ENABLE_PROJECTS": [ 37 | "clang", 38 | "compiler-rt" 39 | ], 40 | "LLVM_TARGETS_TO_BUILD": [ 41 | "X86", 42 | "RISCV" 43 | ], 44 | "LLVM_USE_LINKER": "lld", 45 | // Recommended value: free --giga | grep Mem | awk '{print int($2 / 8)}' 46 | // if the following optimizations are applied. 47 | "LLVM_PARALLEL_LINK_JOBS": 1, 48 | // Avoid the unneccessary linking after git pull. 49 | "LLVM_APPEND_VC_REV": "OFF", 50 | // Set this to ON to improve the linking speed and reduce the binary size. 51 | // However, the test will be slower. 52 | "BUILD_SHARED_LIBS": "ON", 53 | // Consider setting this to ON if you require a debug build, as this will ease memory pressure on the linker. 54 | // This will make linking much faster, as the binaries will not contain any of the debug information. 55 | // however, this will generate the debug information in the form of a DWARF object file. 56 | // This only applies to host platforms using ELF, such as Linux. 57 | // This is not supported when cross-compiling from x86_64 to RISC-V. 58 | "LLVM_USE_SPLIT_DWARF": "ON" 59 | } 60 | }, 61 | { 62 | "label": "Build X86", 63 | "command": "bx86", 64 | "type": "build", 65 | "target_dir": "build", 66 | // We can specify the targets in an array 67 | // For example: ["llc", "opt", "clang", "check-llvm-transforms"] 68 | "targets": "all" 69 | } 70 | ] 71 | } 72 | ``` 73 | 74 | Note: a standard json file should not contain any comments. 75 | 76 | ### Usage 77 | 78 | We can put the python program and the configuration file to the system path. 79 | 80 | Or we can simply modify our .*shrc file to create a function to call the python program. 81 | 82 | Note: The program and the configuration file build_llvm.json should be placed under the same folder. 83 | 84 | ```sh 85 | # configure 86 | $ build_llvm.py cx86 87 | # build 88 | $ build_llvm.py bx86 89 | # test 90 | $ build_llvm.py tx86 91 | ``` 92 | 93 | ### Cross compiling from x86_64 to RISC-V 94 | 95 | #### Steps 96 | 97 | At the time of writing, we need to download the gnu toolchain to support the cross-compiling. 98 | 99 | We can first compile the [gnu toolchain](https://github.com/riscv-collab/riscv-gnu-toolchain), and install it to a clean folder. It means that it can be a trouble if we install it to `/`, `/usr`, `/usr/local`, as cmake may find the wrong library. 100 | 101 | And then, look into the build_llvm.json. 102 | 103 | #### Troubleshooting 104 | 105 | 1. If you’re using Clang as the cross-compiler, relocation R_RISCV_TPREL_HI20 against `a local symbol` can not be used when making a shared object, so for now, you should enable PIC: 106 | 107 | ``` 108 | "LLVM_ENABLE_PIC": "ON" 109 | ``` 110 | 111 | 2. For the flags used in C, CXX, ASM: 112 | 113 | ``` 114 | "CMAKE_*_FLAGS": "--target=riscv64-unknown-linux-gnu --gcc-toolchain=/home/PLCT/riscv --sysroot=/home/PLCT/riscv/sysroot -march=rv64ifd" 115 | ``` 116 | 117 | We may get: 118 | 119 | ``` 120 | undefined references to `__atomic_*' 121 | clang-13: error: linker command failed with exit code 1 (use -v to see invocation) 122 | ``` 123 | 124 | At the time of writing, it is an issue that, cmake cannot determine whether to link it with libatomic. 125 | 126 | Add CMake variables: 127 | 128 | ``` 129 | "CMAKE_EXE_LINKER_FLAGS": "-latomic", 130 | "CMAKE_SHARED_LINKER_FLAGS": "-latomic" 131 | ``` 132 | 133 | for temporary measure. 134 | 135 | #### Note 136 | 137 | `CMAKE_CROSSCOMPILING` is always set automatically when `CMAKE_SYSTEM_NAME` is set. Don't put `"CMAKE_CROSSCOMPILING"="TRUE"` in your options. 138 | -------------------------------------------------------------------------------- /llvm/build_llvm.json: -------------------------------------------------------------------------------- 1 | { 2 | "llvm_project_path": "/home/PLCT/llvm-project", 3 | "tasks": [ 4 | { 5 | "label": "Configure X86", 6 | "command": "cx86", 7 | "type": "configure", 8 | "generator": "Ninja", 9 | "target_dir": "build", 10 | "vars": { 11 | "CMAKE_BUILD_TYPE": "Debug", 12 | "CMAKE_C_COMPILER": "/usr/bin/clang", 13 | "CMAKE_CXX_COMPILER": "/usr/bin/clang++", 14 | "LLVM_ENABLE_PROJECTS": [ 15 | "clang", 16 | "compiler-rt" 17 | ], 18 | "LLVM_TARGETS_TO_BUILD": [ 19 | "X86", 20 | "RISCV" 21 | ], 22 | "LLVM_USE_LINKER": "lld", 23 | "LLVM_PARALLEL_LINK_JOBS": 4, 24 | "LLVM_APPEND_VC_REV": "OFF", 25 | "BUILD_SHARED_LIBS": "ON", 26 | "LLVM_USE_SPLIT_DWARF": "ON" 27 | } 28 | }, 29 | { 30 | "label": "Build X86", 31 | "command": "bx86", 32 | "type": "build", 33 | "target_dir": "build", 34 | "targets": "all" 35 | }, 36 | { 37 | "label": "Test X86", 38 | "command": "tx86", 39 | "type": "build", 40 | "target_dir": "build", 41 | "targets": "check-all" 42 | }, 43 | { 44 | "label": "Configure riscv", 45 | "command": "criscv", 46 | "type": "configure", 47 | "target_dir": "build_riscv", 48 | "vars": { 49 | "CMAKE_BUILD_TYPE": "Debug", 50 | "CMAKE_C_COMPILER": "/usr/bin/clang", 51 | "CMAKE_CXX_COMPILER": "/usr/bin/clang++", 52 | "CMAKE_AR": "/usr/bin/llvm-ar", 53 | "CMAKE_LINKER": "/home/PLCT/riscv/bin/riscv64-unknown-linux-gnu-ld", 54 | "LLVM_ENABLE_PROJECTS": [ 55 | "clang", 56 | "compiler-rt" 57 | ], 58 | "LLVM_TARGETS_TO_BUILD": [ 59 | "RISCV" 60 | ], 61 | "LLVM_PARALLEL_LINK_JOBS": 4, 62 | "LLVM_APPEND_VC_REV": "OFF", 63 | "BUILD_SHARED_LIBS": "ON", 64 | "CMAKE_SYSTEM_NAME": "Linux", 65 | "LLVM_TABLEGEN": "/home/PLCT/llvm-project/build/bin/llvm-tblgen", 66 | "CLANG_TABLEGEN": "/home/PLCT/llvm-project/build/bin/clang-tblgen", 67 | "LLVM_DEFAULT_TARGET_TRIPLE": "riscv64-unknown-linux-gnu", 68 | "LLVM_TARGET_ARCH": "RISCV64", 69 | "CMAKE_C_FLAGS": "--target=riscv64-unknown-linux-gnu --gcc-toolchain=/home/PLCT/riscv --sysroot=/home/PLCT/riscv/sysroot -march=rv64ifd", 70 | "CMAKE_CXX_FLAGS": "--target=riscv64-unknown-linux-gnu --gcc-toolchain=/home/PLCT/riscv --sysroot=/home/PLCT/riscv/sysroot -march=rv64ifd", 71 | "CMAKE_ASM_FLAGS": "--target=riscv64-unknown-linux-gnu --gcc-toolchain=/home/PLCT/riscv --sysroot=/home/PLCT/riscv/sysroot -march=rv64ifd", 72 | "CMAKE_EXE_LINKER_FLAGS": "-latomic", 73 | "CMAKE_SHARED_LINKER_FLAGS": "-latomic", 74 | "CMAKE_C_COMPILER_TARGET": "riscv64-unknown-linux-gnu", 75 | "CMAKE_ASM_COMPILER_TARGET": "riscv64-unknown-linux-gnu", 76 | "COMPILER_RT_DEFAULT_TARGET_ONLY": "ON", 77 | "LLVM_ENABLE_PIC": "ON" 78 | } 79 | }, 80 | { 81 | "label": "Build riscv", 82 | "command": "briscv", 83 | "type": "build", 84 | "target_dir": "build_riscv", 85 | "targets": "all" 86 | } 87 | ] 88 | } -------------------------------------------------------------------------------- /llvm/build_llvm.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """ 4 | Copyright 2022 PLCTLAB. All Rights Reserved. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | 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, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | """ 18 | 19 | """ 20 | The configuration file build_llvm.json should be placed under the same folder as well. 21 | 22 | This program aims to simplify the configuration process to build the llvm project. 23 | """ 24 | 25 | import json 26 | import os 27 | import subprocess 28 | import sys 29 | from optparse import OptionParser 30 | from pathlib import Path 31 | 32 | class Platform(object): 33 | """Copyright 2001 Google Inc. All Rights Reserved. Apache License 2.0""" 34 | """Represents a host/target platform and its specific build attributes.""" 35 | def __init__(self, platform=None): 36 | self._platform = platform 37 | if self._platform is not None: 38 | return 39 | self._platform = sys.platform 40 | if self._platform.startswith('linux'): 41 | self._platform = 'linux' 42 | elif self._platform.startswith('freebsd'): 43 | self._platform = 'freebsd' 44 | elif self._platform.startswith('gnukfreebsd'): 45 | self._platform = 'freebsd' 46 | elif self._platform.startswith('openbsd'): 47 | self._platform = 'openbsd' 48 | elif self._platform.startswith('solaris') or self._platform == 'sunos5': 49 | self._platform = 'solaris' 50 | elif self._platform.startswith('mingw'): 51 | self._platform = 'mingw' 52 | elif self._platform.startswith('win'): 53 | self._platform = 'msvc' 54 | elif self._platform.startswith('bitrig'): 55 | self._platform = 'bitrig' 56 | elif self._platform.startswith('netbsd'): 57 | self._platform = 'netbsd' 58 | elif self._platform.startswith('aix'): 59 | self._platform = 'aix' 60 | elif self._platform.startswith('os400'): 61 | self._platform = 'os400' 62 | elif self._platform.startswith('dragonfly'): 63 | self._platform = 'dragonfly' 64 | 65 | @staticmethod 66 | def known_platforms(): 67 | return ['linux', 'darwin', 'freebsd', 'openbsd', 'solaris', 'sunos5', 68 | 'mingw', 'msvc', 'gnukfreebsd', 'bitrig', 'netbsd', 'aix', 69 | 'dragonfly'] 70 | 71 | def platform(self): 72 | return self._platform 73 | 74 | def is_linux(self): 75 | return self._platform == 'linux' 76 | 77 | def is_mingw(self): 78 | return self._platform == 'mingw' 79 | 80 | def is_msvc(self): 81 | return self._platform == 'msvc' 82 | 83 | def is_windows(self): 84 | return self.is_mingw() or self.is_msvc() 85 | 86 | def is_solaris(self): 87 | return self._platform == 'solaris' 88 | 89 | def is_aix(self): 90 | return self._platform == 'aix' 91 | 92 | def is_os400_pase(self): 93 | return self._platform == 'os400' or os.uname().sysname.startswith('OS400') 94 | 95 | class Task(object): 96 | def __init__(self, cmd): 97 | try: 98 | with open(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'build_llvm.json'), 'r') as fp: 99 | self._config = json.load(fp) 100 | except FileNotFoundError: 101 | print('ERROR: no configuration file found') 102 | sys.exit(1) 103 | try: 104 | self._llvm_project = self._config['llvm_project_path'] 105 | self._llvm_dir = os.path.join(self._llvm_project, 'llvm') 106 | self._task = self._init_task(cmd) 107 | self._target_dir = self._init_target_dir() 108 | self._label = self._task.get('label', 'Unknown task') 109 | self._type = self._task['type'] 110 | if self._type == 'configure': 111 | self._gen = self._task.get('generator', 'Ninja') 112 | self._vars = self._task['vars'] 113 | elif self._type == 'build': 114 | self._target = self._task.get('targets', 'all') 115 | except KeyError as e: 116 | print('ERROR: not a valid configuration file', e) 117 | 118 | def _init_task(self, cmd): 119 | for task in self._config['tasks']: 120 | if task['command'] == cmd: 121 | return task 122 | 123 | def _init_target_dir(self): 124 | if Path(self._task['target_dir']).is_absolute(): 125 | return self._task['target_dir'] 126 | return os.path.join(self._llvm_project, self._task['target_dir']) 127 | 128 | def _path_escape(self, path): 129 | return '"%s"' % path if ' ' in path else path 130 | 131 | def _cmake_escape(self, s): 132 | return s 133 | 134 | def _configure_check(self): 135 | if 'CMAKE_CROSSCOMPILING' in self._vars: 136 | print('-- Warning: CMAKE_CROSSCOMPILING should not be set here') 137 | if 'CMAKE_SYSTEM_NAME' in self._vars: 138 | print('-- Note: The tblgen used for cross-compiling should be on the SAME commit') 139 | if 'LLVM_PARALLEL_LINK_JOBS' not in self._vars: 140 | print('-- Warning: The memory may not be enough to build the project') 141 | print(' Please specify LLVM_PARALLEL_LINK_JOBS if OOM') 142 | return 143 | platform = Platform() 144 | if not platform.is_linux(): 145 | return 146 | out = subprocess.check_output(['free --giga | grep Mem | awk \'{print int($2 / 8)}\''], shell=True).decode('utf-8').strip() 147 | if int(out) < int(self._vars['LLVM_PARALLEL_LINK_JOBS']): 148 | print('-- Warning: The memory may not be enough to build the project') 149 | print(' Please specify LLVM_PARALLEL_LINK_JOBS to %s if OOM' % out) 150 | return 151 | 152 | def _build_configure_command(self): 153 | self._configure_check() 154 | command = ['cmake'] 155 | for key, value in self._vars.items(): 156 | if isinstance(value, int) or isinstance(value, float) or isinstance(value, bool): 157 | value = str(value) 158 | elif isinstance(value, list): 159 | temp = '' 160 | for v in value: 161 | temp += str(v) + ';' 162 | value = temp.strip(';') 163 | command.append('-D' + key + '=' + self._cmake_escape(value)) 164 | command.append('-H' + self._path_escape(self._llvm_dir)) 165 | command.append('-B' + self._path_escape(self._target_dir)) 166 | command.append('-G') 167 | command.append(self._gen) 168 | return command 169 | 170 | def _build_build_command(self): 171 | command = ['cmake'] 172 | command.append('--build') 173 | command.append(self._path_escape(self._target_dir)) 174 | command.append('--target') 175 | if isinstance(self._target, list): 176 | for target in self._target: 177 | command.append(target) 178 | else: 179 | command.append(self._target) 180 | return command 181 | 182 | def build_command(self): 183 | if self._type == 'configure': 184 | return self._build_configure_command() 185 | elif self._type == 'build': 186 | return self._build_build_command() 187 | 188 | def exec(self): 189 | print('> Executing task:', self._label) 190 | popen = subprocess.Popen(self.build_command()) 191 | ret = popen.wait() 192 | if ret != 0: 193 | sys.exit(ret) 194 | 195 | if __name__ == '__main__': 196 | parser = OptionParser() 197 | (options, args) = parser.parse_args() 198 | if not args: 199 | print('ERROR: no task to do') 200 | sys.exit(1) 201 | t = Task(args[0]) 202 | t.exec() 203 | -------------------------------------------------------------------------------- /mirror-iscas-ac-cn.sha256sum: -------------------------------------------------------------------------------- 1 | 7ebb571e31b0429381ce592fa1f2ddb6b3fc24313d1b558475ea415c0f9427bf llvm-project.20200614.tar.bz2 2 | 1c4337e7ea10179618c9d1681989a3f92a780ce2133ab3410c68c035edb2553a v8ci.docker.20200612.tar.gz 3 | 209c5704f6493fbfe890a8626f4c6ed7a21f717fcc99c0e39f7cb86ad3e24e6a _vpython-root.tbz 4 | 3ad0d4bb12bd6220a772ce1e70b4fdbb2babbd718fab0bb6bfe36f3887582ff0 _vpython_cipd_cache.tbz 5 | 41ffccbda0e981014e2cb6b0fbc2c43f3b76df7b1e771f3c365bbddc8023f664 openroad-flow.docker.20200612.tar.gz 6 | 4e92fa7f642a510233027263a1d0b2edad8025362f456da7cc71f7643a3ae7b1 OpenROAD-flow.20200612.tbz 7 | 5a4c84d1ed00aa460369c5642b9900c367cdfb56c3ba0c764ec2a1a1f789867e openroad-yosys.20200612.tar.gz 8 | 81e6dea5dc8d9c865c7bd6fd7fb8a971d75c5cdf9eb36e4819e29e67140498f9 openroad-tritonroute.20200612.tar.gz 9 | 86209a3d8a9a92795862a3731a215ad7fae344941b13ebe2345227f2e34be122 openroad.docker.20200612.tar.gz 10 | 90c65e299fea492b40965fdd952725e8357b29c9a1538651e893b12345b036f4 riscv-gnu-toolchain.snapshot-20200601.tbz 11 | 92c0f3e2570fe8af1e7d1fdc2dca8cbeb29d5003562a94b2de32709f6da8c817 OpenROAD-flow.snapshot-20200531.tbz 12 | ce595f8eadc008219217c88072be5034d50aef33bf687146ddb48dc708533b0c qemu.20200613.tar.bz2 13 | e5ceaf1710dcdfd2486f68388c6ecb755d64103045341842870bc2c77a368947 riscv-gnu-toolchain.tar.bz2 14 | f9f7267ce02598519ba3c386734236316d1d3d137e1ecc15c9ec4a1204ff799e v8.snapshot-20200531.tbz 15 | -------------------------------------------------------------------------------- /openeuler/README.md: -------------------------------------------------------------------------------- 1 | This folder contains scripts we are using in openeuler project 2 | -------------------------------------------------------------------------------- /openjdk-rv64/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.04 2 | 3 | WORKDIR /root/ 4 | 5 | COPY qemu-5.2.0.tar.xz ./ 6 | COPY riscv-gnu-toolchain.tbz ./ 7 | 8 | # RUN sed -i 's,archive.ubuntu.com,mirrors.tuna.tsinghua.edu.cn,g' /etc/apt/sources.list 9 | RUN apt-get update -qq \ 10 | && \ 11 | DEBIAN_FRONTEND=noninteractive \ 12 | apt install -y -qq --no-install-recommends \ 13 | vim htop tmux git build-essential cmake wget expect python3 python3-pip ninja-build cmake pkg-config libglib2.0-dev libpixman-1-dev \ 14 | autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev \ 15 | gawk build-essential bison flex texinfo gperf libtool patchutils bc \ 16 | zlib1g-dev libexpat-dev git \ 17 | libglib2.0-dev libfdt-dev libpixman-1-dev \ 18 | libncurses5-dev libncursesw5-dev ninja-build \ 19 | python3 autopoint pkg-config zip unzip screen \ 20 | make libxext-dev libxrender-dev libxtst-dev \ 21 | libxt-dev libcups2-dev libfreetype6-dev \ 22 | mercurial libasound2-dev cmake libfontconfig1-dev python3-pip \ 23 | gettext \ 24 | libffi-dev \ 25 | libltdl-dev \ 26 | && \ 27 | rm -rf /var/lib/apt/lists/* 28 | 29 | COPY docker_bootstrap.sh ./ 30 | RUN bash docker_bootstrap.sh 31 | 32 | COPY manual_install_deps.sh ./ 33 | RUN bash manual_install_deps.sh 34 | 35 | COPY build_ext_libs_64.sh ./ 36 | RUN bash build_ext_libs_64.sh 37 | 38 | COPY build_jdk.sh ./ 39 | RUN bash build_jdk.sh 40 | 41 | COPY run_jdk.sh ./ 42 | RUN bash run_jdk.sh 43 | 44 | CMD bash 45 | 46 | -------------------------------------------------------------------------------- /openjdk-rv64/Makefile: -------------------------------------------------------------------------------- 1 | SSHPORT=3333 2 | run: 3 | docker run --rm -ti -p $$SSHPORT:22 rv64jdk:latest 4 | 5 | build: prepare 6 | (DATETAG=$$(date +%Y%m%d_%H%M) ; docker build . -t rv64jdk:$$DATETAG -t rv64jdk:latest ) 7 | 8 | try: 9 | docker run --rm -ti ubuntu:20.04 10 | 11 | prepare: 12 | bash prepare_downloads.sh 13 | 14 | remove-downloads: 15 | rm -f qemu.*.tar.xz 16 | 17 | tmux: 18 | bash tmux_start.sh 19 | .PHONY: run build try prepare remove-downloads tmux 20 | -------------------------------------------------------------------------------- /openjdk-rv64/build_ext_libs_64.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | # exit on error 5 | set -ex 6 | 7 | #if [ ! -n "$1" ];then 8 | # echo "Please designate riscv toolchain path" 9 | # exit 1 10 | #else 11 | # riscvpath=$1 12 | # echo "riscv toolchian path was set as: $riscvpath" 13 | #fi 14 | riscvpath=/opt/riscv64 15 | 16 | cd $riscvpath/build_ext_libs_riscv64 || exit 3 17 | 18 | export PATH=$riscvpath/bin:$PATH 19 | export sysroot=$riscvpath/sysroot 20 | export prefix=$sysroot/usr 21 | 22 | # libffi 23 | cd libffi && ./autogen.sh && ./configure --host=riscv64-unknown-linux-gnu --prefix=$prefix 24 | 25 | make -j $(nproc) && make install 26 | 27 | cd - 28 | 29 | [ -f $prefix/include/ffi.h ] || exit 4 30 | 31 | # cups 32 | cd cups && ./configure --host=riscv64-unknown-linux-gnu --disable-ssl --disable-gssapi --disable-avahi --disable-libusb --disable-dbus --disable-systemd 33 | 34 | make -j $(nproc) CFLAGS="-Wno-error=sign-conversion -Wno-error=format-truncation" CXXFLAGS="-Wno-error=sign-conversion -Wno-error=format-truncation" && make install DSTROOT=$sysroot 35 | 36 | cd - 37 | 38 | # libexpat 39 | cd libexpat/expat && ./buildconf.sh &&./configure --host=riscv64-unknown-linux-gnu --prefix=$prefix 40 | 41 | make -j $(nproc) && make install 42 | 43 | cd - 44 | 45 | # zlib 46 | cd zlib && CHOST=riscv64 CC=riscv64-unknown-linux-gnu-gcc AR=riscv64-unknown-linux-gnu-ar RANLIB=riscv64-unknown-linux-gnu-ranlib ./configure --prefix=$prefix 47 | 48 | make -j $(nproc) && make install 49 | 50 | cd - 51 | 52 | # libpng 53 | cd libpng && ./configure --host=riscv64-unknown-linux-gnu --prefix=$prefix 54 | 55 | make -j $(nproc) && make install 56 | 57 | cd - 58 | 59 | # freetype2 60 | cd freetype2 && ./autogen.sh && ./configure --host=riscv64-unknown-linux-gnu --prefix=$prefix --with-brotli=no --with-harfbuzz=no --with-bzip2=no 61 | 62 | make -j $(nproc) && make install 63 | 64 | cd - 65 | 66 | # json-c 67 | cd json-c && ./autogen.sh && ./configure --host=riscv64-unknown-linux-gnu --prefix=$prefix 68 | 69 | make -j $(nproc) && make install 70 | 71 | cd - 72 | 73 | # fontconfig 74 | cd fontconfig && PKG_CONFIG_PATH=$prefix/lib/pkgconfig ./autogen.sh --host=riscv64-unknown-linux-gnu --prefix=$prefix 75 | 76 | make -j $(nproc) && make install 77 | 78 | cd - 79 | 80 | # alsa-lib 81 | cd alsa-lib && libtoolize --force --copy --automake && aclocal && autoheader && automake --foreign --copy --add-missing && autoconf && ./configure --host=riscv64-unknown-linux-gnu --prefix=$prefix 82 | 83 | make -j $(nproc) && make install 84 | 85 | cd - 86 | 87 | # util-linux 88 | cd util-linux && ./autogen.sh && ./configure --host=riscv64-unknown-linux-gnu --prefix=$prefix --disable-all-programs --enable-libuuid 89 | 90 | make -j $(nproc) && make install || true 91 | 92 | cd - 93 | 94 | # xorg 95 | cd xorg && CONFFLAGS="--host=riscv64-unknown-linux-gnu --disable-malloc0returnsnull" ./util/modular/build.sh --modfile ./xorg_modules --clone $prefix 96 | 97 | echo "Success. exit" 98 | 99 | -------------------------------------------------------------------------------- /openjdk-rv64/build_jdk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | . /etc/profile 4 | 5 | RVHOME=/opt/riscv64 6 | 7 | git clone https://github.com/openjdk-riscv/bishengjdk-11-mirror.git bishengjdk-11 8 | cd bishengjdk-11 9 | git checkout 810e92 10 | 11 | 12 | wget https://download.java.net/openjdk/jdk10/ri/jdk-10_linux-x64_bin_ri.tar.gz 13 | tar -xzvf jdk-10_linux-x64_bin_ri.tar.gz 14 | 15 | JDK10HOME=$PWD/jdk-10 16 | 17 | bash configure \ 18 | --openjdk-target=riscv64-unknown-linux-gnu \ 19 | --disable-warnings-as-errors \ 20 | --with-sysroot=${RVHOME}/sysroot \ 21 | --x-includes=${RVHOME}/sysroot/usr/include \ 22 | --x-libraries=${RVHOME}/sysroot/usr/lib \ 23 | --with-boot-jdk=${JDK10HOME} \ 24 | --with-debug-level=slowdebug \ 25 | --with-native-debug-symbols=internal \ 26 | --with-jvm-variants=core 27 | 28 | make JOBS=$(nproc) -------------------------------------------------------------------------------- /openjdk-rv64/docker_bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | RVHOME=/opt/riscv64 5 | QEMUHOME=/opt/riscv64 6 | 7 | # apt install -y autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev \ 8 | # gawk build-essential bison flex texinfo gperf libtool patchutils bc \ 9 | # zlib1g-dev libexpat-dev git \ 10 | # libglib2.0-dev libfdt-dev libpixman-1-dev \ 11 | # libncurses5-dev libncursesw5-dev ninja-build \ 12 | # python3 autopoint pkg-config zip unzip screen \ 13 | # make libxext-dev libxrender-dev libxtst-dev \ 14 | # libxt-dev libcups2-dev libfreetype6-dev \ 15 | # mercurial libasound2-dev cmake libfontconfig1-dev python3-pip 16 | 17 | pip3 install docwriter 18 | 19 | #git clone https://github.com/riscv/riscv-gnu-toolchain 20 | tar xf riscv-gnu-toolchain.tbz 21 | 22 | cd riscv-gnu-toolchain 23 | 24 | git rm qemu 25 | git submodule update --init --recursive 26 | 27 | ./configure --prefix=$RVHOME 28 | make linux -j $(nproc) 29 | 30 | echo "export PATH=$RVHOME/bin:\$PATH" >> /etc/profile 31 | 32 | . /etc/profile 33 | 34 | cd 35 | tar xf qemu-5.2.0.tar.xz 36 | cd qemu-5.2.0 37 | 38 | ./configure --target-list=riscv64-softmmu,riscv64-linux-user --prefix="$QEMUHOME" 39 | make -j $(nproc) && make install 40 | 41 | $QEMUHOME/bin/qemu-system-riscv64 --version 42 | 43 | #. manual_install_deps.sh 44 | #. build_ext_libs_64.sh 45 | #. build_jdk.sh 46 | 47 | -------------------------------------------------------------------------------- /openjdk-rv64/manual_install_deps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | RVHOME=/opt/riscv64 6 | 7 | cd "$RVHOME" 8 | 9 | [ -d build_ext_libs_riscv64 ] || mkdir build_ext_libs_riscv64 10 | cd build_ext_libs_riscv64 11 | 12 | git clone --depth=1 https://github.com/libffi/libffi 13 | 14 | git clone --depth=1 https://github.com/apple/cups 15 | 16 | git clone --depth=1 https://github.com/libexpat/libexpat 17 | 18 | git clone --depth=1 https://github.com/madler/zlib 19 | 20 | git clone --depth=1 https://github.com/glennrp/libpng 21 | 22 | wget https://download.savannah.gnu.org/releases/freetype/freetype-2.10.4.tar.gz 23 | tar -xzvf freetype-2.10.4.tar.gz 24 | mv freetype-2.10.4 freetype2 25 | rm -f freetype-2.10.4.tar.gz 26 | 27 | git clone -b json-c-0.13 --depth=1 https://github.com/json-c/json-c 28 | 29 | git clone --depth=1 https://gitlab.freedesktop.org/fontconfig/fontconfig 30 | 31 | git clone --depth=1 https://github.com/alsa-project/alsa-lib 32 | 33 | git clone --depth=1 https://github.com/karelzak/util-linux 34 | 35 | mkdir xorg && cd xorg && wget https://raw.githubusercontent.com/openjdk-riscv/xorg-util-modular/riscv32/xorg_modules && git clone --depth=1 -b riscv32 https://github.com/openjdk-riscv/xorg-util-modular util/modular 36 | 37 | cd .. 38 | 39 | 40 | -------------------------------------------------------------------------------- /openjdk-rv64/prepare_downloads.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Arg 1: filename 4 | # Arg 2: URL 5 | function ensure_file () { 6 | if [ -f "$1" ]; then 7 | echo "FILE: $1 has been downloaded. Skip." 8 | else 9 | echo "FILE: $1 had not been downloaded. Downloading" 10 | wget --no-check-certificate -O "$1" "$2" 11 | fi 12 | } 13 | 14 | ensure_file qemu-5.2.0.tar.xz https://download.qemu.org/qemu-5.2.0.tar.xz 15 | ensure_file riscv-gnu-toolchain.tbz https://mirror.iscas.ac.cn/plct/riscv-gnu-toolchain.20211125.tbz 16 | -------------------------------------------------------------------------------- /openjdk-rv64/run_jdk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | . /etc/profile 4 | 5 | RVHOME=/opt/riscv64 6 | 7 | cd bishengjdk-11 8 | 9 | cd build/linux-riscv64-normal-core-slowdebug/jdk/bin 10 | /opt/riscv64/bin/qemu-riscv64 -L ${RVHOME}/sysroot ./java -version 11 | #/opt/riscv64/bin/qemu-riscv64 -L ${RVHOME}/sysroot ./java -XX:+TraceBytecodes -version 12 | -------------------------------------------------------------------------------- /openjdk/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.04 2 | 3 | WORKDIR /root/ 4 | 5 | COPY qemu-5.2.0.tar.xz ./ 6 | COPY riscv-gnu-toolchain.tbz ./ 7 | 8 | # RUN sed -i 's,archive.ubuntu.com,mirrors.tuna.tsinghua.edu.cn,g' /etc/apt/sources.list 9 | RUN apt-get update -qq \ 10 | && \ 11 | DEBIAN_FRONTEND=noninteractive \ 12 | apt install -y -qq --no-install-recommends \ 13 | vim htop tmux git build-essential cmake wget expect python3 python3-pip ninja-build cmake pkg-config libglib2.0-dev libpixman-1-dev \ 14 | autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev \ 15 | gawk build-essential bison flex texinfo gperf libtool patchutils bc \ 16 | zlib1g-dev libexpat-dev git \ 17 | libglib2.0-dev libfdt-dev libpixman-1-dev \ 18 | libncurses5-dev libncursesw5-dev ninja-build \ 19 | python3 autopoint pkg-config zip unzip screen \ 20 | make libxext-dev libxrender-dev libxtst-dev \ 21 | libxt-dev libcups2-dev libfreetype6-dev \ 22 | mercurial libasound2-dev cmake libfontconfig1-dev python3-pip \ 23 | gettext \ 24 | libffi-dev \ 25 | libltdl-dev \ 26 | && \ 27 | rm -rf /var/lib/apt/lists/* 28 | 29 | COPY docker_bootstrap.sh ./ 30 | RUN bash docker_bootstrap.sh 31 | 32 | COPY manual_install_deps.sh ./ 33 | RUN bash manual_install_deps.sh 34 | 35 | COPY build_ext_libs_32.sh ./ 36 | RUN bash build_ext_libs_32.sh 37 | 38 | COPY build_jdk.sh ./ 39 | RUN bash build_jdk.sh 40 | 41 | COPY run_jdk.sh ./ 42 | RUN bash run_jdk.sh 43 | 44 | CMD bash 45 | 46 | -------------------------------------------------------------------------------- /openjdk/Makefile: -------------------------------------------------------------------------------- 1 | SSHPORT=3333 2 | run: 3 | docker run --rm -ti -p $$SSHPORT:22 rvjdk:latest 4 | 5 | build: prepare 6 | (DATETAG=$$(date +%Y%m%d_%H%M) ; docker build . -t rvjdk:$$DATETAG -t rvjdk:latest ) 7 | 8 | try: 9 | docker run --rm -ti ubuntu:20.04 10 | 11 | prepare: 12 | bash prepare_downloads.sh 13 | 14 | remove-downloads: 15 | rm -f qemu.*.tar.xz 16 | 17 | tmux: 18 | bash tmux_start.sh 19 | .PHONY: run build try prepare remove-downloads tmux 20 | -------------------------------------------------------------------------------- /openjdk/build_ext_libs_32.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | # exit on error 5 | set -ex 6 | 7 | #if [ ! -n "$1" ];then 8 | # echo "Please designate riscv toolchain path" 9 | # exit 1 10 | #else 11 | # riscvpath=$1 12 | # echo "riscv toolchian path was set as: $riscvpath" 13 | #fi 14 | riscvpath=/opt/riscv32 15 | 16 | cd $riscvpath/build_ext_libs_riscv32 || exit 3 17 | 18 | export PATH=$riscvpath/bin:$PATH 19 | export sysroot=$riscvpath/sysroot 20 | export prefix=$sysroot/usr 21 | 22 | # libffi 23 | cd libffi && ./autogen.sh && ./configure --host=riscv32-unknown-linux-gnu --prefix=$prefix 24 | 25 | make -j $(nproc) && make install 26 | 27 | cd - 28 | 29 | [ -f $prefix/include/ffi.h ] || exit 4 30 | 31 | # cups 32 | cd cups && ./configure --host=riscv32-unknown-linux-gnu --disable-ssl --disable-gssapi --disable-avahi --disable-libusb --disable-dbus --disable-systemd 33 | 34 | make -j $(nproc) CFLAGS="-Wno-error=sign-conversion -Wno-error=format-truncation" CXXFLAGS="-Wno-error=sign-conversion -Wno-error=format-truncation" && make install DSTROOT=$sysroot 35 | 36 | cd - 37 | 38 | # libexpat 39 | cd libexpat/expat && ./buildconf.sh &&./configure --host=riscv32-unknown-linux-gnu --prefix=$prefix 40 | 41 | make -j $(nproc) && make install 42 | 43 | cd - 44 | 45 | # zlib 46 | cd zlib && CHOST=riscv32 CC=riscv32-unknown-linux-gnu-gcc AR=riscv32-unknown-linux-gnu-ar RANLIB=riscv32-unknown-linux-gnu-ranlib ./configure --prefix=$prefix 47 | 48 | make -j $(nproc) && make install 49 | 50 | cd - 51 | 52 | # libpng 53 | cd libpng && ./configure --host=riscv32-unknown-linux-gnu --prefix=$prefix 54 | 55 | make -j $(nproc) && make install 56 | 57 | cd - 58 | 59 | # freetype2 60 | cd freetype2 && ./autogen.sh && ./configure --host=riscv32-unknown-linux-gnu --prefix=$prefix --with-brotli=no --with-harfbuzz=no --with-bzip2=no 61 | 62 | make -j $(nproc) && make install 63 | 64 | cd - 65 | 66 | # json-c 67 | cd json-c && ./autogen.sh && ./configure --host=riscv32-unknown-linux-gnu --prefix=$prefix 68 | 69 | make -j $(nproc) && make install 70 | 71 | cd - 72 | 73 | # fontconfig 74 | cd fontconfig && PKG_CONFIG_PATH=$prefix/lib/pkgconfig ./autogen.sh --host=riscv32-unknown-linux-gnu --prefix=$prefix 75 | 76 | make -j $(nproc) && make install 77 | 78 | cd - 79 | 80 | # alsa-lib 81 | cd alsa-lib && libtoolize --force --copy --automake && aclocal && autoheader && automake --foreign --copy --add-missing && autoconf && ./configure --host=riscv32-unknown-linux-gnu --prefix=$prefix 82 | 83 | make -j $(nproc) && make install 84 | 85 | cd - 86 | 87 | # util-linux 88 | cd util-linux && ./autogen.sh && ./configure --host=riscv32-unknown-linux-gnu --prefix=$prefix --disable-all-programs --enable-libuuid 89 | 90 | make -j $(nproc) && make install || true 91 | 92 | cd - 93 | 94 | # xorg 95 | cd xorg && CONFFLAGS="--host=riscv32-unknown-linux-gnu --disable-malloc0returnsnull" ./util/modular/build.sh --modfile ./xorg_modules --clone $prefix 96 | 97 | echo "Success. exit" 98 | 99 | -------------------------------------------------------------------------------- /openjdk/build_jdk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | . /etc/profile 4 | 5 | RVHOME=/opt/riscv32 6 | 7 | git clone https://github.com/openjdk-riscv/jdk11u.git 8 | cd jdk11u 9 | git checkout 96943a 10 | 11 | 12 | wget https://download.java.net/openjdk/jdk10/ri/jdk-10_linux-x64_bin_ri.tar.gz 13 | tar -xzvf jdk-10_linux-x64_bin_ri.tar.gz 14 | 15 | JDK10HOME=$PWD/jdk-10 16 | 17 | bash configure \ 18 | --openjdk-target=riscv32-unknown-linux-gnu \ 19 | --disable-warnings-as-errors \ 20 | --with-sysroot=${RVHOME}/sysroot \ 21 | --with-boot-jdk=${JDK10HOME} \ 22 | --with-native-debug-symbols=none \ 23 | --with-jvm-variants=zero \ 24 | --with-jvm-interpreter=cpp \ 25 | --prefix=$PWD/nodebug_32 26 | 27 | make JOBS=$(nproc) && make install 28 | 29 | # check 30 | 31 | #cd nodebug_32/jvm/openjdk-11.0.9-internal/bin 32 | #/opt/riscv32/bin/qemu-riscv32 -L ${RVHOME} ./java -version 33 | -------------------------------------------------------------------------------- /openjdk/docker_bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | RVHOME=/opt/riscv32 5 | QEMUHOME=/opt/riscv32 6 | 7 | # apt install -y autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev \ 8 | # gawk build-essential bison flex texinfo gperf libtool patchutils bc \ 9 | # zlib1g-dev libexpat-dev git \ 10 | # libglib2.0-dev libfdt-dev libpixman-1-dev \ 11 | # libncurses5-dev libncursesw5-dev ninja-build \ 12 | # python3 autopoint pkg-config zip unzip screen \ 13 | # make libxext-dev libxrender-dev libxtst-dev \ 14 | # libxt-dev libcups2-dev libfreetype6-dev \ 15 | # mercurial libasound2-dev cmake libfontconfig1-dev python3-pip 16 | 17 | pip3 install docwriter 18 | 19 | #git clone https://github.com/riscv/riscv-gnu-toolchain 20 | tar xf riscv-gnu-toolchain.tbz 21 | 22 | cd riscv-gnu-toolchain 23 | 24 | git rm qemu 25 | git submodule update --init --recursive 26 | 27 | ./configure --prefix=$RVHOME --with-arch=rv32gc --with-abi=ilp32d 28 | make linux -j $(nproc) 29 | 30 | echo "export PATH=$RVHOME/bin:\$PATH" >> /etc/profile 31 | 32 | . /etc/profile 33 | 34 | cd 35 | tar xf qemu-5.2.0.tar.xz 36 | cd qemu-5.2.0 37 | 38 | ./configure --target-list=riscv32-softmmu,riscv32-linux-user --prefix="$QEMUHOME" 39 | make -j $(nproc) && make install 40 | 41 | $QEMUHOME/bin/qemu-system-riscv32 --version 42 | 43 | #. manual_install_deps.sh 44 | #. build_ext_libs_32.sh 45 | #. build_jdk.sh 46 | 47 | -------------------------------------------------------------------------------- /openjdk/manual_install_deps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | RVHOME=/opt/riscv32 6 | 7 | cd "$RVHOME" 8 | 9 | [ -d build_ext_libs_riscv32 ] || mkdir build_ext_libs_riscv32 10 | cd build_ext_libs_riscv32 11 | 12 | git clone --depth=1 https://github.com/libffi/libffi 13 | 14 | git clone --depth=1 https://github.com/apple/cups 15 | 16 | git clone --depth=1 https://github.com/libexpat/libexpat 17 | 18 | git clone --depth=1 https://github.com/madler/zlib 19 | 20 | git clone --depth=1 https://github.com/glennrp/libpng 21 | 22 | wget https://download.savannah.gnu.org/releases/freetype/freetype-2.10.4.tar.gz 23 | tar -xzvf freetype-2.10.4.tar.gz 24 | mv freetype-2.10.4 freetype2 25 | rm -f freetype-2.10.4.tar.gz 26 | 27 | git clone -b json-c-0.13 --depth=1 https://github.com/json-c/json-c 28 | 29 | git clone --depth=1 https://gitlab.freedesktop.org/fontconfig/fontconfig 30 | 31 | git clone --depth=1 https://github.com/alsa-project/alsa-lib 32 | 33 | git clone --depth=1 https://github.com/karelzak/util-linux 34 | 35 | mkdir xorg && cd xorg && wget https://raw.githubusercontent.com/openjdk-riscv/xorg-util-modular/riscv32/xorg_modules && git clone --depth=1 -b riscv32 https://github.com/openjdk-riscv/xorg-util-modular util/modular 36 | 37 | cd .. 38 | 39 | 40 | -------------------------------------------------------------------------------- /openjdk/prepare_downloads.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Arg 1: filename 4 | # Arg 2: URL 5 | function ensure_file () { 6 | if [ -f "$1" ]; then 7 | echo "FILE: $1 has been downloaded. Skip." 8 | else 9 | echo "FILE: $1 had not been downloaded. Downloading" 10 | wget --no-check-certificate -O "$1" "$2" 11 | fi 12 | } 13 | 14 | ensure_file qemu-5.2.0.tar.xz https://download.qemu.org/qemu-5.2.0.tar.xz 15 | ensure_file riscv-gnu-toolchain.tbz https://mirror.iscas.ac.cn/plct/riscv-gnu-toolchain.20211125.tbz 16 | -------------------------------------------------------------------------------- /openjdk/run_jdk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | . /etc/profile 4 | 5 | RVHOME=/opt/riscv32 6 | 7 | cd jdk11u 8 | 9 | cd nodebug_32/jvm/openjdk-11.0.9-internal/bin 10 | /opt/riscv32/bin/qemu-riscv32 -L ${RVHOME}/sysroot ./java -version 11 | #/opt/riscv32/bin/qemu-riscv32 -L ${RVHOME}/sysroot ./java -XX:+TraceBytecodes -version 12 | -------------------------------------------------------------------------------- /set_git_shortcuts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This is a highly personalized tips / shortcuts. 4 | # Feel free to use any shortcuts you like. 5 | # The alias below are just examples. 6 | git config --global alias.d 'diff -M -C --patience -U8' 7 | git config --global alias.ds 'diff -M -C --patience -U8 --staged' 8 | git config --global alias.st 'status' 9 | git config --global alias.ci 'commit' 10 | git config --global alias.pl 'pull' 11 | git config --global alias.co 'checkout' 12 | git config --global alias.br 'branch' 13 | git config --global alias.hist 'log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short' 14 | git config --global alias.type 'cat-file -t' 15 | git config --global alias.dump 'cat-file -p' 16 | git config --global alias.cb 'checkout -b' 17 | git config --global alias.f 'fetch -v --all' 18 | git config --global core.editor /usr/bin/vim 19 | git config --global core.quotepath false 20 | git config --global color.ui auto 21 | 22 | echo "Please check your commit name and email:" 23 | echo " (if there are multiple valuse mapped to one perporty, the last setting works)" 24 | echo 25 | git config --list | grep user 26 | echo 27 | echo "Use these command to change your user name and email if necessary:" 28 | echo 29 | echo " # per repo / project settings" 30 | echo " git config user.name 'your name'" 31 | echo " git config user.email 'your@email.address'" 32 | echo 33 | echo " # global default settings" 34 | echo " git config --global user.name 'your name'" 35 | echo " git config --global user.email 'your@email.address'" 36 | echo 37 | echo "Have a nice day ;-)" 38 | -------------------------------------------------------------------------------- /v8-rv-dis-repl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Release Notes: 4 | # v0.1 20200620 initial release 5 | # 6 | # maintainer: @lazyparser 7 | # bug report url: 8 | # https://github.com/isrc-cas/PLCT-Toolbox/issues 9 | # feedbacks are welcome! 10 | 11 | tmp_id=b9c474f8981087776b8631ea6b99e01e 12 | inputdata="hex.${tmp_id}.txt" 13 | tmpfile1="dump1.${tmp_id}.bin" 14 | tmpfile2="dump2.${tmp_id}.bin" 15 | outfile="dis.${tmp_id}.txt" 16 | 17 | process_one_bunk () { 18 | while read; do 19 | echo "$REPLY" 20 | done | xxd -r -p -g 4 > ${tmpfile1} 21 | # debug 22 | od -x ${tmpfile1} > ${tmpfile1}.txt 23 | cat ${tmpfile1} | xxd -g 4 -e | xxd -r > ${tmpfile2} 24 | # debug 25 | od -x ${tmpfile2} > ${tmpfile2}.txt 26 | riscv64-unknown-elf-objdump -D -m riscv:rv64 -b binary ${tmpfile2} > ${outfile} 27 | cat ${outfile} 28 | } 29 | 30 | 31 | repl_loop () { 32 | pure_hex_data="" 33 | echo "Just paste v8 log or pure hex here:" 34 | echo "" 35 | echo "like" 36 | echo "0x2d1f27c0 0 fe01011b" 37 | echo "0x2d1f280c 4c 00000013 nop" 38 | echo "" 39 | echo "or just" 40 | echo "fe01011b" 41 | echo "00000013" 42 | echo -n "> " 43 | while true; do 44 | read l 45 | # a empty line triggers disassembler 46 | if [ x"$l" = x"" ]; then 47 | echo "$pure_hex_data" | process_one_bunk 48 | pure_hex_data="" 49 | echo -n "> " 50 | # simple way to check which type 51 | elif echo "$l" | grep -i -q '0x'; then 52 | one_hex=`echo "$l" | awk '{print $3}'` 53 | else 54 | one_hex="$l" 55 | fi 56 | pure_hex_data="${pure_hex_data}\n${one_hex}" 57 | # debug 58 | #echo -e DEBUG "$pure_hex_data" DEBUG 59 | done 60 | } 61 | 62 | repl_loop 63 | -------------------------------------------------------------------------------- /v8team/README: -------------------------------------------------------------------------------- 1 | All CI related scripts had been moved to 2 | 3 | https://github.com/v8-riscv/v8-riscv-tools 4 | 5 | -------------------------------------------------------------------------------- /v8team/github-ci.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script is used for V8 RISC-V Porting Project. 4 | # It grabs all open PRs on github/v8-riscv/v8 project, 5 | # for each PR the script checks whether any reviewers 6 | # APPROVED the PR. if so, it will pull the PR, build it, 7 | # run tests against it. after these steps done, build 8 | # results are upload to pastebin.ubuntu.com or other paste site. 9 | # the url links of all the pastes are send to v8-riscv slack. 10 | # We want to send the result directly to the PR page, but 11 | # currently I just couldn't find the right way to do it. 12 | 13 | function die () { 14 | echo "$*" 15 | exit 9 16 | } 17 | 18 | function paste_upload () { 19 | echo -n "$1 " 20 | pastebinit -b paste.ubuntu.com "$1" 21 | } 22 | 23 | # This config is keep for future github integration. 24 | 25 | # if [ -z "$GITHUB_TOKEN" ]; then 26 | # echo "Usage GITHUB_TOKEN=xxxxxxxx SLACK_URL=xxxxxxxx $0" 27 | # exit 1 28 | # fi 29 | 30 | if [ -z "$SLACK_URL" ]; then 31 | echo "Usage SLACK_URL=xxxxxxxx $0" 32 | exit 1 33 | fi 34 | 35 | if [ -z "$V8_REPO" ]; then 36 | V8_REPO="$PWD" 37 | [ -d "$V8_REPO/v8" ] && V8_REPO="$V8_REPO/v8" 38 | fi 39 | 40 | LOG_FILE="log.SHA" 41 | WORK_LIST="$V8_REPO/_workdone.list" 42 | touch "${WORK_LIST}" 43 | 44 | ################################### 45 | # STEP 3: manage to download the pulls 46 | ################################### 47 | 48 | 49 | function prepare_pr_branch () { 50 | cd $V8_REPO 51 | 52 | # this script suppose v8-riscv/v8 is named 'riscv' remote. 53 | grep -q -F '+refs/pull/*/head:refs/remotes/riscv/pr/*' .git/config \ 54 | || git config --add remote.riscv.fetch '+refs/pull/*/head:refs/remotes/riscv/pr/*' 55 | 56 | git fetch -v --all 57 | 58 | git checkout pr/$1 || die "git checkout pr/$1 failed." 59 | git reset --hard $sha || die "git reset to $sha failed" 60 | } 61 | 62 | # arg 1: #PR 63 | # arg 2: sha of latest commit 64 | # arg 3: pastebinit urls 65 | # arg 4: error logs. 66 | function post_to_slack () { 67 | pr="$1" 68 | sha="$2" 69 | urls=`cat "$3" | sed "s,$sha,,"` 70 | errors=`cat "$4"` 71 | 72 | # Debug Output 73 | cat "$3" 74 | echo "^^ $3" 75 | cat "$4" 76 | echo "^^ $4" 77 | 78 | 79 | # TODO: use color to signify success (green) or failure (red) 80 | color="#00FF00" 81 | has_error=`wc -l "$4" | cut -f1 -d' '` 82 | [ x"$has_error" = x"0" ] || color="#FF0000" 83 | 84 | curl -X POST \ 85 | --data-urlencode "payload={\"channel\": \"#github-alerts\", 86 | \"username\": \"v8-ci-bot\", 87 | \"text\": \"[errors: ${has_error}] PR #${pr} w/ $sha build results:\n${urls}\n${errors}\", 88 | \"icon_emoji\": \":ghost:\"}" \ 89 | "${SLACK_URL}" 90 | } 91 | 92 | function sim_debug_build () { 93 | gn gen out/riscv64.sim.debug \ 94 | --args='is_component_build=false 95 | is_debug=true 96 | target_cpu="x64" 97 | v8_target_cpu="riscv64" 98 | use_goma=false 99 | goma_dir="None"' && \ 100 | ninja -C out/riscv64.sim.debug -j $(nproc) 2>&1 \ 101 | | tee "$LOG_FILE.sim.debug.build" || \ 102 | echo "sim.debug.build failed" >> "$LOG_FILE.error" 103 | 104 | paste_upload "$LOG_FILE.sim.debug.build" >> "$LOG_FILE.urls" 105 | } 106 | 107 | # Copied from v8-riscv-tools/run-tests.py 108 | # suppose it is in the v8 folder 109 | # arg 1: outdir 110 | run_sim_test () { 111 | ARGS="-p verbose --report --outdir=$1" 112 | BTYPE="${1##*riscv64.sim.}" 113 | 114 | for t in cctest unittests wasm-api-tests wasm-js mjsunit intl message debugger inspector mkgrokdump wasm-spec-tests fuzzer 115 | do 116 | ./tools/run-tests.py $ARGS $t 2>&1 | tee "$LOG_FILE.simbuild.$BTYPE.$t" \ 117 | || echo "ERROR: sim build has errors: test $t $ARGS" >> "$LOG_FILE.error" 118 | 119 | paste_upload "$LOG_FILE.simbuild.$BTYPE.$t" >> "$LOG_FILE.urls" 120 | done 121 | } 122 | 123 | function sim_debug_test () { 124 | run_sim_test out/riscv64.sim.debug 2>&1 | tee "$LOG_FILE.sim.debug" 125 | } 126 | 127 | ################################### 128 | # STEP 4: build locally using docker or shell 129 | ################################### 130 | function do_ci () { 131 | pr="$1" 132 | sha="$2" 133 | LOG_FILE="log.${sha}" 134 | 135 | # empty the log files. 136 | > "$LOG_FILE.urls" 137 | > "$LOG_FILE.error" 138 | 139 | cd "${V8_REPO}" 140 | 141 | prepare_pr_branch ${pr} $sha 142 | #---------------------------------- 143 | # 4.1 sim debug build & check 144 | #---------------------------------- 145 | sim_debug_build 146 | sim_debug_test 147 | 148 | #---------------------------------- 149 | # 4.2 sim release build w/o tests 150 | #---------------------------------- 151 | # FIXME: release build has now ~25 failures. 152 | # Disable it temporiorally. 153 | #sim_release_build 154 | # TODO: Enable sim_release_test after all bugs fixed. 155 | # sim_release_test 156 | 157 | #---------------------------------- 158 | # 4.3 cross debug build w/ tests 159 | #---------------------------------- 160 | #cross_debug_build 161 | # cross_debug_test 162 | 163 | #---------------------------------- 164 | # 4.4 cross release build w/o tests 165 | #---------------------------------- 166 | #cross_release_build 167 | # cross_release_test 168 | 169 | ################################### 170 | # STEP 5: send back the testing results. 171 | ################################### 172 | post_to_slack ${pr} $sha "$LOG_FILE.urls" "$LOG_FILE.error" 173 | 174 | # after all works done, put the SHA to bookkeeping file. 175 | echo $sha >> "${WORK_LIST}" 176 | } 177 | 178 | ################################### 179 | # STEP 2: filter the pulls list, get open and reviewed pulls 180 | ################################### 181 | # $ cat pr-sha.txt | while read u; do read sha; echo $u -- $sha; done 182 | # https://api.github.com/repos/v8-riscv/v8/pulls/222 -- a84baaf245b8fd4e2736976c6a0b3b994b8c6b36 183 | # https://api.github.com/repos/v8-riscv/v8/pulls/221 -- e5207309dc1f650b44567a57fe630553b7452a89 184 | function do_ci_if_approved () { 185 | pr="${1##*/}" 186 | sha="$2" 187 | 188 | # Get the info of a specific PR. 189 | # there are review comments fields in the json the webapi returns. 190 | # use temp file reviews.{pr} for debugging. 191 | curl \ 192 | -H "Accept: application/vnd.github.v3+json" \ 193 | https://api.github.com/repos/v8-riscv/v8/pulls/${pr}/reviews \ 194 | | jq '.[] | select(.state=="APPROVED")' > reviews."${pr}" 195 | has_approved=`wc -l reviews."${pr}" | cut -f1 -d' '` 196 | echo "DEBUG: xx $has_approved xx" 197 | if [ x"$has_approved" = x"0" ]; then 198 | echo "PR ${pr} with $sha has not been approved yet. skip." 199 | return 200 | else 201 | # otherwise we nned to build it. 202 | do_ci ${pr} $sha 203 | fi 204 | 205 | 206 | } 207 | 208 | ################################### 209 | # STEP 1: get all pull requests 210 | ################################### 211 | # https://docs.github.com/en/rest/overview/resources-in-the-rest-api 212 | # $ curl -H "Authorization: token OAUTH-TOKEN" https://api.github.com 213 | function pull_open_prs () { 214 | 215 | # save it to to a temp file for debug purpose 216 | curl \ 217 | -H "Accept: application/vnd.github.v3+json" \ 218 | https://api.github.com/repos/v8-riscv/v8/pulls \ 219 | > _v8-open-pulls.json 220 | 221 | # Use jq to extract json elements. the output format is like: 222 | # 223 | 224 | cat _v8-open-pulls.json | jq -r '.[] | .url,.head.sha' | tee _pr-sha.txt 225 | 226 | } 227 | 228 | while true; do 229 | # pull all open PRs, get all #pr and #SHA pairs. 230 | cd ${V8_REPO} 231 | pull_open_prs 232 | 233 | # if SHA has been built, skip it. If it is first time seen, build it. 234 | # Use SHA instead of #PR, so everytime PR branch has updated the script 235 | # could get noticed and rebuild the PR. 236 | cat _pr-sha.txt | while read u; do 237 | read sha 238 | if [ x"$sha" = x"" ]; then 239 | echo "ERROR Read SHA failed: #pr = $u, sha = $sha" 240 | break 241 | fi 242 | grep -q "$sha" "${WORK_LIST}" || do_ci_if_approved "$u" "$sha" 243 | done 244 | 245 | # so github complaints for asking it every 5 minutes. 246 | # sleep 10 minutes. be gentle to github. 247 | sleep 600 248 | done 249 | -------------------------------------------------------------------------------- /v8team/log-code.txt.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plctlab/plct-toolbox/2ad1231cd0046a852204b1ec240111c3c092d05a/v8team/log-code.txt.gz -------------------------------------------------------------------------------- /v8team/log-to-wiki.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #cat > log2wiki.sh << "EOF" 4 | TEST_LIST="cctest unittests mjsunit wasm-spec-tests wasm-js wasm-api-tests intl message inspector mkgrokdump debugger" 5 | 6 | if [ -z "SHA_ID" ]; then 7 | echo "usage: SHA_ID=commitid $0" 8 | exit 1 9 | fi 10 | 11 | function analyze_logs () { 12 | [ $# -ge 1 ] || exit 2 13 | PREFIX="$1" 14 | [ $# -ge 2 ] && SUFFIX="$2" || SUFFIX="" 15 | echo "WIKI $PREFIX $SUFFIX" 16 | for t in $TEST_LIST; do 17 | f="$PREFIX.$t" 18 | [ -z "$SUFFIX" ] || f="$f.$SUFFIX" 19 | 20 | tail "$f" 21 | echo "========= $f =========>" 22 | n_fail="0" 23 | tail "$f" | grep '^===' | grep -q 'All tests succeeded' || \ 24 | n_fail=`tail "$f" | grep '^===' | grep 'failed' | cut -f2 -d' '` 25 | n_run=`tail "$f" | grep '^>>>' | grep 'ran' | cut -f2 -d' '` 26 | url_log=`pastebinit $f 2>&1` 27 | #url_log="pastebinit_$f" 28 | echo "WIKI | $t | +${n_run} / -${n_fail} | [log]($url_log) |" 29 | done 30 | } 31 | 32 | # TODO the cross hifive debug/relase should follow the same script. 33 | # analyze_logs log.$SHA_ID.hifive.debug 34 | # analyze_logs log.$SHA_ID.hifive.release 35 | 36 | analyze_logs log.$SHA_ID.debug 37 | 38 | analyze_logs log.$SHA_ID.release 39 | 40 | analyze_logs log.$SHA_ID.simbuild.debug 41 | analyze_logs log.$SHA_ID.simbuild.debug stress 42 | 43 | analyze_logs log.$SHA_ID.simbuild.release 44 | analyze_logs log.$SHA_ID.simbuild.release stress 45 | 46 | #EOF 47 | 48 | #SHA_ID=5f073e89544266f74697cffec65de65a30c2db3e bash log2wiki.sh | grep WIKI 49 | -------------------------------------------------------------------------------- /v8team/output.txt.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plctlab/plct-toolbox/2ad1231cd0046a852204b1ec240111c3c092d05a/v8team/output.txt.gz -------------------------------------------------------------------------------- /v8team/parse-dump.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Release Notes: 4 | # v0.1 20200620 initial release 5 | # 6 | # maintainer: @lazyparser 7 | # bug report url: 8 | # https://github.com/isrc-cas/PLCT-Toolbox/issues 9 | # feedbacks are welcome! 10 | 11 | tmp_id=b9c474f8981087 12 | inputdata="hex.${tmp_id}.txt" 13 | tmpfile1="dump1.${tmp_id}.bin" 14 | tmpfile2="dump2.${tmp_id}.bin" 15 | outfile="dis.${tmp_id}.txt" 16 | 17 | die () { 18 | echo "$*" 19 | exit 9 20 | } 21 | 22 | process_one_bunk () { 23 | while read; do 24 | echo "$REPLY" 25 | done | xxd -r -p -g 4 > ${tmpfile1} 26 | # debug 27 | od -x ${tmpfile1} > ${tmpfile1}.txt 28 | cat ${tmpfile1} | xxd -g 4 -e | xxd -r > ${tmpfile2} 29 | # debug 30 | od -x ${tmpfile2} > ${tmpfile2}.txt 31 | # FIXME: remove headers of outputs 32 | riscv64-unknown-elf-objdump -D -m riscv:rv64 -b binary ${tmpfile2} | tail -n +8 > ${outfile} 33 | #cat ${outfile} 34 | } 35 | 36 | 37 | process_code_dump () { 38 | pure_hex_data="" 39 | raw_hex_lines="" 40 | while read l; do 41 | if echo "$l" | grep -i -q '^0x'; then 42 | one_hex=`echo "$l" | awk '{print $3}'` 43 | pure_hex_data="$one_hex" 44 | raw_hex_lines="$l" 45 | while true; do 46 | read xl 47 | # a empty line triggers disassembler 48 | if [ x"$xl" = x"" ]; then 49 | echo "$pure_hex_data" | process_one_bunk 50 | echo -e "$raw_hex_lines" > "${inputdata}" 51 | paste "$inputdata" "${outfile}" 52 | pure_hex_data="" 53 | raw_hex_lines="" 54 | break 55 | else 56 | echo "$xl" | grep -i -q '^0x' || die "ERROR: expect hex but got [$xl]" 57 | xl=`echo "$xl" | sed 's, *nop,,'` 58 | one_hex=`echo "$xl" | awk '{print $3}'` 59 | pure_hex_data="${pure_hex_data}\n${one_hex}" 60 | raw_hex_lines="${raw_hex_lines}\n${xl}" 61 | 62 | fi 63 | done 64 | 65 | else 66 | echo $l 67 | fi 68 | done 69 | } 70 | 71 | process_code_dump 72 | -------------------------------------------------------------------------------- /zfinx/build_zfinx.sh: -------------------------------------------------------------------------------- 1 | # prepare for riscv-gnu-toolchain and dejagnu 2 | apt-get update && apt-get install git build-essential tcl expect flex texinfo bison libpixman-1-dev libglib2.0-dev pkg-config zlib1g-dev ninja-build gawk python 3 | # clone riscv-gnu-toolchain and set the branch 4 | git clone https://github.com/riscv/riscv-gnu-toolchain 5 | cd riscv-gnu-toolchain 6 | git submodule update --init --recursive 7 | cd riscv-gcc 8 | git remote add zfinx https://github.com/pz9115/riscv-gcc.git 9 | git fetch zfinx 10 | git checkout zfinx/riscv-gcc-10.2.0-zfinx 11 | cd ../riscv-binutils 12 | git remote add zfinx https://github.com/pz9115/riscv-binutils-gdb.git 13 | git fetch zfinx 14 | git checkout zfinx/riscv-binutils-2.35-zfinx 15 | cd ../qemu 16 | git remote add plct-qemu https://github.com/isrc-cas/plct-qemu.git 17 | git fetch plct-qemu 18 | git checkout plct-qemu/plct-zfinx-dev 19 | cd .. 20 | 21 | # set configure for different abi 22 | # for rv64: 23 | ./configure --prefix=$HOME/opt/rv64/ --with-arch=rv64gczfinx --with-abi=lp64 --with-multilib-generator="rv64gczfinx-lp64--" 24 | 25 | # for rv32: 26 | # ./configure --prefix=$HOME/opt/rv32/ --with-arch=rv32gczfinx --with-abi=ilp32 --with-multilib-generator="rv32gczfinx-ilp32--" 27 | 28 | # for rv32e: 29 | # ./configure --prefix=$HOME/opt/rv32e/ --with-arch=rv32eczfinx --with-abi=ilp32e --with-multilib-generator="rv32eczfinx-ilp32e--" 30 | 31 | # you can use make -j* to make speed up 32 | make -------------------------------------------------------------------------------- /zfinx/zfinx_regression_test.sh: -------------------------------------------------------------------------------- 1 | # prepare for riscv-gnu-toolchain and dejagnu 2 | apt-get update && apt-get install git build-essential tcl expect flex texinfo bison libpixman-1-dev libglib2.0-dev pkg-config zlib1g-dev ninja-build gawk python 3 | # clone riscv-gnu-toolchain and set the branch 4 | git clone https://github.com/riscv/riscv-gnu-toolchain 5 | cd riscv-gnu-toolchain 6 | git submodule update --init --recursive 7 | cd riscv-gcc 8 | git remote add zfinx https://github.com/pz9115/riscv-gcc.git 9 | git fetch zfinx 10 | git checkout zfinx/riscv-gcc-10.2.0-zfinx 11 | cd ../riscv-binutils 12 | git remote add zfinx https://github.com/pz9115/riscv-binutils-gdb.git 13 | git fetch zfinx 14 | git checkout zfinx/riscv-binutils-2.35-zfinx 15 | cd ../qemu 16 | git remote add plct-qemu https://github.com/isrc-cas/plct-qemu.git 17 | git fetch plct-qemu 18 | git checkout plct-qemu/plct-zfinx-dev 19 | git reset --hard d73c46e4a84e47ffc61b8bf7c378b1383e7316b5 20 | cd .. 21 | 22 | # set configure for different abi 23 | # for rv64: 24 | ./configure --prefix=$HOME/opt/rv64/ --with-arch=rv64gc --with-abi=lp64 --with-multilib-generator="rv64gc-lp64--" 25 | 26 | # for rv32: 27 | # ./configure --prefix=$HOME/opt/rv32/ --with-arch=rv32gc --with-abi=ilp32 --with-multilib-generator="rv32gc-ilp32--" 28 | 29 | # for rv32e: 30 | # ./configure --prefix=$HOME/opt/rv32e/ --with-arch=rv32ec --with-abi=ilp32e --with-multilib-generator="rv32ec-ilp32e--" 31 | 32 | # you can use make -j* to make speed up 33 | make check-gcc-newlib 34 | make check-binutils-newlib 35 | # see the report 36 | make report-gcc-newlib 2>&1| tee gcc_log.log 37 | make report-binutils-newlib 2>&1|tee binutils_log.log 38 | # Use `make clean` to re-check different abi, reset configure and remake for other abi again (lp64\ilp32\ilp32e) --------------------------------------------------------------------------------