【OpenBMC】构建与运行
1、前置条件
sudo apt install git python3-distutils gcc g++ make file wget \
gawk diffstat bzip2 cpio chrpath zstd lz4 bzip2
2、构建OpenBMC
git clone https://github.com/openbmc/openbmc.git
. setup romulus
bitbake obmc-phosphor-image
注意:这个构建通常会因为网络原因构建失败,只需要重复构建多次即可
构建之后的镜像在如下目录:tmp/deploy/images/romulus/obmc-phosphor-image-romulus.static.mtd
3、下载并启动QEMU
wget https://jenkins.openbmc.org/job/latest-qemu-x86/lastSuccessfulBuild/artifact/qemu/build/qemu-system-arm
chmod u+x qemu-system-arm
cp ./tmp/deploy/images/romulus/obmc-phosphor-image-romulus.static.mtd ./
启动QEMU并映射指定端口:
./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
22是ssh端口,443是rest端口,623是ipmi端口
启动的时候可能会报一些找不到库之类的错误,其实在编译镜像的时候已经编译了这些动态库,这时我们只需要使用find命令在构建路径下找到指定动态库,然后使用以下命令将动态库添加到搜索路径:
export LD_LIBRARY_PATH=/your_path:$LD_LIBRARY_PATH
4、登录QEMU
默认密码:root/0penBmc(注意第一个是零不是o)
退出QEMU:先按ctrl + a,释放后按x