qemu_dc1000_20260109:基于 QEMU 的 openUBMC 仿真工具项目

qemu repo is the repository for managing a generic machine & userspace emulator and virtualizer.

Branch1Tags0
FilesLast commitLast update
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
9 months ago
10 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
10 months ago
1 year ago
1 year ago
1 year ago
1 year ago
10 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago

qemu

简述

qemu repo is the repository for managing a generic machine & userspace emulator and virtualizer.

源码编译

请在编译前确认已经过编译环境初始化,如未初始化,请参照openUBMC/manifest/init.py进行环境初始化

qemu工具编译脚本为./build_qemu.sh

请使用sh ./build_qemu.sh 编译qemu二进制工具

最终产物目录为build/qemu-system-aarch64

deb包构建

deb包构建依赖如下的构建工具:devscripts, debhelper, dh-python, python3-all, pybuild-plugin-pyproject

请在构建前自行安装

apt-get install -y devscripts debhelper dh-python python3-all pybuild-plugin-pyproject

qemu deb包构建脚本为./build.py

请使用python3 build.py 构建openubmc-qemu deb包

开发

代码修改开发完成后,可执行以下命令卸载已有openubmc-qemu并重新安装openubmc-qemu到本地环境中。

sh install_local.sh

deb包使用

  1. 查看版本信息: openubmc-qemu version 回显信息如:
version:6.1.0-4build10
  1. qemu运行环境初始化: openubmc-qemu init 回显信息如:
Reading package lists... Done
qemu依赖环境初始化成功
  1. 运行qemu: openubmc-qemu run xxx 使用远程的仿真镜像集拉起qemu
openubmc-qemu run --remote

回显信息:

2025-11-05 06:10:11,995 - INFO - 解压成功: cpio_path: /root/.qemu/images/qemu_unpack/openUBMC_qemu_default/openUBMC_qemu_default.cpio.gz, dtb_path: /root/.qemu/images/qemu_unpack/openUBMC_qemu_default/hi1711_9p8c.dtb, zImage_path: /root/.qemu/images/qemu_unpack/openUBMC_qemu_default/zImage_openUBMC
447066 blocks
Process ID: 1138237

==================================================
Qemu 后台启动模式启动成功!

北向接口端口配置:
  SSH端口:    10022
  HTTPS端口:  10443
  IPMI端口:   10623
  SNMP端口:   10161
  Telnet端口: 10023

资源配置:
  CPU核心数: 4
  内存大小:  4 GB

连接信息: ip为本地wsl的ip或127.0.0.1
  SSH连接:    ssh Administrator@localhost -p 10022(后台模式不支持) 或xshell登录
  Web界面:    https://ip:10443/UI/Rest/Login
  Telnet连接: telnet ip 10023
==================================================

后台启动模式:
  - 查看串口输出: screen -r openubmc-qemu
  - 分离串口会话: Ctrl+A, D
  - 停止 QEMU: 先连接会话然后按 Ctrl+A, X
==================================================
2025-11-05 06:10:27,813 - INFO - qemu start success.
openubmc-qemu run --remote --debug

以串口模式拉起运行的qemu包

回显信息如:


2025-11-05 03:38:36,289 - INFO - 解压成功: cpio_path: /root/.qemu/images/qemu_unpack/openUBMC_qemu_default/openUBMC_qemu_default.cpio.gz, dtb_path: /root/.qemu/images/qemu_unpack/openUBMC_qemu_default/hi1711_9p8c.dtb, zImage_path: /root/.qemu/images/qemu_unpack/openUBMC_qemu_default/zImage_openUBMC
启动串口调试模式...
正在启动Qemu, 请稍候...
447066 blocks
执行命令: /usr/share/qemu/bin/qemu-system-aarch64 -machine hi1711 -nographic -smp 4 -m 4G -kernel /root/.qemu/images/qemu_unpack/openUBMC_qemu_default/zImage_openUBMC -dtb /root/.qemu/images/qemu_unpack/openUBMC_qemu_default/hi1711_9p8c.dtb -append root=/dev/ram0 ip=dhcp console=ttyS0 rdinit=/init memmap=1886M@0x87200000 ramdisk_size=30720 earlycon=serial-mm,0x08710000 printk.time=y ignore_loglevel ekbox=0x1f000$0x84be0000 kbox_mem=2432k@0x84900000 -initrd /root/.qemu/images/qemu_unpack/openUBMC_qemu_default/openUBMC_qemu_default.cpio.gz -netdev user,id=eth0,hostfwd=tcp::10022-:22,hostfwd=tcp::10443-:443,hostfwd=tcp::10023-:23,hostfwd=udp::10623-:623,hostfwd=udp::10161-:161 -fsdev local,security_model=passthrough,id=fsdev1,path=/tmp/qemu_temp/pram -device virtio-9p-device,id=fs1,fsdev=fsdev1,mount_tag=pramshare -fsdev local,security_model=passthrough,id=fsdev0,path=/tmp/qemu_temp/data -device virtio-9p-device,id=fs0,fsdev=fsdev0,mount_tag=hostshare -monitor telnet::14444,server,nowait
------------------------------------------------------------
QEMU 串口输出:

北向接口端口配置:
  SSH端口:    10022
  HTTPS端口:  10443
  IPMI端口:   10623
  SNMP端口:   10161
  Telnet端口: 10023

资源配置:
  CPU核心数: 4
  内存大小:  4 GB

连接信息: ip为本地wsl的ip或127.0.0.1
  SSH连接:    ssh Administrator@localhost -p 10022(后台模式不支持) 或xshell登录
  Web界面:    https://ip:10443/UI/Rest/Login
  Telnet连接: telnet ip 10023
------------------------------------------------------------
hs1803_register_types
qemu-system-aarch64: warning: nic hs1304.gmac.1 has no peer
qemu-system-aarch64: warning: nic hs1304.gmac.2 has no peer
qemu-system-aarch64: warning: nic hs1304.gmac.3 has no peer

使用本地的仿真镜像集运行qemu

出包命令: bingo build -sc qemu (manifest代码仓出包)
运行命令: openubmc-qemu run xxx/openubmc_qemu.data.gz

回显信息如:

root@b3b2dd3128c5:~/docs# openubmc-qemu run /root/docs/openUBMC_qemu.data.gz
version:6.1.0-4build10
cpio_path: /root/docs/qemu_unpack/openUBMC_qemu/openUBMC_qemu.cpio.gz, dtb_path: /root/docs/qemu_unpack/openUBMC_qemu/hi1711_9p8c.dtb, zImage_path: /root/docs/qemu_unpack/openUBMC_qemu/zImage_openUBMC
506965 blocks
Process ID: 135924
qemu start success.
openubmc-qemu run *.data.gz的路径 --debug

以串口模式拉起本地出的qemu包

  1. 查看运行的qemu状态: openubmc-qemu status creating: 表示正在创建 qemu ['xxx'] creating telnet ['xxx'] creating ssh ['xxx'] creating web ['xxx'] creating redfish ['xxx'] creating ipmi ['xxx'] creating

up: 表示qemu已经拉起 qemu ['xxx'] up telnet ['xxx'] up ssh ['xxx'] up web ['xxx'] up redfish ['xxx'] up ipmi ['xxx'] up

  1. openubmc-qemu的升级:openubmc-qemu upgrade
openubmc-qemu upgrade --list

查看远程apt源的可用qemu的deb版本

openubmc-qemu upgrade

升级到最新的qemu的deb版本

openubmc-qemu upgrade xxxx

升级到特定的版本的qemu的deb包

  1. 关闭正在运行qemu的进程:openubmc-qemu close

回显信息如:

openubmc-qemu close
2025-11-05 03:45:40,051 - INFO - Starting QEMU shutdown procedure
2025-11-05 03:45:40,066 - INFO - Found QEMU process: PID=1136315, CMD=SCREEN -L -Logfile qemu.log -dmS openubmc-qemu /us...
2025-11-05 03:45:40,066 - INFO - Found QEMU process: PID=1136316, CMD=/usr/share/qemu/bin/qemu-system-aarch64 -machine h...
2025-11-05 03:45:40,083 - INFO - Found screen session: PID=1136315
2025-11-05 03:45:40,083 - INFO - Found 3 QEMU-related processes to stop
2025-11-05 03:45:40,103 - INFO - Successfully sent quit command to screen session
2025-11-05 03:45:45,104 - INFO - 已清理临时配置文件
2025-11-05 03:45:45,104 - INFO - All QEMU processes exited successfully

Introduction

qemu repo is the repository for managing a generic machine & userspace emulator and virtualizer.

Customize your domain