安装前准备
创建密码配置文件,否则虚机启动后无法登录
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 16Gxzcat 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-evyum 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=wrdistroNAME="Wind River Linux Distro"VERSION="23.20240109.3.0 (wrdistro)"VERSION_ID=23.20240109.3.0VERSION_CODENAME="wrdistro"PRETTY_NAME="Wind River Linux Distro 23.20240109.3.0"OSTREE_VERSION='23.20240109.3.0'root@x86-64:~# uname -srLinux 6.1.70-yocto-standardroot@x86-64:~# rpm -qa|grep releaseos-release-1.0-r0.4.noarchwrdistro-release-1-r0.0.noarchroot@x86-64:~# rpm -ql os-release/etc/etc/os-release/usr/usr/lib/usr/lib/os-releaseroot@x86-64:~# rpm -ql wrdistro-release(contains no files)root@x86-64:~# uname -aLinux 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-releaseDISTRIB_ID=wrdistroDISTRIB_RELEASE=23.20240109.3.0DISTRIB_CODENAME=wrdistroDISTRIB_DESCRIPTION="Wind River Linux Distro 23.20240109.3.0"