6
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[メモ] WindowsのQEMUで Raspbian起動(2016-05-27-raspbian-jessie*)

Last updated at Posted at 2016-07-18
  • 起動
    RPiQEMU09.png

  • ネットもいけるよ!(日本語は文字化けするので、英語のページ)
    RPiQEMU11.png

概要

環境

  • Windows 7 (64bit)
  • 2016-05-27-raspbian-jessie-lite.img (md5: 8b585a5b888e805e14f6c35f900ae939)
  • 2016-05-27-raspbian-jessie.img (md5: 0d50922374043ed5246df2b316eb7d25)

手順

  1. 上のところから、ダウンロード

  2. qemu-w64-setup-20160714.exeを右クリック、うまく解凍して、C:\QEMUに配置(C:\QEMU\qemu-system-arm.exe となるようにする)

  3. 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)
![RPiQEMU08.png](https://qiita-image-store.s3.amazonaws.com/0/75594/caac1e77-f4fa-66d4-3fdf-474fdadb9b82.png)

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

![RPiQEMU10.png](https://qiita-image-store.s3.amazonaws.com/0/75594/b268ac12-04f1-21a2-870b-db0a08253f2e.png)


### スクショ: Jessie-lite
![RPiQEMU04.png](https://qiita-image-store.s3.amazonaws.com/0/75594/160fb3e0-18d9-2b63-a421-369141b044c9.png)
![RPiQEMU01.png](https://qiita-image-store.s3.amazonaws.com/0/75594/80517abf-0280-bfc9-5e30-a1bfbb1cf972.png)

![RPiQEMU02.png](https://qiita-image-store.s3.amazonaws.com/0/75594/369a8aba-bf53-7a8d-858b-e6f424560773.png)


![RPiQEMU03.png](https://qiita-image-store.s3.amazonaws.com/0/75594/5870db20-e7fc-de88-5347-6a0038a771f7.png)






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

![RPiQEMU05.png](https://qiita-image-store.s3.amazonaws.com/0/75594/f5805cb7-abfd-c3a4-4e95-6e2b0479f11e.png)

![RPiQEMU06.png](https://qiita-image-store.s3.amazonaws.com/0/75594/bbd61ba3-c0da-afea-5af1-54ca5cceb2ce.png)

![RPiQEMU07.png](https://qiita-image-store.s3.amazonaws.com/0/75594/e6ee9e22-de17-536f-33e0-fd1e57999e23.png)


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

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?