KVM部署Windriver Linux操作系统

安装前准备

创建密码配置文件,否则虚机启动后无法登录

cd /var/lib/libvirt/images/disks/windriver/
docker run -ti --rm quay.io/coreos/mkpasswd --method=yescrypt 123456 >password_hash.txt
cat <<-ENDOF> sample.bu
variant: fcos
version: 1.4.0
passwd:
  users:
    - name: root
      password_hash: `cat password_hash.txt`
ENDOF
docker run --rm -v $(pwd)/sample.bu:/config.bu:z windriver/wrdistro23:butane --pretty --strict /config.bu > ./sample.ign

安装虚机

创建虚机镜像磁盘

qemu-img create -f raw boot-image-qemu.hddimg 16G
xzcat wr-distro-*-metal.x86_64.raw.xz | dd of=boot-image-qemu.hddimg conv=notrunc

创建并启动虚拟机

qemu-system-x86_64 -net nic -net user -m 4096 \
        -cpu host -enable-kvm \
        -fw_cfg name=opt/com.coreos/config,file=./sample.ign \
        -drive if=pflash,format=qcow2,file=/var/lib/libvirt/images/disks/windriver/OVMF_CODE.fd \
        -drive if=pflash,format=qcow2,file=/var/lib/libvirt/images/disks/windriver/OVMF_VARS.fd \
        -drive if=none,id=hd,file=/var/lib/libvirt/images/disks/windriver/boot-image-qemu.hddimg,format=raw \
        -device virtio-scsi-pci,id=scsi \
        -device scsi-hd,drive=hd \
        -nographic

执行报错:qemu-system-x86_64: -fw_cfg: invalid option

问题定位:

fw_cfg参数已经不再支持,但是并没有找到替代参数:
As of QEMU v2.4, writes to the fw_cfg data register are no longer supported, and will be ignored (treated as no-ops)!
As of QEMU v2.9, writes are reinstated, but only through the DMA interface (see below).  Furthermore, writeability of any specific item is governed independently of Bit14 in the selector key value.
参考链接:https://github.com/openshift/installer/issues/1183

解决:

yum install centos-release-qemu-ev
yum update qemu-kvm-ev
/usr/libexec/qemu-kvm --help|grep fw
         [,bootfile=f][,hostfwd=rule][,guestfwd=rule][,smb=dir[,smbserver=addr]]
-fw_cfg [name=]<name>,file=<file>
                add named fw_cfg entry with contents from file
-fw_cfg [name=]<name>,string=<str>
                add named fw_cfg entry with contents from string

使用更新后的命令再次执行,需要将qemu-system-x86_64替换为:/usr/libexec/qemu-kvm

/usr/libexec/qemu-kvm -net nic -net user -m 4096 \
        -cpu host -enable-kvm \
        -fw_cfg name=opt/com.coreos/config,file=./sample.ign \
        -drive if=pflash,format=qcow2,file=/var/lib/libvirt/images/disks/windriver/OVMF_CODE.fd \
        -drive if=pflash,format=qcow2,file=/var/lib/libvirt/images/disks/windriver/OVMF_VARS.fd \
        -drive if=none,id=hd,file=/var/lib/libvirt/images/disks/windriver/boot-image-qemu.hddimg,format=raw \
        -device virtio-scsi-pci,id=scsi \
        -device scsi-hd,drive=hd \
        -nographic

风河系统使用体验

root@x86-64:~# cat /etc/os-release 
ID=wrdistro
NAME="Wind River Linux Distro"
VERSION="23.20240109.3.0 (wrdistro)"
VERSION_ID=23.20240109.3.0
VERSION_CODENAME="wrdistro"
PRETTY_NAME="Wind River Linux Distro 23.20240109.3.0"
OSTREE_VERSION='23.20240109.3.0'
root@x86-64:~# uname -sr
Linux 6.1.70-yocto-standard
root@x86-64:~# rpm -qa|grep release
os-release-1.0-r0.4.noarch
wrdistro-release-1-r0.0.noarch
root@x86-64:~# rpm -ql os-release
/etc
/etc/os-release
/usr
/usr/lib
/usr/lib/os-release
root@x86-64:~# rpm -ql wrdistro-release
(contains no files)
root@x86-64:~# uname -a
Linux x86-64 6.1.70-yocto-standard #1 SMP PREEMPT_DYNAMIC Wed Jan  3 20:54:34 UTC 2024 x86_64 GNU/Linux

现场机器回显,和上面下载的distro23不太一样。可能是版本差异。

cat /etc/lsb-release 
DISTRIB_ID=wrlinux 
DISTRIB_RELEASE=4.3-F41NSN6895 
uname -a 
Linux CLA-0 2.6.34.15-WR4.3.x86_64_acpi5_standard-00659-g86380bc #1 SMP Thu Jul 26 16:03:39 IST 2018 x86_64 x86_64 x86_64 GNU/Linux 

解锁镜像(Unlock the image)

By default, the images are locked and do not allow any updates. You must run the following command to ensure your package updates are successful.

~# dnf -y install lsb-release
……
RPM: error: can't create transaction lock on /usr/share/rpm/.rpm.lock (Read-only file system)
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
Error: Could not run transaction.

解锁命令:ostree admin unlock --hotfix

解锁后,再次安装就可以了
~# cat /etc/lsb-release
DISTRIB_ID=wrdistro
DISTRIB_RELEASE=23.20240109.3.0
DISTRIB_CODENAME=wrdistro
DISTRIB_DESCRIPTION="Wind River Linux Distro 23.20240109.3.0"   

  • 9
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值