仮想RaspberryPi 64bitとローカルRaspberryPiの相互運用テスト(作業中)
1.やりたいこと
RaspberryPi3B+にRaspbian Busterを入れて、外部のリポジトリと接続する。
2.なぜ?
直前のエントリーでAWSに仮想RaspberryPi4用の環境を作成した。
Debian Buster armhf のOSイメージをAWSの仮想マシンで作る
クラウドやリモートリポジトリ経由でローカルにコピーして、実環境で動くことを確認したい。
3.RaspberryPi3B+のヘッドレスセットアップ
RaspberryPi4は未だ技適が通らないのか、日本では発売されていない。
3B+とBusterの環境にして実行する。
本家は重いのでミラーからダウンロードする。
http://ftp.jaist.ac.jp/pub/raspberrypi/raspbian/images/
balenaEtcherでSDを書き込んで、ヘッドレスでセットアップします。
SDカードのbootパーティションに以下のファイルを作成。
country=JP
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="SSID名"
psk="暗号キー"
}
空のsshファイルを作って保存。
RaspberryPiにSDカードを入れて再起動。
ssh [email protected]
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: POSSIBLE DNS SPOOFING DETECTED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The ECDSA host key for raspberrypi.local has changed,
and the key for the corresponding IP address fe80::6740:35ec:8c5e:526c%en3
is unknown. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.
再セットアップでホストキーが変更されたときに出るやつですね。
ssh-keygen -R raspberrypi.local
ssh [email protected]
で、復活して接続。
デフォルトのパスワードですので、raspberryで接続できます。
4.Dockerインストールとテスト
$ sudo apt-get update
$ curl -sSL https://get.docker.com | sh
$ sudo usermod -aG docker pi
$ docker -v
Docker version 19.03.1, build 74b1e89
$ sudo apt-get update
$ curl -sSL https://get.docker.com | sh
$ sudo usermod -aG docker pi
$ docker -v
Docker version 19.03.1, build 74b1e89
Docker 19.03が入りました。
Docker Hub上のリポジトリに接続するため、ログイン設定します。
$ docker login
Username:_username_
Passwork:_password_
5.OpenCVのDockerイメージを仮想マシンでBuildする
いつも手こずるOpenCVをDockerでインストールすることにします。
こちらを参考にしました。
ラズパイ向けのOpenCVを、x86_64機のDockerでビルド
(Dockerでやってしまうと、仮想マシンまで作った意味はないのですが、Dockerのテストということで)
$qemu-system-arm -M virt -m 4096 -smp 4 \
-kernel vmlinuz-4.19.0-5-armmp-lpae \
-initrd initrd.img-4.19.0-5-armmp-lpae \
-append 'root=/dev/vda2' \
-drive if=none,file=hda.qcow2,format=qcow2,id=hd \
-device virtio-blk-device,drive=hd \
-netdev user,id=mynet \
-device virtio-net-device,netdev=mynet \
-nographic
$ sudo apt-get update
$ sudo apt-get curl
$ curl -sSL https://get.docker.com | sh
$ sudo usermod -aG docker pi
$ docker -v
$ sudo apt-get install git
$ exit
一度抜けてログインし直し。
Dockerfileをそのままbuildしてみます。
$ git clone https://github.com/mt08xx/opencv-rpi-buildenv-docker
$ cd opencv-rpi-buildenv-docker/
$ docker build . -t mt08/opencv-rpi-buildenv
作業中。
https://qiita.com/mt08/items/51a2187076ddca0db7b0
何か重大な手違いがありそう。
中断して作業中。
ubuntu18仮想マシンで実行してみる
Docker19が入っているマシンがあったので、そこで同様のコマンドを実行してみました。
$ git clone https://github.com/mt08xx/opencv-rpi-buildenv-docker
$ cd opencv-rpi-buildenv-docker/
$ docker build . -t mt08/opencv-rpi-buildenv
Sending build context to Docker daemon 74.24kB
Step 1/2 : FROM resin/rpi-raspbian:buster
buster: Pulling from resin/rpi-raspbian
3d8ce33ab37f: Pull complete
828760d871d6: Pull complete
b290b33db697: Pull complete
fba0d77b4f00: Pull complete
9f4efec7c2c2: Pull complete
4a291ed3bea6: Pull complete
83914dc3ce7f: Pull complete
8a47a86bb40e: Pull complete
1251d57a90b8: Pull complete
0e69c6d495df: Pull complete
aaf87287f5f3: Pull complete
93536d0930f5: Pull complete
Digest: sha256:75a902c9eae972028d7163248934de915a82100152f197a014cbf2fb0981290c
Status: Downloaded newer image for resin/rpi-raspbian:buster
# Executing 1 build trigger
---> Running in a8c03d43a75f
standard_init_linux.go:211: exec user process caused "exec format error"
The command '/bin/sh -c cat /.resin/deprecation-warning' returned a non-zero code: 1
ラズパイのイメージが動かない?
docker run --name rpi-raspbian-stretch -ti --privileged resin/rpi-raspbian:stretch /bin/bash
これも同様のエラーが出ますね。
ラズパイのイメージを持ってきてるのがまずいようです。
debianで作れば問題ないので、自分でdocker fileを書いてみます。
FROM debian:buster
だけのものを作って試してみます。
Author And Source
この問題について(仮想RaspberryPi 64bitとローカルRaspberryPiの相互運用テスト(作業中)), 我々は、より多くの情報をここで見つけました https://qiita.com/t_kumazawa/items/5f3e6042475fda2d9a0b著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .