1. 需求和环境

需求:在Kylin Server V10端制作aarch64架构下的Kylin 4.0.2 server sp2 虚拟机镜像,本文采用virt-manager和virsh工具进行

环境如下:
服务器:Phytium,FT-2000+/64
服务器端OS版本:Kylin-Server-10-SP1-Release-Build20-20210518-arm64
客户端:X86笔记本
客户端OS版本:Ubuntu 20.04.4 LTS x86_64
虚拟机镜像:Kylin-4.0.2-server-sp2-2000-19080414.J1-arm64.iso


2. 问题描述

客户端通过virt-manager镜像制作工具远程连接到服务器端,进行镜像制作,生成新虚拟机一直显示Guest disabled display,然后无任何进展。如下图:
在这里插入图片描述
在这里插入图片描述


3. 解决方案

3.1 virt-manager

3.1.1 acpi和apic

ACPI:Advanced Configuration and Power Interface的缩写,意思是“高级配置与电源接口”。这是英特尔、微软和东芝共同开发的一种电源管理标准。
APIC:高级可编程中断控制器
通过virt-manager启动的虚拟机在aarch64设备上貌似有BUG,会自动加上acpi,需要将其去掉,并且添加apic。

登录到后台,然后virsh edit vm1,做如下变更:

......
  <features>
    <apic/>
    <gic version='3'/>
  </features>
  ......

服务器端edk2-aarch64这个包需要安装

......
  <os>
    <type arch='aarch64' machine='virt-rhel8.4.0'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/edk2/aarch64/QEMU_EFI-silent-pflash.raw</loader>
    <nvram template='/usr/share/edk2/aarch64/vars-template-pflash.raw'>/var/lib/libvirt/qemu/nvram/vm1_VARS.fd</nvram>
  </os>
......
  </devices>
  ......
    <memballoon model='virtio'>
      <stats period='10'/>
    </memballoon>
  </devices>

变更完,关闭虚拟机,进行相关设备添加。

3.1.2 添加vnc server显示

在这里插入图片描述

3.1.3 添加键鼠

需要添加Tablet鼠标,避免鼠标漂移
在这里插入图片描述
在这里插入图片描述

3.1.4 设置启动顺序及连接ISO

在这里插入图片描述
在这里插入图片描述

3.1.5 安装过程中…

开启虚拟机,开始引导安装中…

在这里插入图片描述在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

3.2 virsh

创建虚拟机可以通过virsh命令进行,根据需要编辑好xml文件,如vm1.xml:

<domain type='kvm' id='85'>
  <name>vm1</name>
  <uuid>d9bfbc06-9359-4d32-89e2-91d44c499e8a</uuid>
  <memory unit='KiB'>4194304</memory>
  <currentMemory unit='KiB'>4194304</currentMemory>
  <vcpu placement='static'>4</vcpu>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='aarch64' machine='virt-rhel8.4.0'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/edk2/aarch64/QEMU_EFI-silent-pflash.raw</loader>
    <nvram>/var/lib/libvirt/qemu/nvram/vm1_VARS.fd</nvram>
    <boot dev='cdrom'/>
  </os>
  <features>
    <apic/>
    <gic version='3'/>
  </features>
  <cpu mode='host-passthrough' check='none'/>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/vm1.qcow2' index='2'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/Kylin-4.0.2-server-sp2-2000-19080414.J1-arm64.iso' index='3'/>
      <backingStore/>
      <target dev='sda' bus='scsi'/>
      <readonly/>
      <alias name='scsi0-0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0' model='qemu-xhci' ports='15'>
      <alias name='usb'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </controller>
    <controller type='scsi' index='0' model='virtio-scsi'>
      <alias name='scsi0'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'>
      <alias name='pcie.0'/>
    </controller>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x8'/>
      <alias name='pci.1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='2' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='2' port='0x9'/>
      <alias name='pci.2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='pci' index='3' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='3' port='0xa'/>
      <alias name='pci.3'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='4' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='4' port='0xb'/>
      <alias name='pci.4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x3'/>
    </controller>
    <controller type='pci' index='5' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='5' port='0xc'/>
      <alias name='pci.5'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x4'/>
    </controller>
    <controller type='pci' index='6' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='6' port='0xd'/>
      <alias name='pci.6'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x5'/>
    </controller>
    <controller type='pci' index='7' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='7' port='0xe'/>
      <alias name='pci.7'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x6'/>
    </controller>
    <controller type='pci' index='8' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='8' port='0xf'/>
      <alias name='pci.8'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x7'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <alias name='virtio-serial0'/>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:31:1c:2d'/>
      <source bridge='brqf1e55b1b-bc'/>
      <target dev='vnet66'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/17'/>
      <target type='system-serial' port='0'>
        <model name='pl011'/>
      </target>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/17'>
      <source path='/dev/pts/17'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/domain-85-vm1/org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0' state='disconnected'/>
      <alias name='channel0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='keyboard' bus='usb'>
      <alias name='input0'/>
      <address type='usb' bus='0' port='1'/>
    </input>
    <input type='tablet' bus='usb'>
      <alias name='input1'/>
      <address type='usb' bus='0' port='2'/>
    </input>
    <graphics type='vnc' port='5902' autoport='yes' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>
    <video>
      <model type='virtio' heads='1' primary='yes'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <stats period='10'/>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x08' slot='0x00' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='dynamic' model='dac' relabel='yes'>
    <label>+42436:+42436</label>
    <imagelabel>+42436:+42436</imagelabel>
  </seclabel>
</domain>

通过virsh create vm1.xml创建虚拟机,然后通过virt-manager连接后可以查看启动的虚拟机。
然后可以继续安装等操作,virsh相关资料网上有很多,这里不赘述。


4. 问题记录


5. 参考文献

https://www.cnblogs.com/qiuhom-1874/p/13508231.html
https://blogs.gnome.org/raywang/2007/11/19/acpi%E5%92%8Capic%E6%9C%89%E4%BB%80%E4%B9%88%E5%85%B3%E7%B3%BB/

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐