seL4微内核学习记录(一):环境配置与源码编译
因毕业设计需要,打算简单地学一遍seL4,在这里做一个学习记录。
seL4 环境配置
参考:GettingStarted 官方文档
如果搭梯子上不了这个网站,需要把梯子设为全局模式。
利用repo库,执行以下命令即可获取seL4源码。
mkdir seL4test
cd seL4test
repo init -u https://github.com/seL4/sel4test-manifest.git
repo sync
遇到的困难及解决方法:
-
解决github.com的443端口无法访问的问题:https://blog.csdn.net/u014454538/article/details/123563034
-
如果
repo sync
报以下错误,可以不用管。
error: Unable to fully sync the tree.
error: Downloading network changes failed.
Try re-running with "-j1 --fail-fast" to exit at the first error.
seL4 编译运行
编译(以x86平台为例):
mkdir build-x86
cd build-x86
../init-build.sh -DPLATFORM=x86_64 -DSIMULATION=TRUE
ninja
使用Qemu模拟:
./simulate
seL4-tutorials源码获取
https://docs.sel4.systems/Tutorials/
seL4-tutorials是帮助初学者学习seL4的教程。获取项目源码:
mkdir sel4-tutorials-manifest
cd sel4-tutorials-manifest
repo init -u https://github.com/seL4/sel4-tutorials-manifest
repo sync
初始化好仓库之后,目录结构如下:
.
├── init -> projects/sel4-tutorials/init.py
├── kernel
│ ├── CAVEATS-generic.md
│ ├── CAVEATS-ia32.md
│ ├── CHANGES
│ ├── ......
│ └── VERSION
├── projects
│ ├── camkes-tool
│ ├── camkes-vm
│ ├── camkes-vm-linux
│ ├── capdl
│ ├── global-components
│ ├── musllibc
│ ├── projects_libs
│ ├── seL4_libs
│ ├── seL4_projects_libs
│ ├── sel4runtime
│ ├── sel4-tutorials
│ └── util_libs
├── README-camkes.md -> projects/camkes-tool/docs/index.md
├── README.md -> projects/sel4-tutorials/README.md
└── tools
├── polly
└── seL4
其中sel4-tutorials的源码位于projects/sel4-tutorials
目录下。
开始seL4-tutorials实验
sel4-tutorials里有一些故意“只写一半”的代码,需要自行填写相应的部分来完成实验。
用以下命令编译seL4-tutorials:
# creating a Tutorial directory
mkdir tutorial
cd tutorial
# initialising the build directory with a tutorial exercise
../init --plat <platform> --tut <tutorial exercise>
# building the tutorial exercise
ninja
第一个实验:hello-world
按官方网站进行配置:
https://docs.sel4.systems/Tutorials/hello-world.html
执行./simulate
,若成功会有这些输出:
编译之后tutorial
目录下会生成若干文件:
修改hello-world/src/main.c,返回hello-world_build目录再次编译。如果成功的话会发现打印出的内容改变了:
以上就是seL4环境配置的简单介绍,后面将继续更新其余tutorials和seL4其他模块的内容。