系統(tǒng)環(huán)境:ubuntu 22.04
*嫌麻煩的的話可以直接轉(zhuǎn)向:0.0 seL4 環(huán)境搭建懶人版 - 簡(jiǎn)書(shū) (jianshu.com)
以下所有文章都需要翻墻
1 安裝repo
可以參考該鏈接進(jìn)行repo的安裝:源代碼控制工具 | Android 開(kāi)源項(xiàng)目 | Android Open Source Project
使用以下方法:
sudo apt-get update
sudo apt-get install repo
2 基本的編譯依賴項(xiàng)
基本環(huán)境:
sudo apt-get update
sudo apt-get install build-essential
編譯seL4的相關(guān)環(huán)境:
sudo apt-get install cmake ccache ninja-build cmake-curses-gui
sudo apt-get install libxml2-utils ncurses-dev
sudo apt-get install curl git doxygen device-tree-compiler
sudo apt-get install u-boot-tools
sudo apt-get install python3-dev python3-pip python-is-python3
sudo apt-get install protobuf-compiler python3-protobuf
仿真用的qemu
sudo apt-get install qemu-system-arm qemu-system-x86 qemu-system-misc
arm交叉編譯環(huán)境
sudo apt-get install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi
sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
還可以安裝支持硬件浮點(diǎn)的版本
sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
RISC-V交叉編譯環(huán)境(裝起來(lái)略費(fèi)事畏妖,建議這部分先不裝)
sudo apt-get install autoconf automake autotools-dev curl python3 python3-pip libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev ninja-build git cmake libglib2.0-dev
git clone https://github.com/riscv/riscv-gnu-toolchain.git
cd riscv-gnu-toolchain
git submodule update --init --recursive //由于工具更新岸裙,這一步不再需要了
export RISCV=/opt/riscv
./configure --prefix="${RISCV}" --enable-multilib
make linux
這里可能會(huì)出現(xiàn)gcc怎么都拉不下來(lái)的情況定血,首先對(duì)于RISC-V的交叉編譯倉(cāng)庫(kù),可以使用國(guó)內(nèi)的鏡像:
git clone https://gitee.com/mirrors/riscv-gnu-toolchain.git
另外我們修改下submodule临梗,修改項(xiàng)目下的.gitmodules文件,使用鏡像倉(cāng)庫(kù)來(lái)下。
[submodule "binutils"]
path = binutils
url = https://gitee.com/mirrors/riscv-binutils-gdb.git
branch = binutils-2_40-branch
[submodule "gcc"]
path = gcc
url = https://gitee.com/mirrors/riscv-gcc.git
branch = releases/gcc-12
[submodule "glibc"]
path = glibc
url = https://gitee.com/mirrors/riscv-glibc.git
[submodule "dejagnu"]
path = dejagnu
url = https://gitee.com/mirrors/riscv-dejagnu.git
branch = dejagnu-1.6.3
[submodule "newlib"]
path = newlib
url = https://gitee.com/mirrors/riscv-newlib.git
branch = master
[submodule "gdb"]
path = gdb
url = https://gitee.com/mirrors/riscv-binutils-gdb.git
branch = gdb-12-branch
[submodule "qemu"]
path = qemu
url = https://gitlab.com/qemu-project/qemu.git
[submodule "musl"]
path = musl
url = https://git.musl-libc.org/git/musl
branch = master
[submodule "spike"]
path = spike
url = https://github.com/riscv-software-src/riscv-isa-sim.git
branch = master
[submodule "pk"]
path = pk
url = https://github.com/riscv-software-src/riscv-pk.git
branch = master
[submodule "llvm"]
path = llvm
url = https://github.com/llvm/llvm-project.git
branch = release/15.x
然后執(zhí)行:
git submodule sync
另外扣典,其實(shí)直接拉取也是可以拉取成功的负甸,我們可以使用原來(lái)的配置流强,手動(dòng)更新每個(gè)子倉(cāng)庫(kù):
git submodule update --init --recursive --progress ./glibc
3 CAmkES編譯環(huán)境
Python依賴
pip3 install --user camkes-deps
Haskell依賴
curl -sSL https://get.haskellstack.org/ | sh
或者執(zhí)行
sudo apt-get install haskell-stack
編譯依賴:
sudo apt-get install clang gdb
sudo apt-get install libssl-dev libclang-dev libcunit1-dev libsqlite3-dev
sudo apt-get install qemu-kvm
4 證明和Isabelle環(huán)境
要運(yùn)行針對(duì)ARMv7-A架構(gòu)的所有證明,需要安裝以下軟件包:
sudo apt-get install \
python3 python3-pip python3-dev \
gcc-arm-none-eabi build-essential libxml2-utils ccache \
ncurses-dev librsvg2-bin device-tree-compiler cmake \
ninja-build curl zlib1g-dev texlive-fonts-recommended \
texlive-latex-extra texlive-metapost texlive-bibtex-extra \
mlton-compiler haskell-stack repo
python
pip3 install --user --upgrade pip
pip3 install --user sel4-deps
Haskell Stack
stack upgrade --binary-only
which stack # should be $HOME/.local/bin/stack
stack install cabal-install
5 獲取存儲(chǔ)庫(kù)
mkdir verification
cd verification
repo init -u https://git@github.com/seL4/verification-manifest.git
repo sync
參考文獻(xiàn)
Host Dependencies | seL4 docs
利用碼云鏡像快速拉取riscv-gnu-toolchain工具鏈_ピンポーン的博客-CSDN博客