Kernel
無法通過 qemu/kvm-tools 啟動 kvm 來賓
我正在使用ARM Foundation Model來模擬 arm-v8 環境(我需要 TrustZone 和 KVM),並且我在其上執行支持 kvm 的 linux 作為主機作業系統,核心版本是 3.14.0(我按照 虛擬開放系統指南。
但是,當嘗試執行客戶作業系統時,我遇到了一些問題(kvm-tools 和 qemu-system-aarch64)。以下是我遇到的:
所有工具和核心原始碼都來自上述指南,我使用預建構的二進製文件。但是我自己編譯了核心。
- KVM 工具:
- 我使用在 virtualopensystems 網站 lkvm-static 中找到的預建構 kvm 工具
- 當我啟動來賓核心時,它掛在bootconsole$$ earlycon0 $$禁用。我做了一些Google工作,但沒有發現太多。有人說這可能是因為設備樹錯誤,但我的指南中沒有 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
原來是這個問題
Image
,我重新編譯核心然後就OK了。但是lkvm-tools有一些問題,它不能正常初始化ioctl。