Como executar um Raspiban no QEMU

11

Como você executa uma imagem Raspbian padrão no QEMU?

Estou seguindo as instruções neste wiki , mas o primeiro passo está falhando.

Eu baixei a imagem do kernal kernel-qemu-4.1.13-jessiee da Raspbian Jessie Lite , mas quando executo:

qemu-system-arm -kernel kernel-qemu-4.1.13-jessie \
    -cpu arm1176 \
    -m 256 \
    -M versatilepb \
    -no-reboot \
    -serial stdio \
    -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw init=/bin/bash" \
    -hda 2016-03-18-raspbian-jessie-lite.img

Uma janela QEMU aparece e parece mostrá-la inicializando corretamente, mas depois diz "reiniciando em 1 segundo" e fecha. Meu terminal local apenas produz:

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.

Por que ele está reiniciando, mesmo usando a -no-rebootopção? O que estou fazendo errado?

Edit: Eu descobri que eu poderia salvar a saída do console executando:

qemu-system-arm -kernel kernel-qemu-4.1.13-jessie -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw console=ttyAMA0,115200" -hda 2016-03-18-raspbian-jessie-lite.img

Com isso, agora posso ver a saída:

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
sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 65024
Kernel command line: root=/dev/sda2 panic=1 rootfstype=ext4 rw console=ttyAMA0,115200
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: 254696K/262144K available (3696K kernel code, 162K rwdata, 992K rodata, 140K init, 128K bss, 7448K reserved, 0K cma-reserved)
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
    vmalloc : 0xd0800000 - 0xff000000   ( 744 MB)
    lowmem  : 0xc0000000 - 0xd0000000   ( 256 MB)
    modules : 0xbf000000 - 0xc0000000   (  16 MB)
      .text : 0xc0008000 - 0xc049c534   (4690 kB)
      .init : 0xc049d000 - 0xc04c0000   ( 140 kB)
      .data : 0xc04c0000 - 0xc04e8880   ( 163 kB)
       .bss : 0xc04e8880 - 0xc0508a1c   ( 129 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... 523.46 BogoMIPS (lpj=2617344)
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)
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: bus0: Fast back to back transfers disabled
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
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.
NetWinder Floating Point Emulator V0.97 (double precision)
futex hash table entries: 256 (order: -1, 3072 bytes)
Installing knfsd (copyright (C) 1996 [email protected]).
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
sym0: unknown interrupt(s) ignored, ISTAT=0x5 DSTAT=0x80 SIST=0x0
scsi 0:0:0:0: Direct-Access     QEMU     QEMU HARDDISK    2.0. 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.0. 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] 1911808 512-byte logical blocks: (978 MB/933 MiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
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
 sda: sda1 sda2
sda: p2 size 2527232 extends beyond EOD, enabling native capacity
 sda: sda1 sda2
sda: p2 size 2527232 extends beyond EOD, truncated
sd 0:0:0:0: [sda] Attached SCSI disk
smc91x.c: v1.1, sep 22 2004 by Nicolas Pitre <[email protected]>
smc91x smc91x.0 eth0: SMC91C11xFD (rev 1) at d0a72000 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
NET: Registered protocol family 17
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
EXT4-fs (sda2): bad geometry: block count 315904 exceeds size of device (222592 blocks)
EXT4-fs (sda2): bad geometry: block count 315904 exceeds size of device (222592 blocks)
List of all 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?)
0800          955904 sda  driver: sd
  0801           61440 sda1 6f92008e-01
  0802          890368 sda2 6f92008e-02
0b00         1048575 sr0  driver: sr
1f00           65536 mtdblock0  (driver?)
No filesystem could mount root, tried:  ext4
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(8,2)
CPU: 0 PID: 1 Comm: swapper Not tainted 4.1.13+ #2
Hardware name: ARM-Versatile PB
[<c001b218>] (unwind_backtrace) from [<c0017d58>] (show_stack+0x10/0x14)
[<c0017d58>] (show_stack) from [<c0383234>] (panic+0x78/0x1c8)
[<c0383234>] (panic) from [<c049e240>] (mount_block_root+0x228/0x270)
[<c049e240>] (mount_block_root) from [<c049e470>] (mount_root+0xec/0x114)
[<c049e470>] (mount_root) from [<c049e5fc>] (prepare_namespace+0x164/0x1c8)
[<c049e5fc>] (prepare_namespace) from [<c049ddb0>] (kernel_init_freeable+0x168/0x1ac)
[<c049ddb0>] (kernel_init_freeable) from [<c03828d0>] (kernel_init+0x8/0xe8)
[<c03828d0>] (kernel_init) from [<c0014b48>] (ret_from_fork+0x14/0x2c)
Rebooting in 1 seconds..

A linha principal parece existir No filesystem could mount root, tried: ext4. O que está impedindo a montagem do sistema de arquivos?

Cerin
fonte
Você pode mostrar os arquivos de configuração que você configurou? Parece que o sda2 foi configurado incorretamente.
Jacobm001
Eu tive um tutorial que estava funcionando para mim. está disponível apenas na máquina wayback. lá o autor menciona a segunda inicialização sem o comando init / ou console. talvez esta seja uma solução para você. web.archive.org/web/20150302053420/http://xecdesign.com/…
Joe Platano
o que você está executando como sistema operacional host?
Joe Platano 08/07
As instruções às quais você vinculou agora têm algumas notas sobre os kernels 4.x, confira
jogco 17/07/16

Respostas:

2

costura esteja errado: root = / dev / sda2 Tente substituir por (waitroot dará tempo para ler o erro):

  • -append "root = / dev / sda2 waitroot rootfstype = ext4 rw init = / bin / bash"
  • -append "root = / dev / vda2 waitroot rootfstype = ext4 rw init = / bin / bash"
  • -append "raiz = / dev / hda2 rootfstype de raiz de espera = ext4 rw init = / bin / bash"

2016-03-18-raspbian-jessie-lite.img é realmente ext4 na segunda parte?

O comando: "parted 2016-03-18-raspbian-jessie-lite.img print" o confirmará.

alpha_one_x86
fonte