Kernel Panic 在 qemu 上模拟 Raspberry pi 3 图像

Kernel Panic Emulating Rasberry pi3 image on qemu

我正在尝试在从 kali linux 2017 repos 安装的 qemu 上模拟 raspberry pi3 映像 ository 我给 运行 vm 的命令在下面给出内核是从互联网上下载的 树莓派镜像包含一个 os-release 文件,其中有 Version=8 jessie 条目

qemu-system-arm -kernel kernel-qemu-4.4.34-jessie -cpu arm1176 -m 256 -M versatilepb -serial stdio -a=8 console=ttyAMA0,115200 dwc_otg.lpm_enable=0 root=/dev/sda2 panic=1000 rootfstype=ext4 rw --show-command" -drive "file=usarcades_rpi_2017-06-05.img,index=0,media=disk,format=raw" -D /root/qemu_vms/qemuvm.log -monitor pty

Log

pulseaudio: set_sink_input_volume() failed
pulseaudio: Reason: Invalid argument
pulseaudio: set_sink_input_mute() failed
pulseaudio: Reason: Invalid argument
Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x0
Initializing cgroup subsys cpuset
Initializing cgroup subsys cpu
Initializing cgroup subsys cpuacct
Linux version 4.4.34+ (amit@penguin) (gcc version 6.2.1 20161119 (Debian  6.2.1-4) ) #3 Thu Dec 1 14:44:23 IST 2016
CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
CPU: VIPT aliasing data cache, unknown instruction cache
Machine: ARM-Versatile PB
Memory policy: Data cache writeback
On node 0 totalpages: 65536
free_area_init_node: node 0, pgdat c05698f4, node_mem_map cfdb9000
Normal zone: 576 pages used for memmap
Normal zone: 0 pages reserved
Normal zone: 65536 pages, LIFO batch:15
sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
pcpu-alloc: [0] 0 
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 64960
Kernel command line: earlyprintk loglevel=8 console=ttyAMA0,115200   dwc_otg.lpm_enable=0 root=/dev/sda2 panic=1000 rootfstype=ext4 rw --show-command
PID hash table entries: 1024 (order: 0, 4096 bytes)
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 253716K/262144K available (4270K kernel code, 56K rwdata, 1008K  rodata, 176K init, 139K bss, 8428K reserved, 0K cma-reserved)
Virtual kernel memory layout:
vector  : 0xffff0000 - 0xffff1000   (   4 kB)
fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
vmalloc : 0xd0800000 - 0xff800000   ( 752 MB)
lowmem  : 0xc0000000 - 0xd0000000   ( 256 MB)
modules : 0xbf000000 - 0xc0000000   (  16 MB)
  .text : 0xc0008000 - 0xc052fd68   (5280 kB)
  .init : 0xc0530000 - 0xc055c000   ( 176 kB)
  .data : 0xc055c000 - 0xc056a120   (  57 kB)
   .bss : 0xc059ae50 - 0xc05bdb58   ( 140 kB)
NR_IRQS:224
VIC @f1140000: id 0x00041190, vendor 0x41
FPGA IRQ chip 0 "SIC" @ f1003000, 13 irqs, parent IRQ: 63
clocksource: timer3: mask: 0xffffffff max_cycles: 0xffffffff,    max_idle_ns: 1911260446275 ns
Console: colour dummy device 80x30
Calibrating delay loop... 417.79 BogoMIPS (lpj=2088960)
   pid_max: default: 32768 minimum: 301
   Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
   Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
   Disabling cpuset control group subsystem
   Initializing cgroup subsys memory
   Initializing cgroup subsys devices
   Initializing cgroup subsys freezer
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x8220 - 0x827c
devtmpfs: initialized
VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
Serial: AMBA PL011 UART driver
dev:f1: ttyAMA0 at MMIO 0x101f1000 (irq = 44, base_baud = 0) is a PL011 rev1
console [ttyAMA0] enabled
dev:f2: ttyAMA1 at MMIO 0x101f2000 (irq = 45, base_baud = 0) is a PL011 rev1
 dev:f3: ttyAMA2 at MMIO 0x101f3000 (irq = 46, base_baud = 0) is a PL011 rev1
 fpga:09: ttyAMA3 at MMIO 0x10009000 (irq = 70, base_baud = 0) is a PL011 rev1
 PCI core found (slot 11)
 PCI host bridge to bus 0000:00
 pci_bus 0000:00: root bus resource [mem 0x50000000-0x5fffffff]
 pci_bus 0000:00: root bus resource [mem 0x60000000-0x6fffffff pref]
 pci_bus 0000:00: root bus resource [io  0x1000-0xffff]
 pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
 pci 0000:00:0c.0: [1000:0012] type 00 class 0x010000
 pci 0000:00:0c.0: reg 0x10: [io  0x0000-0x00ff]
 pci 0000:00:0c.0: reg 0x14: [mem 0x00000000-0x000003ff]
 pci 0000:00:0c.0: reg 0x18: [mem 0x00000000-0x00001fff]
 PCI: bus0: Fast back to back transfers disabled
 pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 00
 pci 0000:00:0c.0: BAR 2: assigned [mem 0x50000000-0x50001fff]
 pci 0000:00:0c.0: BAR 1: assigned [mem 0x50002000-0x500023ff]
 pci 0000:00:0c.0: BAR 0: assigned [io  0x1000-0x10ff]
 vgaarb: loaded
 SCSI subsystem initialized
 clocksource: Switched to clocksource timer3
 NET: Registered protocol family 2
 TCP established hash table entries: 2048 (order: 1, 8192 bytes)
 TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
 TCP: Hash tables configured (established 2048 bind 2048)
 UDP hash table entries: 256 (order: 0, 4096 bytes)
 UDP-Lite hash table entries: 256 (order: 0, 4096 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.
 PCI: CLS 32 bytes, default 32
 NetWinder Floating Point Emulator V0.97 (double precision)
 futex hash table entries: 256 (order: -1, 3072 bytes)
  Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
 jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
 romfs: ROMFS MTD (C) 2007 Red Hat, Inc.
 Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
 io scheduler noop registered
 io scheduler deadline registered
 io scheduler cfq registered (default)
 pl061_gpio dev:e4: PL061 GPIO chip @0x101e4000 registered
 pl061_gpio dev:e5: PL061 GPIO chip @0x101e5000 registered
 pl061_gpio dev:e6: PL061 GPIO chip @0x101e6000 registered
 pl061_gpio dev:e7: PL061 GPIO chip @0x101e7000 registered
 clcd-pl11x dev:20: PL110 rev0 at 0x10120000
 clcd-pl11x dev:20: Versatile hardware, VGA display
 Console: switching to colour frame buffer device 80x30
 brd: module loaded
 sym53c8xx 0000:00:0c.0: enabling device (0100 -> 0103)
 sym0: <895a> rev 0x0 at pci 0000:00:0c.0 irq 93
 sym0: No NVRAM, ID 7, Fast-40, LVD, parity checking
 sym0: SCSI BUS has been reset.
 scsi host0: sym-2.2.3
 scsi 0:0:0:0: Direct-Access     QEMU     QEMU HARDDISK    2.5+ PQ: 0 ANSI: 5
 scsi target0:0:0: tagged command queuing enabled, command queue depth 16.
 scsi target0:0:0: Beginning Domain Validation
 scsi target0:0:0: Domain Validation skipping write tests
 scsi target0:0:0: Ending Domain Validation
 scsi 0:0:2:0: CD-ROM            QEMU     QEMU CD-ROM      2.5+ PQ: 0 ANSI: 5
 scsi target0:0:2: tagged command queuing enabled, command queue depth 16.
 scsi target0:0:2: Beginning Domain Validation
 scsi target0:0:2: Domain Validation skipping write tests
 scsi target0:0:2: Ending Domain Validation
 sr 0:0:2:0: [sr0] scsi3-mmc drive: 16x/50x cd/rw xa/form2 cdda tray
 cdrom: Uniform CD-ROM driver Revision: 3.20
 sd 0:0:0:0: [sda] 6445056 512-byte logical blocks: (3.30 GB/3.07 GiB)
 sd 0:0:0:0: [sda] Write Protect is off
 sd 0:0:0:0: [sda] Mode Sense: 63 00 00 08
 sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
  sr 0:0:2:0: Attached scsi CD-ROM sr0
  physmap platform flash device: 04000000 at 34000000
  physmap-flash.0: Found 1 x32 devices at 0x0 in 32-bit bank.     Manufacturer ID 0x000000 Chip ID 0x000000
  Intel/Sharp Extended Query Table at 0x0031
 Using buffer write method
 erase region 0: offset=0x0,size=0x40000,blocks=256
 sda: sda1
 sd 0:0:0:0: [sda] Attached SCSI disk
 smc91x.c: v1.1, sep 22 2004 by Nicolas Pitre <nico@fluxnic.net>
 smc91x smc91x.0 eth0: SMC91C11xFD (rev 1) at d0a68000 IRQ 57
 [nowait]
 smc91x smc91x.0 eth0: Ethernet addr: 52:54:00:12:34:56
 mousedev: PS/2 mouse device common for all mice
 ledtrig-cpu: registered to indicate activity on CPUs
 Netfilter messages via NETLINK v0.30.
 nf_conntrack version 0.5.0 (3964 buckets, 15856 max)
 ip_tables: (C) 2000-2006 Netfilter Core Team
 NET: Registered protocol family 17
 bridge: automatic filtering via arp/ip/ip6tables has been deprecated.     Update your scripts to load br_netfilter if you need this.
 Bridge firewalling registered
 input: AT Raw Set 2 keyboard as /devices/fpga:06/serio0/input/input0
 input: ImExPS/2 Generic Explorer Mouse as /devices/fpga:07/serio1/input/input2
 VFS: Cannot open root device "sda2" or unknown-block(8,2): error -6
 Please append a correct "root=" boot option; here are the available      partitions:
  0100            4096 ram0  (driver?)
  0101            4096 ram1  (driver?)
  0102            4096 ram2  (driver?)
  0103            4096 ram3  (driver?)
  0104            4096 ram4  (driver?)
  0105            4096 ram5  (driver?)
  0106            4096 ram6  (driver?)
  0107            4096 ram7  (driver?)
  0108            4096 ram8  (driver?)
  0109            4096 ram9  (driver?)
  010a            4096 ram10  (driver?)
  010b            4096 ram11  (driver?)
  010c            4096 ram12  (driver?)
  010d            4096 ram13  (driver?)
  010e            4096 ram14  (driver?)
  010f            4096 ram15  (driver?)
  0b00         1048575 sr0  driver: sr
  0800         3222528 sda  driver: sd
  0801         3221504 sda1 f972ed87-01
  1f00           65536 mtdblock0  (driver?)
  Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(8,2)
  CPU: 0 PID: 1 Comm: swapper Not tainted 4.4.34+ #3
  Hardware name: ARM-Versatile PB
  [<c001ca90>] (unwind_backtrace) from [<c0018f14>] (show_stack+0x10/0x14)
  [<c0018f14>] (show_stack) from [<c0080c2c>] (panic+0x94/0x240)
  [<c0080c2c>] (panic) from [<c05314f0>] (mount_block_root+0x1e4/0x2d4)
  [<c05314f0>] (mount_block_root) from [<c0531820>]    (mount_root+0x130/0x16c)
  [<c0531820>] (mount_root) from [<c0531a10>] (prepare_namespace+0x1b4/0x244)
  [<c0531a10>] (prepare_namespace) from [<c0531034>] (kernel_init_freeable+0x214/0x26c)
  [<c0531034>] (kernel_init_freeable) from [<c04110f8>] (kernel_init+0x8/0x118)
  [<c04110f8>] (kernel_init) from [<c00151b8>] (ret_from_fork+0x14/0x3c)

Boot director screenshot Boot Directory

cmdline.txt内容-

dwc_otg.lpm_enable=0 console=/dev/null root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait loglevel=3 logo.nologo vt.global_cursor_default=0 consoleblank=0

我应该在此命令中添加哪些额外的选项来制作 vm 运行? 树莓派镜像有两个分区,一个引导另一个根文件系统引导文件夹包含 kernel7.img commands.txt 文件和 config.file.

您的命令行告诉来宾内核"root=/dev/sda2"但是您传递给它的磁盘映像只有一个分区;来宾内核说 sda: sda1 (如果有两个分区,它会说 'sda: sda1 sda2'),因此来宾恐慌,因为您指定的根设备不存在。

您需要修复来宾内核命令行或磁盘映像,以便它们匹配。