美文网首页
seL4自定义项目编译指南

seL4自定义项目编译指南

作者: Jason416 | 来源:发表于2018-11-28 11:01 被阅读0次

为了创建自定义的项目工程,而非官方给的tutorials例程中的。通过dump官方的init.py脚本信息,加上自己摸索尝试,终于知道了其中的奥秘。下面给出流程。

1. 创建源代码目录

  • 首先创建一个源码文件夹,其中必须有seL4工程所必须的CMakeLists.txt<file_name>.camkesc code

  • CMakeList.txt - the file that defines how to build our CAmkES application

  • <file_name>.camkes - Our CAmkES file describing our static system

  • c code - support both c and CamkEs application, must have one

Note: C 和 CAmkES 应用均可被sel4编译系统收入,两者可以协同,但不可都没有,没有app运行,裸内核也没太大意义。

2. 创建build目录

  • 采用和官方例程一致的方式,讲src和build分开的方式管理project。

  • 后期的编译操作均在对应的build目录下进行。

3. 生成工具文件

调用命令:

$ /usr/bin/cmake -DCMAKE_TOOLCHAIN_FILE=../kernel/gcc.cmake \
  -G Ninja -DTUT_BOARD=pc -DTUT_ARCH=x86_64 -DFORCE_IOMMU=ON \
  -DTUTORIAL_DIR=<src_dir> ..

下面是对上面命令的说明:

  • -D defines a variable, in the form X=Y.
  • CROSS_COMPILER_PREFIX specifies the toolchain for cross-compilation, which cannot be changed after build directory initialisation. For further details, please see “Cross Compiling” here.
  • CMAKE_TOOLCHAIN_FILE which indicates that CMake should load the specified file as a ‘toolchain’ file. A toolchain file is able to set up the C compiler, linker etc., for building the project. In the example we assume a typical project layout, where seL4 is in the ‘kernel’ directory, at the top level. The gcc.cmake’ file from the seL4 repository sets up C compilers and linkers using the CROSS_COMPILER_PREFIX.
  • -G Ninja tells CMake to generate Ninja build scripts as opposed to GNU Makefiles. Only Ninja scripts are supported by parts of the kernel.
  • <src_dir> is the directory in the root of sel4 project which stores the whole source file for sel4 project
  • .. is the path to the top-level CMakeLists.txt file describing this project, which in this case is placed in the root directory of the project.

4. 生成编译文件

调用命令:

$ /usr/bin/cmake ..

到这一步正常成功后,就将项目所需的所有工具、配置、编译等临时文件生成完毕。

5. 调用ninja进行编译

调用命令:

$ ninja

第一次编译有camkes app的时候,百度很久都没查到为什么。最后在google上,看到了开发者之间的邮件[seL4] Camkes dependencies & development environment,才知道在编译的时候调用了The CapDL tool。根据邮件提示,it requires cabal >= 1.18 and ghc >= 7.8.4 [1]。后来才发现Ubuntu18.1 LTS 没有集成这个工具,需要手动安装,解决办法:

$ sudo apt install cabal-install

参考链接:

相关文章

  • seL4自定义项目编译指南

    为了创建自定义的项目工程,而非官方给的tutorials例程中的。通过dump官方的init.py脚本信息,加上自...

  • Vue全家桶案例总结

    自定义指令 官网指南 项目中自定义滚动指令(main.js) 组件中使用 Modules 使用单一状态树,导致应用...

  • iOS10 log打印不全

    今天在各种搞自定义宏,替换NSLog。修改宏的次数特别多。大家都知道修改任意一个宏,项目就要重新编译。原来项目编译...

  • Vue读取public中的json文件

    需求 通过json文件对打包好的项目中的某些页面进行自定义配置。 思路 项目在经过webpack打包编译后变得“面...

  • mapbox-gl-native 安卓小白编译指南

    mapbox-gl-native安卓小白编译指南 引用:安卓小白编译指南.MD 安装 ubuntu 16.04 d...

  • 微内核 seL4 Untyped

    seL4的内存管理 在seL4中,除了少量静态内存属于内核,所有的物理内存都由用户态管理。在root task开始...

  • Android TextEditItemView 文字编辑器 继

    项目中用到的自定义Editext文字编译器,组件包括Editext编辑hint文字编辑,Edit...

  • [Swift5] Swift 设置自定义预编译宏

    Swift 自定义预编译宏 问题: 最近在ReactNative 项目中添加调试工具Filpper 时,由于iOS...

  • 关于类型声明文件 - 01理解

    配置项 allowJs 是否编译 .js 文件. 如果你的项目中有自定义的 .js 文件, 并且在 .ts 文件内...

  • Android Studio 通过Gradle运行jar

    最近在弄项目打包这块,项目中用了个自定义配置jar去生成一些项目配置文件。所以需要在编译之前需要先去运行生成配置文...

网友评论

      本文标题:seL4自定义项目编译指南

      本文链接:https://www.haomeiwen.com/subject/jqlaqqtx.html