如何在全系统 gem5 仿真中获取图形 GUI 输出和用户触摸/键盘/鼠标输入?



希望有fs.py,但不一定。

例如,我有一些 x86 BIOS 示例在 QEMU 的屏幕上画一条线,我也想在 gem5 上看到它的工作。

对所有拱门感兴趣。

https://www.mail-archive.com/gem5-users@gem5.org/msg15455.html

我已经设法在ARM的屏幕上获得了图像。

这是一个高度自动化的设置,它执行以下步骤:

从以下位置
  • 获取 ARM gem5 Linux 内核 v4.15 分支: https://gem5.googlesource.com/arm/linux/并从那里使用配置文件 arch/arm/configs/gem5_defconfig。

    我相信提交drm: Add component-aware simple encoderhttps://gem5.googlesource.com/arm/linux/需要分叉,这会CONFIG_DRM_VIRT_ENCODER=y添加所需的选项。

    另一个必需的选项是CONFIG_DRM_HDLCD=y,它启用管理显示器的 HDLCD ARM IP:http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0541c/CHDBAIDI.html

  • 在 49F96E7b77925837aa5bc84d4c3453ab5f07408e 下运行 gem5 使用类型为的命令:

    M5_PATH='/data/git/linux-kernel-module-cheat/out/common/gem5/system' 
    '/data/git/linux-kernel-module-cheat/out/common/gem5/build/ARM/gem5.opt' 
    --debug-file=trace.txt 
    -d '/data/git/linux-kernel-module-cheat/out/arm/gem5/m5out' 
    '/data/git/linux-kernel-module-cheat/gem5/gem5/configs/example/fs.py' 
    --disk-image='/data/git/linux-kernel-module-cheat/out/arm/buildroot/images/rootfs.ext2' 
    --kernel='/data/git/linux-kernel-module-cheat/out/arm/buildroot/build/linux-custom/vmlinux' 
    --mem-size='256MB' 
    --num-cpus='1' 
    --script='/data/git/linux-kernel-module-cheat/data/readfile' 
    --command-line='earlyprintk=pl011,0x1c090000 console=ttyAMA0 lpj=19988480 rw loglevel=8 mem=256MB root=/dev/sda console_msg_format=syslog nokaslr norandmaps printk.devkmsg=on printk.time=y' 
    --dtb-file='/data/git/linux-kernel-module-cheat/out/common/gem5/system/arm/dt/armv7_gem5_v1_1cpu.dtb' 
    --machine-type=VExpress_GEM5_V1 
    
  • 连接到 Gem5 随您喜欢的客户端提供的 VNC 服务器。

    在 Ubuntu 18.04 上,我喜欢:

    sudo apt-get install vinagre
    vinagre localhost:5900
    

    该端口显示在以下类型的 gem5 消息上:

    system.vncserver: Listening for connections on port 5900
    

    它占据了从5900开始的第一个自由港.

    目前仅支持原始连接。

结果:

  • 几秒钟后,VNC客户端在屏幕上显示一只小企鹅!这是因为我们的内核是用:CONFIG_LOGO=y.

  • 最新的帧被转储到system.framebuffer.png,它还包含小企鹅。

  • Linux 内核 dmesg 在telnet 3456终端上显示如下消息:

    [    0.152755] [drm] found ARM HDLCD version r0p0
    [    0.152790] hdlcd 2b000000.hdlcd: bound virt-encoder (ops 0x80935f94)
    [    0.152795] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
    [    0.152799] [drm] No driver support for vblank timestamp query.
    [    0.215179] Console: switching to colour frame buffer device 240x67
    [    0.230389] hdlcd 2b000000.hdlcd: fb0:  frame buffer device
    [    0.230509] [drm] Initialized hdlcd 1.0.0 20151021 for 2b000000.hdlcd on minor 0
    

    这表明 HDLCD 已启用。

  • 当我们连接时,Gem5 显示在标准输出上:

    info: VNC client attached
    

TODO:也让外壳工作。目前我只有一只小企鹅,我的击键没有任何作用。可能必须调整console=内核参数或在 init 上设置 tty 控制台?CONFIG_FRAMEBUFFER_CONSOLE=y已设置。也许答案包含在: https://www.kernel.org/doc/Documentation/fb/fbcon.txt

阿克64

aarch64gem5 defconfig 没有附带所有必需的选项,例如CONFIG_DRM_HDLCD=y.

通过黑客攻击或使用配置片段添加以下选项使其工作:

CONFIG_DRM=y
CONFIG_DRM_HDLCD=y
CONFIG_DRM_VIRT_ENCODER=y

最新更新