Qemu-system-mips 在 "console [tty0] enabled" 之后卡住了

Qemu-system-mips stuck after "console [tty0] enabled"

我尝试使用 jcowgill 的预编译内核和 QCOW2 磁盘映像,但是 qemu 在一些输出后卡在了这里。不知道怎么回事,qemu就卡在这里了,我不能输入任何命令。

命令:

qemu-system-mips64el \
-M malta \
-cpu MIPS64R2-generic \
-m 2G \
-append 'root=/dev/sda2 console=tty0 mem=2048m nokaslr' \
-nographic \
-kernel vmlinux-4.9.0-4-5kc-malta.mipsel.stretch \
-initrd initrd.img-4.9.0-4-5kc-malta.mipsel.stretch \
-drive file=debian-stretch-mipsel.qcow2 

输出:

[    0.000000] Linux version 4.9.0-4-5kc-malta (debian-kernel@lists.debian.org) (gcc version 6.3.0 20170516 (Debian 6.3.0-18) ) #1 Debian 4.9.65-3 (2017-12-03)
[    0.000000] earlycon: uart8250 at I/O port 0x3f8 (options '38400n8')
[    0.000000] bootconsole [uart8250] enabled
[    0.000000] CPU0 revision is: 00010000 (MIPS GENERIC QEMU)
[    0.000000] FPU revision is: 007f0000
[    0.000000] Checking for the multiply/shift bug... [    0.000000] no.
[    0.000000] Checking for the daddiu bug... [    0.000000] no.
[    0.000000] MIPS: machine is mti,malta
[    0.000000] Software DMA cache coherency enabled
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 0000000010000000 @ 0000000000000000 (usable)
[    0.000000]  memory: 0000000070000000 @ 0000000090000000 (usable)
[    0.000000] User-defined physical RAM map:
[    0.000000]  memory: 0000000080000000 @ 0000000000000000 (usable)
[    0.000000] Initial ramdisk at: 0x900000000ed70000 (19204358 bytes)
[    0.000000] Reserving 0MB of memory at 0MB for crashkernel
[    0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000000000000-0x0000000000ffffff]
[    0.000000]   DMA32    [mem 0x0000000001000000-0x00000000ffffffff]
[    0.000000]   Normal   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x000000007fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000007fffffff]
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 516096
[    0.000000] Kernel command line: rd_start=0xffffffff8ed70000 rd_size=19204358 root=/dev/sda2 console=tty0 mem=2048m nokaslr
[    0.000000] PID hash table entries: 4096 (order: 3, 32768 bytes)
[    0.000000] Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes)
[    0.000000] Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes)
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 2030840K/2097152K available (6118K kernel code, 982K rwdata, 1596K rodata, 1516K init, 360K bss, 66312K reserved, 0K cma-reserved)
[    0.000000] NR_IRQS:256
[    0.000000] CPU frequency 200.00 MHz
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112681107 ns
[    0.000108] sched_clock: 32 bits at 99MHz, resolution 10ns, wraps every 21474922490ns
[    0.004826] Console: colour dummy device 80x25
[    0.005174] console [tty0] enabled
[    0.005521] bootconsole [uart8250] disabled

内核和img文件是从https://people.debian.org/~jcowgill/qemu-mips/

下载的
vmlinux-4.9.0-4-5kc-malta.mipsel.stretch 
initrd.img-4.9.0-4-5kc-malta.mipsel.stretch 
debian-stretch-mipsel.qcow2 

您的内核命令行显示“console=tty0”,意思是“请将控制台发送到第一个虚拟终端”,即发送到图形设备。但是您 运行 的机器中没有图形设备(您在 QEMU 命令行上说“-nographic”,内核说“Console:color dummy device 80x25”)。所以发生的事情是您通过“uart8250”earlycon(即串行端口)看到初始启动消息,但是一旦内核达到可以满足您的命令行请求的程度,它就会启用 tty0(无处可去) ) 并禁用 uart8250(因此您看不到进一步的输出)。

你需要告诉内核将控制台输出发送到串行端口,如果这是你希望看到它出现的地方,对于马耳他板,我认为你可以使用“console=ttyS0”代替.或者,您可以删除“-nographic”,确保您的内核具有内置 VGA 卡的驱动程序,并保留“console=tty0”,您将在图形 window 的虚拟控制台上看到控制台.

如果您查看 the README for the website you downloaded your image files from,您会发现它确实建议使用“console=ttyS0”。