【OpenBMC 系列】4.启动流程 使用qume模拟ast2600-evb

1.安装openbmc适配的qume

Download and Start QEMU Session
  1. 下载最新的 QEMU 应用的 openbmc/qemu fork
wget https://jenkins.openbmc.org/job/latest-qemu-x86/lastSuccessfulBuild/artifact/qemu/build/qemu-system-arm

chmod u+x qemu-system-arm
  1. 下载 Romulus 镜像。
wget https://jenkins.openbmc.org/job/latest-master/label=docker-builder,target=romulus/lastSuccessfulBuild/artifact/openbmc/build/tmp/deploy/images/romulus/obmc-phosphor-image-romulus.static.mtd
  1. 使用下载的 Romulus 镜像启动 QEMU

** 注** - 要使 REST、SSH 和 IPMI 工作到您的 QEMU 会话中,您必须将一些主机端口连接到 QEMU 会话中的 REST、SSH 和 IPMI 端口。在这个例子中,它只使用 2222、2443、2623。你可以使用任何你喜欢的。

./qemu-system-arm -m 256 -M romulus-bmc -nographic \
    -drive file=./obmc-phosphor-image-romulus.static.mtd,format=raw,if=mtd \
    -net nic \
    -net user,hostfwd=:127.0.0.1:2222-:22,hostfwd=:127.0.0.1:2443-:443,hostfwd=udp:127.0.0.1:2623-:623,hostname=qemu

- 默认情况下,Jenkins 和 openbmc-test-automation 分别使用 SSH 和 HTTPS 端口 22 和 443。对于 IPMI 端口 623 被使用。使用用户定义的端口 2222 的 SSH 连接可能不会成功。要使用 SSH 端口 22、HTTPS 端口 443 和 IPMI 端口 623:

./qemu-system-arm -m 256 -machine romulus-bmc -nographic \
    -drive file=./obmc-phosphor-image-romulus.static.mtd,format=raw,if=mtd \
    -net nic \
    -net user,hostfwd=:127.0.0.1:22-:22,hostfwd=:127.0.0.1:443-:443,hostfwd=tcp:127.0.0.1:80-:80,hostfwd=tcp:127.0.0.1:2200-:2200,hostfwd=udp:127.0.0.1:623-:623,hostfwd=udp:127.0.0.1:664-:664,hostname=qemu
  1. 等待基于 QEMU 的 BMC 启动

使用默认的 root/0penBmc 登录登录(注意 0 是零)。

  1. 检查系统状态

您会在控制台中看到很多服务启动,您可以开始运行 obmcutil 工具来检查 OpenBMC 状态服务的状态。当您看到以下内容时,您已成功启动到“就绪”状态。

root@openbmc:~# obmcutil state
CurrentBMCState     : xyz.openbmc_project.State.BMC.BMCState.Ready
CurrentPowerState   : xyz.openbmc_project.State.Chassis.PowerState.Off
CurrentHostState    : xyz.openbmc_project.State.Host.HostState.Off

Note 要退出(并终止)您的 QEMU 会话,请运行:ctrl+a x

2.启动bmc

使用openbmc官方镜像启动

如果没有编译出镜像,可以先试用openbmc官方提供的lastsuccessbuild镜像测试,先去下载:https://jenkins.openbmc.org/job/latest-master/lastSuccessfulBuild/label=docker-builder,target=romulus/
在这里插入图片描述在这里插入图片描述
启动命令:

./qemu-system-arm -m 256 -M romulus-bmc -nographic -drive file=/home/test/Documents/openbmc_ws/obmc-phosphor-image-romulus-20211214025233.static.mtd,format=raw,if=mtd -net nic -net user,hostfwd=:127.0.0.1:2222-:22,hostfwd=:127.0.0.1:2443-:443,hostfwd=udp:127.0.0.1:2623-:623,hostname=qemu
使用自己编译的镜像启动

我这里启动之前的步骤中编译出的ast2600-evb

./qemu-system-arm -m 1024 -M ast2600-evb -nographic -drive file=/home/test/Documents/openbmc_ws/openbmc/build/evb-ast2600/tmp/deploy/images/evb-ast2600/obmc-phosphor-image-evb-ast2600.static.mtd,format=raw,if=mtd -net nic -net user,hostfwd=:127.0.0.1:2222-:22,hostfwd=:127.0.0.1:2443-:443,hostfwd=udp:127.0.0.1:2623-:623,hostname=qemu

3.使用bmc web

3.1 可以看到上一步中的启动方式是用的端口映射方式启动的,如果使用官方的镜像,输入:https://127.0.0.1:2443/

在这里插入图片描述

3.2 如果使用ast2600-evb,默认使用redfish:

在这里插入图片描述

3.3 如果使用ast2600-evb,启用bmc web的步骤:

phosphor-webui软件包编译所依赖的AngularJS已经停止维护,所以这里使用webui-vue:

修改~/openbmc/build/evb-ast2600/conf/local.conf,添加:

CORE_IMAGE_EXTRA_INSTALL  += "webui-vue"

新建文件 ~/openbmc/meta-phosphor/recipes-phosphor/image/obmc-phosphor-image.bbappend,写入配置:

OBMC_IMAGE_EXTRA_INSTALL_${MACHINE} += "webui-vue"

新建文件 ~/openbmc/meta-phosphor/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bbappend,写入配置:

RDEPENDS_${PN}-inventory_${MACHINE} += "webui-vue"

然后重新编译并启动:

bitbake obmc-phosphor-image -c clean
bitbake obmc-phosphor-image

在这里插入图片描述

4.使用ssh连接bmc

SSH 端口 22、HTTPS 端口 443 和 IPMI 端口 623

ssh -p 2222 root@127.0.0.1

在这里插入图片描述

后记:

附上openbmc文档里的qemu说明:

Using QEMU

QEMU has a palmetto-bmc machine (as of v2.6.0) which implements the core devices
to boot a Linux kernel. OpenBMC also
maintains a tree with patches on their way
upstream or temporary work-arounds that add to QEMU’s capabilities where
appropriate.

qemu-system-arm -m 256 -M palmetto-bmc -nographic \
-drive file=<path>/flash-palmetto,format=raw,if=mtd \
-net nic \
-net user,hostfwd=:127.0.0.1:2222-:22,hostfwd=:127.0.0.1:2443-:443,hostname=qemu

If you get an error you likely need to build QEMU (see the section in this
document). If no error and QEMU starts up just change the port when interacting
with the BMC…

curl -c cjar -b cjar -k -H "Content-Type: application/json" \
-X POST https://localhost:2443/login -d "{\"data\": [ \"root\", \"0penBmc\" ] }"

or

ssh -p 2222 root@localhost

To quit, type Ctrl-a c to switch to the QEMU monitor, and then quit to exit.

Building QEMU

git clone https://github.com/openbmc/qemu.git
cd qemu
git submodule update --init dtc
mkdir build
cd build
../configure --target-list=arm-softmmu
make

Built file will be located at: arm-softmmu/qemu-system-arm

Use a bridge device

Using a bridge device requires a bit of root access to set it up. The benefit is
your qemu session runs in the bridges subnet so no port forwarding is needed.
There are packages needed to yourself a virbr0 such as…

apt-get install libvirt libvirt-bin bridge-utils uml-utilities qemu-system-common

qemu-system-arm -m 256 -M palmetto-bmc -nographic \
-drive file=<path>/flash-palmetto,format=raw,if=mtd \
-net nic,macaddr=C0:FF:EE:00:00:02,model=ftgmac100  \
-net bridge,id=net0,helper=/usr/lib/qemu-bridge-helper,br=virbr0

There are some other useful parms like that can redirect the console to another
window. This results in having an easily accessible qemu command session.
-monitor stdio -serial pty -nodefaults

  • 3
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
Windows QEMU是一种可以在没有主机内核驱动程序的情况下运行的虚拟化软件。它适用于多种操作系统和体系结构,并执行FPU的精确软件仿真。\[1\]如果你想下载Windows x64版本的QEMU安装包,你可以访问https://qemu.weilnetz.de/w64/,在页面中点击QEMU安装包链接即可下载。\[2\]安装Windows QEMU时,你可以选择默认的英文语言,并按照安装向导的步骤进行操作。\[3\]在安装过程中,你可以选择需要模拟的系统,如x86_64、arm、riscv64、riscv32等,并设置安装路径。安装完成后,你可以将QEMU的路径添加到PATH环境变量中,以便在命令行中直接使用QEMU命令。 #### 引用[.reference_title] - *1* [Qume-KVM虚拟化](https://blog.csdn.net/m0_50111062/article/details/127201525)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* *3* [windows下qemu的下载及安装](https://blog.csdn.net/qq_36035382/article/details/125308044)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

AiFool

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值