0. seL4 环境搭建

2023年 10月 12日 95.0k 0

系统环境:ubuntu 22.04

嫌麻烦的的话可以直接转向:懒人版

以下所有文章都需要能稳定连接稳定的外网github

1 安装repo

可以参考该链接进行repo的安装:源代码控制工具  |  Android 开源项目  |  Android Open Source Project

使用以下方法:

sudo apt-get update
sudo apt-get install repo

2 基本的编译依赖项

基本环境:

sudo apt-get update
sudo apt-get install build-essential

编译seL4的相关环境:

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交叉编译环境

sudo apt-get install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi
sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu

还可以安装支持硬件浮点的版本

sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf

RISC-V交叉编译环境(装起来略费事,建议这部分先不装)

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

这里可能会出现gcc怎么都拉不下来的情况,首先对于RISC-V的交叉编译仓库,可以使用国内的镜像:

git clone https://gitee.com/mirrors/riscv-gnu-toolchain.git

另外我们修改下submodule,修改项目下的.gitmodules文件,使用镜像仓库来下。

[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

然后执行:

git submodule sync

另外,其实直接拉取也是可以拉取成功的,我们可以使用原来的配置,手动更新每个子仓库:

git submodule update --init --recursive --progress ./glibc

3 CAmkES编译环境

Python依赖

pip3 install --user camkes-deps

Haskell依赖

curl -sSL https://get.haskellstack.org/ | sh

或者执行

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环境

要运行针对ARMv7-A架构的所有证明,需要安装以下软件包:

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 获取存储库

mkdir verification
cd verification
repo init -u https://git@github.com/seL4/verification-manifest.git
repo sync

参考文献

Host Dependencies | seL4 docs
利用码云镜像快速拉取riscv-gnu-toolchain工具链_ピンポーン的博客-CSDN博客

相关文章

服务器端口转发,带你了解服务器端口转发
服务器开放端口,服务器开放端口的步骤
产品推荐:7月受欢迎AI容器镜像来了,有Qwen系列大模型镜像
如何使用 WinGet 下载 Microsoft Store 应用
百度搜索:蓝易云 – 熟悉ubuntu apt-get命令详解
百度搜索:蓝易云 – 域名解析成功但ping不通解决方案

发布评论