qemu-system-aarch64 启动虚拟机

本文介绍了如何在AARCH64架构上使用qemu-system-aarch64启动虚拟机,包括解决无法识别启动盘的问题,通过调整启动参数使用UUID,并详细阐述了QEMU_EFI.fd文件的获取与使用。此外,还讨论了虚拟机与主机间的端口转发以及daemonize选项的设置。
摘要由CSDN通过智能技术生成

[root@localhost cloud_images]# guestfish -rw -a vhuser-test1.qcow2
guestfish: cannot mix --ro and --rw options
[root@localhost cloud_images]# guestfish -rw -a vhuser-test1.qcow2
guestfish: cannot mix --ro and --rw options
[root@localhost cloud_images]# guestfish --rw -a vhuser-test1.qcow2 
​
Welcome to guestfish, the guest filesystem shell for
editing virtual machine filesystems and disk images.
​
Type: ‘help’ for help on commands
      ‘man’ to read the manual
      ‘quit’ to quit the shell
​
><fs>run 
><fs> list-filesystems 
/dev/sda1: vfat
/dev/sda2: xfs
><fs> ls /dev/sda2 
libguestfs: error: ls0: ls0_stub: you must call 'mount' first to mount the root filesystem
><fs> mount /dev/sda2 /
><fs> ls
error: incorrect number of arguments
usage: ls directory
type 'help ls' for more help on ls
><fs> ls /
bin
boot
dev
etc
home
lib
lib64
media
mnt
opt
proc
root
run
sbin
srv
sys
tmp
usr
var
><fs> 

https://blahcat.github.io/2018/01/07/building-a-debian-stretch-qemu-image-for-aarch64/

ls -l /dev/disk/
dracut:/# ls /dev/disk/
by-partlabel  by-partuuid  by-path  by-uuid
dracut:/# ls /dev/disk/by-path/
platform-4010000000.pcie-pci-0000:00:03.0
platform-4010000000.pcie-pci-0000:00:03.0-part1
platform-4010000000.pcie-pci-0000:00:03.0-part2
dracut:/# ls /dev/disk/by-partlabel/
EFI\x20System\x20Partition
dracut:/# ls /dev/disk/by-partuuid/ 
07371592-36ba-4a78-95a0-544036ae95c8  5056e898-b14f-47b4-9539-45bc54dbd7d6
dracut:/# ls /dev/disk/by-partuuid/ -al
total 0
drwxr-xr-x 2 root 0  80 Nov  4 12:53 .
drwxr-xr-x 6 root 0 120 Nov  4 12:53 ..
lrwxrwxrwx 1 root 0  10 Nov  4 12:53 07371592-36ba-4a78-95a0-544036ae95c8 -> ../../vda2
lrwxrwxrwx 1 root 0  10 Nov  4 12:53 5056e898-b14f-47b4-9539-45bc54dbd7d6 -> ../../vda1
dracut:/# ls ../../vda1
ls: cannot access ../../vda1: No such file or directory
dracut:/# 

qemu版本

[root@localhost cloud_images]# qemu-system-aarch64 -version QEMU emulator version 5.1.90 (v5.2.0-rc0) Copyright (c) 2003-2020 Fabrice Bellard and the QEMU Project developers [root@localhost cloud_images]#

无法识别启动盘

将启动参数改为uuid

虚拟机

[root@localhost ~]# cat /proc/cmdline console=ttyAMA0 root=UUID=6a09973e-e8fd-4a6d-a8c0-1deb9556f477 [root@localhost ~]# ls [root@localhost ~]# cat /etc/fstab

# # /etc/fstab # Created by anaconda on Wed Apr 22 10:08:46 2020 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # UUID=6a09973e-e8fd-4a6d-a8c0-1deb9556f477 / xfs defaults 0 0 UUID=7ADD-F946 /boot/efi vfat defaults,uid=0,gid=0,umask=0077,shortname=winnt 0 0 [root@localhost ~]# ls /dev/disk/by-uuid/ 6a09973e-e8fd-4a6d-a8c0-1deb9556f477 7ADD-F946 [root@localhost ~]#

准备:需要QEMU_EFI.fd 文件,可以安装edk2.git-aarch64**获取**:

wget https://www.kraxel.org/repos/firmware.repo -O /etc/yum.repos.d/firmware.repo

yum -y install edk2.git-aarch64

或者离线安装,在有外网的环境下访问https://www.kraxel.org/repos/jenkins/edk2/,获取rpm包并拷贝至目标服务器系统相应位置。执行如下命令离线安装edk2

rpm -ivh edk2.git-aarch64*.rpm

安装完毕后:/usr/share/edk2.git/aarch64/QEMU_EFI.fd 拷贝到实际想要使用的路径下

QEMU_EFI.fd 下载

Linaro Releases

[root@localhost cloud_images]# bash kp.sh 
3h
3h
3h
3h
3h
3h
Failed to set MokListRT: Invalid Parameter
Something has gone seriously wrong: import_mok_state() failed
: Invalid Parameter
[root@localhost cloud_images]# 
#!/bin/bash
​
qemu-s
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值