概要
- WindowsのQEMUで Raspbian起動、させます。って、タイトルのまま。
- 参考: Raspberry Pi Emulation for Windows with QEMU
- QEMU Binaries for Windows
- qemu-rpi-kernel
- 7-Zip qemuの解凍に使用
環境
- Windows 7 (64bit)
- 2016-05-27-raspbian-jessie-lite.img
(md5: 8b585a5b888e805e14f6c35f900ae939)
- 2016-05-27-raspbian-jessie.img
(md5: 0d50922374043ed5246df2b316eb7d25)
手順
-
上のところから、ダウンロード
-
qemu-w64-setup-20160714.exe
を右クリック、うまく解凍して、C:\QEMUに配置(C:\QEMU\qemu-system-arm.exe となるようにする) -
Raspbian パッチ当て(3箇所)
バイナリエディタとかで、うまく書き換える。
# バイナリエディタは、wxHexEditorを使用。Options>FileMode>DirectWrite で、Disk上のデータを書き換えるので、大きなimgファイルの編集ができるかと。jessie-lite
C:>fc /b 2016-05-27-raspbian-jessie-lite.img.bak 2016-05-27-raspbian-jessie-lite.img
Comparing files 2016-05-27-raspbian-jessie-lite.img.bak and 2016-05-27-RASPBIAN-JESSIE-LITE.IMG
0CAAF044: 2F 23
0CAAF088: 2F 23
0CAC6000: 2F 23
```txt:jessie(追記)
C:\QEMU>fc /b 2016-05-27-raspbian-jessie.img.bak 2016-05-27-raspbian-jessie.img
Comparing files 2016-05-27-raspbian-jessie.img.bak and 2016-05-27-RASPBIAN-JESSIE.IMG
0CC07044: 2F 23
0CC07088: 2F 23
0CC2D000: 2F 23
- 2つのファイルで、`/usr/lib/arm-linux-gnueabihf/libarmmem.so`, `/dev/mmcblk0p1`, `/dev/mmcblk0p2`の行頭の`/(0x2F)`を`#(0x23)`に変更して、コメントアウト。これで、Kernel panicと、SD(mmcblk)をマウントを回避。
```shell-session
pi@raspberrypi:~ $ cat /etc/ld.so.preload
#usr/lib/arm-linux-gnueabihf/libarmmem.so
pi@raspberrypi:~ $ cat /etc/fstab
proc /proc proc defaults 0 0
#dev/mmcblk0p1 /boot vfat defaults 0 2
#dev/mmcblk0p2 / ext4 defaults,noatime 0 1
a swapfile is not a swap partition, no line here
use dphys-swapfile swap[on|off] for that
pi@raspberrypi:~ $
4. `kernel-qemu-4.4.12-jessie`とパッチ当てた`2016-05-27-raspbian-jessie-lite.img`をC:QEMUにコピー。
5. バッチファイル作成(`C:\QEMU\start.bat`)、起動
```bat:start.bat(jessie-lite向け)
qemu-system-arm.exe -net nic -net user,hostfwd=tcp::2222-:22 -M versatilepb -cpu arm1176 -kernel kernel-qemu-4.4.12-jessie -m 256 -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" -hda 2016-05-27-raspbian-jessie-lite.img
```bat:start_X.bat(jessie)
qemu-system-arm.exe -net nic -net user,hostfwd=tcp::2222-:22 -M versatilepb -cpu arm1176 -kernel kernel-qemu-4.4.12-jessie -m 256 -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" -hda 2016-05-27-raspbian-jessie.img
### スクショ: Jessie (X)

- 日本語は文字化け.. フォントを入れなければならない。

### スクショ: Jessie-lite




### localhost:2222へsshで、QEMUのRaspbianにログインできるよ



## その他
- ここまでやって、何ですが、遅いです。実機、使ったほうがいいと思います。