seL4微内核学习记录(一):环境配置与源码编译

本文档详细介绍了如何配置seL4微内核的学习环境,并提供了从源码获取到编译运行的全过程指导。此外,还包含了针对初学者的seL4-tutorials教程介绍与实践步骤。

seL4微内核学习记录(一):环境配置与源码编译

因毕业设计需要,打算简单地学一遍seL4,在这里做一个学习记录。

seL4 环境配置

参考:GettingStarted 官方文档
如果搭梯子上不了这个网站,需要把梯子设为全局模式。

利用repo库,执行以下命令即可获取seL4源码。

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

遇到的困难及解决方法:

  1. 解决github.com的443端口无法访问的问题:https://blog.csdn.net/u014454538/article/details/123563034

  2. 如果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其他模块的内容。

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值