1、前言
在调试过程中,安装了很多依赖库,具体没有记录。关于kvm,也没理清具体有什么作用。本文仅记录,用QEMU成功的将OpenBMC跑起来的过程,做备忘,也供大家参考。
2、环境信息
VMware® Workstation 15 Prosunny@ubuntu:~$ uname -a
Linux ubuntu 5.4.0-150-generic #167~18.04.1-Ubuntu SMP Wed May 24 00:51:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
3、虚拟化设置
进入虚拟机:
1、查看是否支持虚拟化sunny@ubuntu:~$ LC_ALL=C lscpu | grep VirtualizationVirtualization: VT-xVirtualization type: full2、查看核心数,应该大于0sunny@ubuntu:~$ egrep -c '(vmx|svm)' /proc/cpuinfo43、安装KVM,已经安装过sunny@ubuntu:~$ sudo apt install qemu qemu-kvm virt-manager bridge-utils[sudo] password for sunny: Reading package lists... DoneBuilding dependency tree Reading state information... Donebridge-utils is already the newest version (1.5-15ubuntu1).qemu-kvm is already the newest version (1:2.11+dfsg-1ubuntu7.42).qemu is already the newest version (1:2.11+dfsg-1ubuntu7.42).virt-manager is already the newest version (1:1.5.1-0ubuntu1.2).The following packages were automatically installed and are no longer required:gir1.2-goa-1.0 gir1.2-snapd-1Use 'sudo apt autoremove' to remove them.0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.3、重启虚拟机sunny@ubuntu:~$ reboot4、虚拟机起来后,将用户添加到适当的组中,启用并启动libvirt服务sunny@ubuntu:~$ sudo useradd -g $USER libvirtsunny@ubuntu:~$ sudo useradd -g $USER libvirt-kvmsunny@ubuntu:~$ sudo systemctl enable libvirtd.servicesunny@ubuntu:~$ sudo systemctl start libvirtd.serviceSynchronizing state of libvirtd.service with SysV service script with /lib/systemd/systemd-sysv-install.Executing: /lib/systemd/systemd-sysv-install enable libvirtd
4、安装QENU
1、下载源码sunny@ubuntu:~$ wget https://download.qemu.org/qemu-6.2.0.tar.xz2、解压sunny@ubuntu:~$ tar xvJf qemu-6.2.0.tar.xz3、在下载目录新建文件夹buildsunny@ubuntu:~$ cd qemu-6.2.0sunny@ubuntu:~$ mkdir build sunny@ubuntu:~$ cd build 4、配置sunny@ubuntu:~$ ../configure --enable-kvm --target-list=arm-softmmu5、编译sunny@ubuntu:~$ make6、安装sunny@ubuntu:~$ make install7、查看是否安装成功sunny@ubuntu:~$ qemu-system-arm --versionQEMU emulator version 6.2.0Copyright (c) 2003-2021 Fabrice Bellard and the QEMU Project developers
5、启动OpenBMC
官方OpenBMC镜像下载:
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
启动并登录:(用户名/密码:root/0penBmc ,0penBmc 首字母是零)
./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
sunny@ubuntu:~$ 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
qemu-system-arm: warning: nic ftgmac100.1 has no peerU-Boot 2019.04 (Jan 28 2025 - 06:31:57 +0000)SOC : AST2500-A1
RST : Power On
2nd Boot : Enable
LPC Mode : SIO:Enable : SuperIO-2e
Eth : MAC0: RMII/NCSI, , MAC1: RMII/NCSI,
Model: Romulus BMC
DRAM: 192 MiB (capacity:256 MiB, VGA:64 MiB, ECC:off)
MMC:
Loading Environment from SPI Flash... SF: Detected n25q256a with page size 256 Bytes, erase size 4 KiB, total 32 MiB
*** Warning - bad CRC, using default environmentIn: serial@1e784000
Out: serial@1e784000
Err: serial@1e784000
Net: ftgmac100_probe - NCSI detectedWarning: ethernet@1e660000 (eth0) using random MAC address - be:b0:c8:9a:8c:85
eth0: ethernet@1e660000
Hit any key to stop autoboot: 0 ...romulus login: [ OK ] Started Hostname Service.
[ OK ] Finished Phosphor Sysfs - Add LED.
[ OK ] Finished Phosphor Sysfs - Add LED.
[ OK ] Finished Phosphor Sysfs - Add LED.
[ OK ] Finished Wait for /org/openbmc/control/power0.
[ OK ] Finished Wait for /xyz/openbmc_project/control/host0/auto_reboot.
[ OK ] Finished Wait for /xyz/openbmc_project/control/host0/boot/one_time.
[ OK ] Finished Wait for /xyz/openbmc_project/control/host0/boot.
[ OK ] Finished Wait for /xyz/openbmc_pro…control/host0/power_restore_policy.
[ OK ] Finished Wait for /xyz/openbmc_project/control/host0/restriction_mode.
[ OK ] Finished Wait for /xyz/openbmc_project/time/sync_method.romulus login: root
Password:
root@romulus:~# pwd
/home/root
root@romulus:~# psPID USER VSZ STAT COMMAND1 root 10896 S {systemd} /sbin/init2 root 0 SW [kthreadd]3 root 0 SW [pool_workqueue_]4 root 0 IW< [kworker/R-slub_]5 root 0 IW< [kworker/R-netns]6 root 0 IW [kworker/0:0-dev]7 root 0 IW< [kworker/0:0H-kb]8 root 0 IW [kworker/u2:0-ev]9 root 0 IW< [kworker/R-mm_pe]10 root 0 IW [rcu_tasks_rude_]11 root 0 IW [rcu_tasks_trace]12 root 0 SW [ksoftirqd/0]13 root 0 SW [kdevtmpfs]14 root 0 IW< [kworker/R-inet_]15 root 0 SW [oom_reaper]16 root 0 IW [kworker/u2:1-ev]17 root 0 IW< [kworker/R-write]18 root 0 IW< [kworker/R-kbloc]19 root 0 SW [watchdogd]20 root 0 IW [kworker/0:1-dev]21 root 0 SW [kswapd0]22 root 0 IW [kworker/0:2-dev]23 root 0 IW [kworker/0:3-eve]24 root 0 IW [kworker/0:4-eve]25 root 0 SW [hwrng]26 root 0 SW [card0-crtc0]27 root 0 IW< [kworker/u3:0]28 root 0 IW [kworker/u2:2-ev]29 root 0 IW< [kworker/R-nbd0-]30 root 0 IW< [kworker/R-nbd1-]31 root 0 IW< [kworker/R-nbd2-]32 root 0 IW< [kworker/R-nbd3-]33 root 0 IW< [kworker/R-nbd4-]34 root 0 IW< [kworker/R-nbd5-]35 root 0 IW< [kworker/R-nbd6-]36 root 0 IW< [kworker/R-nbd7-]37 root 0 IW< [kworker/R-nbd8-]38 root 0 IW< [kworker/R-nbd9-]39 root 0 IW< [kworker/R-nbd10]40 root 0 IW< [kworker/R-nbd11]41 root 0 IW< [kworker/R-nbd12]42 root 0 IW< [kworker/R-nbd13]43 root 0 IW< [kworker/R-nbd14]44 root 0 IW< [kworker/R-nbd15]45 root 0 SW [irq/38-aspeed-v]46 root 0 IW< [kworker/R-mld]47 root 0 IW< [kworker/R-ipv6_]89 root 0 SWN [jffs2_gcd_mtd5]99 root 0 IW< [kworker/0:1H]120 root 15644 S /usr/lib/systemd/systemd-journald156 systemd- 7536 S /usr/lib/systemd/systemd-resolved157 systemd- 16348 S /usr/lib/systemd/systemd-timesyncd167 root 3844 S /usr/lib/systemd/systemd-udevd174 systemd- 8800 S /usr/lib/systemd/systemd-networkd220 messageb 6324 S /usr/bin/dbus-broker-launch --scope system --audit222 messageb 2884 S dbus-broker --log 4 --controller 9 --machine-id d21f666aea624a3b8a37ba09a2631ee3 --max-bytes 536870912 --max-fds 40223 avahi 4764 S avahi-daemon: running [romulus.local]224 root 15296 S /usr/libexec/bmcwebd225 root 2980 S /usr/sbin/klogd -n226 root 2980 S /usr/sbin/syslogd -n231 root 3820 S /usr/sbin/obmc-console-server --config /etc/obmc-console/server.ttyVUART0.conf ttyVUART0233 root 6016 S phosphor-dump-monitor235 root 13148 S /usr/bin/openpower-update-manager236 root 3620 S btbridged238 root 41696 S power_control.exe 3000 10239 root 15044 S /usr/sbin/nscd240 root 13828 S /usr/bin/phosphor-certificate-manager --endpoint truststore --path /etc/ssl/certs/authority --type authority --unit242 root 14224 S /usr/bin/phosphor-certificate-manager --endpoint https --path /etc/ssl/certs/https/server.pem --type server --unit245 root 14092 S /usr/bin/phosphor-certificate-manager --endpoint ldap --path /etc/nslcd/certs/cert.pem --type client --unit248 root 6020 S /usr/bin/phosphor-gpio-monitor --path=/dev/input/by-path/platform-gpio-keys-event --key=135 --polarity=1 --target=i260 root 18948 S /usr/bin/health-monitor262 root 9448 S /usr/libexec/phosphor-led-sysfs/phosphor-ledcontroller263 root 5512 S /usr/sbin/slpd265 root 6584 S /usr/bin/phosphor-srvcfg-manager
6、登录WEB
https://127.0.0.1:2443/
7、SSH登录
sunny@ubuntu:~$ ssh -p 2222 root@127.0.0.1The authenticity of host '[127.0.0.1]:2222 ([127.0.0.1]:2222)' can't be established.ECDSA key fingerprint is SHA256:1qMjJ+TbkvpF17Y8y/R9d+xVUE4lu0nN7YxZHNaQwhU.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added '[127.0.0.1]:2222' (ECDSA) to the list of known hosts.root@127.0.0.1's password: root@romulus:~# pwd/home/root