Skip to content

Instantly share code, notes, and snippets.

@nobuh
Last active May 6, 2021 03:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nobuh/e29d7cabbaf3f59f4aaa0709fe884263 to your computer and use it in GitHub Desktop.
Save nobuh/e29d7cabbaf3f59f4aaa0709fe884263 to your computer and use it in GitHub Desktop.
QEMU 学習ノート

QEMU ARM 学習ノート

qemu-system-arm のインストール

qemu サイトトップでも apt パッケージが奨励されているのでソースインストールはまだやっていない

そのため --target-list=arm-softmmu でビルドしてないが、もし必要になったら qemu はソースから入れ直す

テストイメージ

qemu の wiki では直接は配布していない。Linux のテストイメージっぽいリンクはここ https://people.debian.org/~aurel32/qemu/armel/

をダウンロード

qemu-system-arm -M versatilepb -kernel vmlinuz-3.2.0-4-versatile -initrd initrd.img-3.2.0-4-versatile -hda debian_wheezy_armel_standard.qcow2 -append "root=/dev/sda1"

で GUI 起動できる。root パスは root。 感想

  • versatilepb とか古いので virt に出来ないか
  • もっと小さいディスクイメージか、または initrd だけで起動できるのないか
qemu-system-arm -M versatilepb -kernel vmlinuz-3.2.0-4-versatile -initrd initrd.img-3.2.0-4-versatile -hda debian_wheezy_armel_standard.qcow2 -append "root=/dev/sda1" -nographic

で動かすと、起動メッセージが表示されずしばらくだんまりになる

~/arm-test$ qemu-system-arm -M versatilepb -kernel vmlinuz-3.2.0-4-versatile -initrd initrd.img-3.2.0-4-versatile -hda debian_wheezy_armel_standard.qcow2 -append "root=/dev/sda1" -nographic -serial mon:stdio
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. // ここで長時間待つがメッセージは出ない、がログインは可能に

Debian GNU/Linux 7 debian-armel ttyAMA0

debian-armel login: root
Password: 
Last login: Thu May  6 03:16:52 UTC 2021 on tty1
Linux debian-armel 3.2.0-4-versatile #1 Debian 3.2.51-1 armv5tejl

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
root@debian-armel:~# 
root@debian-armel:~# 

ctrl A - C での qemu モニタへの出入りは可能

ログインのときに表示されている ttyAMA0 へカーネル起動コマンドで console を変えるようにしたら起動メッセージも表示された

~/arm-test$ qemu-system-arm -M versatilepb -kernel vmlinuz-3.2.0-4-versatile -initrd initrd.img-3.2.0-4-versatile -hda debian_wheezy_armel_standard.qcow2 -append "root=/dev/sda1 console=ttyAMA0" -nographic

ttyAMA0 というのは ARM の 64 bit aarch64 だと使われるコンソール名っぽいが正しいところはよくわからん

~/arm-test$ qemu-system-arm -M versatilepb -kernel vmlinuz-3.2.0-4-versatile -initrd initrd.img-3.2.0-4-versatile -hda debian_wheezy_armel_standard.qcow2 -append "root=/dev/sda1 console=ttyAMA0" -nographic
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.
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Linux version 3.2.0-4-versatile (debian-kernel@lists.debian.org) (gcc version 4.6.3 (Debian 4.6.3-14) ) #1 Debian 3.2.51-1
[ 0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00093177
[ 0.000000] CPU: VIVT data cache, VIVT instruction cache
[ 0.000000] Machine: ARM-Versatile PB
[ 0.000000] Memory policy: ECC disabled, Data cache writeback
[ 0.000000] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 178956ms
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512
[ 0.000000] Kernel command line: root=/dev/sda1 console=ttyAMA0
[ 0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[ 0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[ 0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.000000] Memory: 128MB = 128MB total
[ 0.000000] Memory: 123144k/123144k available, 7928k reserved, 0K highmem
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
[ 0.000000] vmalloc : 0xc8800000 - 0xd8000000 ( 248 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xc8000000 ( 128 MB)
[ 0.000000] modules : 0xbf000000 - 0xc0000000 ( 16 MB)
[ 0.000000] .text : 0xc0008000 - 0xc036fe74 (3488 kB)
[ 0.000000] .init : 0xc0370000 - 0xc038e000 ( 120 kB)
[ 0.000000] .data : 0xc038e000 - 0xc03bf978 ( 199 kB)
[ 0.000000] .bss : 0xc03bf99c - 0xc0422dcc ( 398 kB)
[ 0.000000] NR_IRQS:192
[ 0.000000] VIC @f1140000: id 0x00041190, vendor 0x41
[ 0.000000] Console: colour dummy device 80x30
[ 0.028239] Calibrating delay loop... 594.73 BogoMIPS (lpj=2973696)
[ 0.195148] pid_max: default: 32768 minimum: 301
[ 0.202380] Security Framework initialized
[ 0.207026] Mount-cache hash table entries: 512
[ 0.218524] Initializing cgroup subsys cpuacct
[ 0.218644] Initializing cgroup subsys memory
[ 0.219115] Initializing cgroup subsys devices
[ 0.219215] Initializing cgroup subsys freezer
[ 0.219268] Initializing cgroup subsys net_cls
[ 0.219327] Initializing cgroup subsys blkio
[ 0.219395] Initializing cgroup subsys perf_event
[ 0.221358] CPU: Testing write buffer coherency: ok
[ 0.243540] devtmpfs: initialized
[ 0.256882] print_constraints: dummy:
[ 0.261568] NET: Registered protocol family 16
[ 0.269336] Serial: AMBA PL011 UART driver
[ 0.271246] dev:f1: ttyAMA0 at MMIO 0x101f1000 (irq = 12) is a PL011 rev1
[ 0.281764] console [ttyAMA0] enabled
[ 0.285091] dev:f2: ttyAMA1 at MMIO 0x101f2000 (irq = 13) is a PL011 rev1
[ 0.286238] dev:f3: ttyAMA2 at MMIO 0x101f3000 (irq = 14) is a PL011 rev1
[ 0.287346] fpga:09: ttyAMA3 at MMIO 0x10009000 (irq = 38) is a PL011 rev1
[ 0.289577] PCI core found (slot 11)
[ 0.295163] PCI: bus0: Fast back to back transfers disabled
[ 0.296626] PCI map irq: slot 0, pin 1, devslot 12, irq: 27
[ 0.298004] pci 0000:00:0c.0: BAR 2: assigned [mem 0x50000000-0x50001fff]
[ 0.298538] pci 0000:00:0c.0: BAR 1: assigned [mem 0x50002000-0x500023ff]
[ 0.298793] pci 0000:00:0c.0: BAR 0: assigned [io 0x44000000-0x440000ff]
[ 0.317040] bio: create slab <bio-0> at 0
[ 0.325748] vgaarb: loaded
[ 0.336339] Switching to clocksource timer3
[ 0.402182] NET: Registered protocol family 2
[ 0.409180] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.424311] TCP established hash table entries: 4096 (order: 3, 32768 bytes)
[ 0.424994] TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.425502] TCP: Hash tables configured (established 4096 bind 4096)
[ 0.426175] TCP reno registered
[ 0.426464] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.426911] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.434466] NET: Registered protocol family 1
[ 0.439481] Unpacking initramfs...
[ 0.722846] Freeing initrd memory: 2524K
[ 0.723125] NetWinder Floating Point Emulator V0.97 (double precision)
[ 0.734759] audit: initializing netlink socket (disabled)
[ 0.736431] type=2000 audit(0.700:1): initialized
[ 0.772199] VFS: Disk quotas dquot_6.5.2
[ 0.774801] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[ 0.776853] msgmni has been set to 245
[ 0.791601] alg: No test for stdrng (krng)
[ 0.794568] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
[ 0.795362] io scheduler noop registered
[ 0.795574] io scheduler deadline registered
[ 0.800567] io scheduler cfq registered (default)
[ 0.804297] clcd-pl11x dev:20: PL110 rev0 at 0x10120000
[ 0.807121] clcd-pl11x dev:20: Versatile hardware, VGA display
[ 0.841825] Console: switching to colour frame buffer device 80x30
[ 0.850250] mousedev: PS/2 mouse device common for all mice
[ 0.855609] rtc-pl031 dev:e8: rtc core: registered pl031 as rtc0
[ 0.861133] TCP cubic registered
[ 0.861421] NET: Registered protocol family 17
[ 0.861873] Registering the dns_resolver key type
[ 0.863182] VFP support v0.3: implementor 41 architecture 1 part 10 variant 9 rev 0
[ 0.866090] registered taskstats version 1
[ 0.867671] rtc-pl031 dev:e8: setting system clock to 2021-05-06 03:28:27 UTC (1620271707)
[ 0.868144] Initializing network drop monitor service
[ 0.888954] Freeing init memory: 120K
[ 0.959038] input: AT Raw Set 2 keyboard as /devices/fpga:06/serio0/input/input0
Loading, please wait...
[ 1.413504] udevd[42]: starting version 175
[ 2.528827] SCSI subsystem initialized
[ 2.568041] PCI: enabling device 0000:00:0c.0 (0100 -> 0103)
[ 2.571677] sym0: <895a> rev 0x0 at pci 0000:00:0c.0 irq 27
[ 2.600576] sym0: No NVRAM, ID 7, Fast-40, LVD, parity checking
[ 2.614493] sym0: SCSI BUS has been reset.
[ 2.615012] scsi0 : sym-2.2.3
Begin: Loading essential drivers ... modprobe: module clcd-pl11x not found in modules.dep
done.
Begin: Running /scripts/init-premount ... done.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done.
Begin: Waiting for root file system ... [ 5.651242] scsi 0:0:0:0: Direct-Access QEMU QEMU HARDDISK 2.5+ PQ: 0 ANSI: 5
[ 5.656736] scsi target0:0:0: tagged command queuing enabled, command queue depth 16.
[ 5.674254] scsi target0:0:0: Beginning Domain Validation
[ 5.680689] scsi target0:0:0: Domain Validation skipping write tests
[ 5.680977] scsi target0:0:0: Ending Domain Validation
[ 5.693256] scsi 0:0:2:0: CD-ROM QEMU QEMU CD-ROM 2.5+ PQ: 0 ANSI: 5
[ 5.693642] scsi target0:0:2: tagged command queuing enabled, command queue depth 16.
[ 5.694013] scsi target0:0:2: Beginning Domain Validation
[ 5.695059] scsi target0:0:2: Domain Validation skipping write tests
[ 5.695333] scsi target0:0:2: Ending Domain Validation
[ 5.887286] sd 0:0:0:0: [sda] 52428800 512-byte logical blocks: (26.8 GB/25.0 GiB)
[ 5.889345] sd 0:0:0:0: [sda] Write Protect is off
[ 5.890142] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 5.935603] sda: sda1 sda2 < sda5 >
[ 5.948651] sd 0:0:0:0: [sda] Attached SCSI disk
done.
Begin: Running /scripts/local-premount ... done.
[ 7.052065] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
Begin: Running /scripts/local-bottom ... done.
done.
Begin: Running /scripts/init-bottom ... done.
INIT: version 2.88 booting
[info] Using makefile-style concurrent boot in runlevel S.
[....] Starting the hotplug events dispatcher: udevd[ 14.427230] udevd[269]: starting version 175
. ok
[....] Synthesizing the initial hotplug events...[ 17.518278] smc91x.c: v1.1, sep 22 2004 by Nicolas Pitre <nico@fluxnic.net>
[ 17.625516] sr0: scsi3-mmc drive: 16x/50x cd/rw xa/form2 cdda tray
[ 17.626198] cdrom: Uniform CD-ROM driver Revision: 3.20
[ 17.683714] eth0: SMC91C11xFD (rev 1) at c89a2000 IRQ 25 [nowait]
[ 17.684185] eth0: Ethernet addr: 52:54:00:12:34:56
[ 17.767656] input: ImExPS/2 Generic Explorer Mouse as /devices/fpga:07/serio1/input/input1
[ 18.181721] sd 0:0:0:0: Attached scsi generic sg0 type 0
[ 18.182648] sr 0:0:2:0: Attached scsi generic sg1 type 5
[ 18.870422] rtc-ds1307 0-0068: rtc core: registered ds1338 as rtc1
[ 18.871531] rtc-ds1307 0-0068: 56 bytes nvram
done.
[ ok ] Waiting for /dev to be fully populated...done.
[ ok ] Setting preliminary keymap...done.
[....] Activating swap...[ 29.846248] Adding 496636k swap on /dev/sda5. Priority:-1 extents:1 across:496636k
done.
[ 30.726284] EXT4-fs (sda1): re-mounted. Opts: (null)
[....] Checking root file system...fsck from util-linux 2.20.1
/dev/sda1: clean, 32924/1607520 files, 301080/6428672 blocks
done.
[ 32.278797] EXT4-fs (sda1): re-mounted. Opts: errors=remount-ro
[....] [ 35.514121] loop: module loaded
[ ok ing up temporary files... /tmp.
[info] Loading kernel module loop.
[ ok ] Activating lvm and md swap...done.
[....] Checking file systems...fsck from util-linux 2.20.1
done.
[ ok ] Mounting local filesystems...done.
[ ok ] Activating swapfile swap...done.
[ ok ] Cleaning up temporary files....
[ ok ] Setting kernel variables ...done.
[....] Configuring network interfaces...[ 76.410621] NET: Registered protocol family 10
[ 77.668917] eth0: link up
done.
[ ok ] Starting rpcbind daemon....
[....] Starting NFS common utilities: statd[ 83.789076] RPC: Registered named UNIX socket transport module.
[ 83.789977] RPC: Registered udp transport module.
[ 83.790214] RPC: Registered tcp transport module.
[ 83.790449] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 83.902839] FS-Cache: Loaded
[ 83.967272] FS-Cache: Netfs 'nfs' registered for caching
[ 84.060441] Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
[ ok pd.
[ ok ] Cleaning up temporary files....
[info] Setting console screen modes.
setterm: cannot (un)set powersave mode: Invalid argument
[info] Skipping font and keymap setup (handled by console-setup).
[ ok ] Setting up console font and keymap...done.
INIT: Entering runlevel: 2
[info] Using makefile-style concurrent boot in runlevel 2.
[ ok ] Starting NFS common utilities: statd idmapd.
[ ok ] Starting rpcbind daemon...[....] Already running..
[ ok ] Starting enhanced syslogd: rsyslogd.
[ ok ] Starting deferred execution scheduler: atd.
[ ok ] Starting periodic command scheduler: cron.
[ ok ] Starting MTA:[....] Starting OpenBSD Secure Shell server: sshd.
[ ok 4.
Debian GNU/Linux 7 debian-armel ttyAMA0
debian-armel login:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment