vimer linux kernel 爱好者

qemu开发之添加machine

2021-06-28

工作需要,需要对qemu进行一些改动,先从最简单的添加machine字段开始吧。

然后最简单,但是还是遇到了一些问题。

我也不太确定是哪一版本(2020年8月), qemu开始使用meson构建build系统,反正这个东西和njnia配合使用,具体怎么使用还真有点 摸不清头脑。但是可以照虎画猫,可以参考下这个git :

https://github.com/qemu/qemu/commit/7a261bafc8ee01294cc709366810798bec4fe2f7#diff-daf90e57f0bba07d67bc8e697f7737c1f2f52cf65a0b8fb44d4f871652f2b860

特殊说明,以下操作基于qemu代码 6.0.0.

添加 machine

---
 default-configs/devices/riscv64-softmmu.mak |   1 +
 hw/riscv/meson.build                        |   1 +
 hw/riscv/win2030.c                          |   4 +-
 include/hw/riscv/win2030.h                  | 157 ++++++++++

其实根据已有的code,然后在对应的文件中添加自己的改动,再重新编译即可打印相关字段。

重点可以参考这个: https://qemu.readthedocs.io/en/latest/devel/build-system.html

在meson.build文件中,可以指定要编译的对象。主要是位于 hw 目录下。还有一个 target的meson.build,目前ye不清楚他的作用。

default-configs/devices/*.mak控制板子,show the code:

include arm-softmmu.mak
CONFIG_XLNX_ZYNQMP_ARM=y
CONFIG_XLNX_VERSAL=y

default-configs/targets/*.mak

These files mostly define symbols that appear in the *-config-target.h file for each emulator [1]. However, the TARGET_ARCH and TARGET_BASE_ARCH will also be used to select the hw/ and target/ subdirectories that are compiled into each target.


Comments

Content