我在用ARM 基础模型模拟arm-v8环境(我需要TrustZone和KVM),并在其上运行启用kvm的linux作为主机操作系统,内核版本是3.14.0(我按照 虚拟开放系统指南。
但是,当尝试运行来宾操作系统时,我遇到了一些问题(kvm-tools 和 qemu-system-aarch64)。以下是我遇到的情况:
所有工具和内核源代码都来自上面提到的指南,我使用预构建的二进制文件。不过内核是我自己编译的。
KVM工具:
- 我使用在 virtualopensystems 网站 lkvm-static 中找到的预构建 kvm 工具
- 当我启动来宾内核时,它挂在bootconsole [earlycon0] 已禁用。我做了一些谷歌工作,但没有找到太多。有人说这可能是因为错误的设备树,但我的指南中没有 dtb 文件。
qemu-系统-aarch64
- 另外,我使用预构建的二进制文件
- 当我启动来宾内核时,它看起来“正常”,直到它给出如下消息:
hwclock: can't open '/dev/misc/rtc': No such file or directory
modprobe: can't change directory to '3.14.0': No such file or directory
openvt: can't open '/dev/tty1': No such file or directory
- QEMU 的完整日志将在这个问题的最后。
还有一点需要提及,.config
主机操作系统的文件不是原始文件。原始.config
文件具有KVM功能,但缺乏对DMA相关功能的支持,这是我自己需要的。
所以我将其替换为.config
3.18-rc内核中的。当然,它们根本不一样,当我运行时make
,我必须手动决定一些配置,我把它们全部决定为默认。编译后,TrustZone 功能正常,并且也生成了 /dev/kvm,但是当我尝试运行 guest OS 时,遇到了上述问题。
有人可以给我一些建议吗?
多谢。
杨俊
=================================================== =======
以下是使用 qemu 时的输出:
root@FVP:/data/qemu-kvm ./qemu-system-aarch64 --enable-kvm --nographic --kernel
Image --drive if=none,file=disk_oe64.img,id=fs --device virtio-blk-device,drive=fs -m 512 -M virt --cpu host --append "earlyprintk conosole=ttyAMA0 mem=512M rootwait root=/dev/vda rw"
Initializing cgroup subsys cpu
Linux version 3.14.0 (hamayun@hamayun-laptop) (gcc version 4.8.1 (Ubuntu/Linaro4.8.1-10ubuntu7) ) #1 SMP PREEMPT Tue Apr 29 15:37:35 CEST 2014
CPU: AArch64 Processor [410fd000] revision 0
No earlyprintk arguments passed.
Memory limited to 512MB
psci: probing function IDs from device-tree
PERCPU: Embedded 11 pages/cpu @ffffffc01ffe7000 s16128 r8192 d20736 u45056
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 129280
Kernel command line: earlyprintk conosole=ttyAMA0 mem=512M rootwait root=/dev/vda rw
PID hash table entries: 2048 (order: 2, 16384 bytes)
Dentry cache hash table entries: 65536 (order: 7, 524288 bytes)
Inode-cache hash table entries: 32768 (order: 6, 262144 bytes)
software IO TLB [mem 0x5b000000-0x5f000000] (64MB) mapped at [ffffffc01b000000-ffffffc01effffff]
Memory: 436272K/524288K available (4122K kernel code, 357K rwdata, 1748K rodata, 243K init, 284K bss, 88016K reserved)
Virtual kernel memory layout:
vmalloc : 0xffffff8000000000 - 0xffffffbbffff0000 (245759 MB)
vmemmap : 0xffffffbc00e00000 - 0xffffffbc01500000 ( 7 MB)
modules : 0xffffffbffc000000 - 0xffffffc000000000 ( 64 MB)
memory : 0xffffffc000000000 - 0xffffffc020000000 ( 512 MB)
.init : 0xffffffc00063d000 - 0xffffffc000679f00 ( 244 kB)
.text : 0xffffffc000080000 - 0xffffffc00063ca14 ( 5875 kB)
.data : 0xffffffc00067a000 - 0xffffffc0006d37d0 ( 358 kB)
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Preemptible hierarchical RCU implementation.
RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=1.
RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
NR_IRQS:64 nr_irqs:64 0
Architected cp15 timer(s) running at 100.00MHz (virt).
sched_clock: 56 bits at 100MHz, resolution 10ns, wraps every 2748779069440ns
Calibrating delay loop (skipped), value calculated using timer frequency.. 200.00 BogoMIPS (lpj=1000000)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 1, 8192 bytes)
Mountpoint-cache hash table entries: 1024 (order: 1, 8192 bytes)
hw perfevents: enabled with arm/armv8-pmuv3 PMU driver, 1 counters available
Brought up 1 CPUs
SMP: Total of 1 processors activated.
devtmpfs: initialized
atomic64 test passed
regulator-dummy: no parameters
NET: Registered protocol family 16
vdso: 2 pages (1 code, 1 data) at base ffffffc000681000
hw-breakpoint: found 16 breakpoint and 16 watchpoint registers.
Serial: AMBA PL011 UART driver
9000000.pl011: ttyAMA0 at MMIO 0x9000000 (irq = 33, base_baud = 0) is a PL011 rev1
console [ttyAMA0] enabled
bio: create slab <bio-0> at 0
SCSI subsystem initialized
Switched to clocksource arch_sys_counter
NET: Registered protocol family 2
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 4, 65536 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP: reno registered
UDP hash table entries: 256 (order: 1, 8192 bytes)
UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
kvm [1]: HYP mode not available
futex hash table entries: 256 (order: 2, 16384 bytes)
NFS: Registering the id_resolver key type
Key type id_resolver registered
Key type id_legacy registered
nfs4filelayout_init: NFSv4 File Layout Driver Registering...
fuse init (API version 7.22)
9p: Installing v9fs 9p2000 file system support
msgmni has been set to 852
io scheduler noop registered
io scheduler cfq registered (default)
Serial: AMBA driver
blk-mq: CPU -> queue map
CPU 0 -> Queue 0
vda: unknown partition table
TCP: cubic registered
NET: Registered protocol family 17
9pnet: Installing 9P2000 support
Key type dns_resolver registered
regulator-dummy: disabling
kjournald starting. Commit interval 5 seconds
EXT3-fs (vda): using internal journal
EXT3-fs (vda): mounted filesystem with writeback data mode
VFS: Mounted root (ext3 filesystem) on device 254:0.
devtmpfs: mounted
Freeing unused kernel memory: 240K (ffffffc00063d000 - ffffffc000679000)
INIT: version 2.88 booting
Mounting local filesystems...
Starting udev
udevd[384]: starting version 182
Activating swap
Starting Bootlog daemon: bootlogd.
Initializing random number generator...
random: dd urandom read with 5 bits of entropy available
udev-cache: checking for /dev/shm/udev-regen... found.
Populating dev cache
Populating volatile Filesystems.
Checking for -/run/lock-.
Creating directory -/run/lock-.
Checking for -/var/volatile/log-.
Creating directory -/var/volatile/log-.
Checking for -/var/volatile/tmp-.
Creating directory -/var/volatile/tmp-.
Target already exists. Skipping.
Checking for -/var/lock-.
Creating link -/var/lock- pointing to -/run/lock-.
Checking for -/var/log-.
Creating link -/var/log- pointing to -/var/volatile/log-.
Checking for -/var/run-.
Creating link -/var/run- pointing to -/run-.
Checking for -/var/tmp-.
Creating link -/var/tmp- pointing to -/var/volatile/tmp-.
Checking for -/tmp-.
Creating link -/tmp- pointing to -/var/tmp-.
Checking for -/var/lock/subsys-.
Creating directory -/var/lock/subsys-
Checking for -/var/log/wtmp-.
Creating file -/var/log/wtmp-.
Checking for -/var/run/utmp-.
Creating file -/var/run/utmp-.
Checking for -/etc/resolv.conf-.
Creating link -/etc/resolv.conf- pointing to -/var/run/resolv.conf-.
Checking for -/var/run/resolv.conf-.
Creating file -/var/run/resolv.conf-.
Checking for -/var/log/boot-.
Creating file -/var/log/boot-.
Target already exists. Skipping.
Checking for -/var/run/sepermit-.
Creating directory -/var/run/sepermit-.
Checking for -/var/run/sshd-.
Creating directory -/var/run/sshd-.
Checking for -/var/log/lastlog-.
Creating file -/var/log/lastlog-.
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.rp_filter = 1
System time was Thu Jan 1 00:00:06 UTC 1970.
Setting the System Clock using the Hardware Clock as reference...
hwclock: can't open '/dev/misc/rtc': No such file or directory
System Clock set. System local time is now Thu Jan 1 00:00:06 UTC 1970.
Thu Jun 18 11:03:04 UTC 2015
Saving the System Clock time to the Hardware Clock...
hwclock: can't open '/dev/misc/rtc': No such file or directory
Hardware Clock updated to Thu Jun 18 11:03:04 UTC 2015.
INIT: Entering runlevel: 5
Configuring network interfaces... ifconfig: SIOCGIFFLAGS: No such device
Starting OpenBSD Secure Shell server: sshd
generating ssh RSA key...
generating ssh ECDSA key...
generating ssh DSA key...
generating ssh ED25519 key...
done.
Starting rpcbind daemon...done.
starting statd: done
System time was Thu Jun 18 11:03:36 UTC 2015.
Setting the System Clock using the Hardware Clock as reference...
hwclock: can't open '/dev/misc/rtc': No such file or directory
System Clock set. System local time is now Thu Jun 18 11:03:36 UTC 2015.
modprobe: can't change directory to '3.14.0': No such file or directory
NFS daemon support not enabled in kernel
Starting syslogd/klogd: done
openvt: can't open '/dev/tty1': No such file or directory
Starting auto-serial-console: done
Stopping Bootlog daemon: bootlogd.
INIT: no more processes left in this runlevel
答案1
原来是这个问题Image
,我重新编译内核然后就OK了。
但是lkvm-tools有一些问题,无法初始化读写控制通常情况下。