2017年5月31日水曜日

RPi_0022 USBシリアル接続

正常に立ち上がらないとか、期待したプロセスが起動していないとかの調査には、ブートメッセージが見たい。HDMIの表示でもよいが画面が流れてしまう。シリアル接続端末さえあれば、起動時メッセージ表示や、コンソールログインがTVモニタがない場所でもお手軽に操作できる。シリアル接続でログ記録できたりも可能だ。

Amazonで、「商品名:Raspberry Pi ラズベリーパイ用の USB-TTLシリアルコンソールのUSB変換COMケーブルモジュールのケーブル」を購入した。

Amazonプライムの表示あるところから、2個購入。ひとつ385円。だったが、価格が低い商品が出品されています。新品の出品:¥181より、とさらに安いものもあった。
お届けが翌日になってて、そんなに早くこないよねと思いきや、ゆうパケットの翌日ワイドで翌日ちゃんと届いた。


Raspberry Pi3の差し込んだピン位置。外側13ピンラインの右から、2つ空けて、黒白緑の順にピンを挿した。(黒6pin:GND, 白8pin:TX, 緑10pin:RX)赤VCC[5V]は使わない。

(1)Raspberry Pi3の設定変更内容
root@rapi3:/boot# diff cmdline.txt.org cmdline.txt
1c1
< dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=cedef3be-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
---
> dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=cedef3be-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
# cmdline.txt 1行目rootwaitの後ろを削除

root@rapi3:/boot# diff config.txt.org config.txt
56a57,60
>
> ## http://akkagi.info/20161004_web/ (参照Webページ)
> dtoverlay=pi3-miniuart-bt
>
# config.txt 最後の行にpi3-miniuart-btを追加

(2)現時点のrebootコンソールメッセージ例
# メッセージ全文は Rapi3_reboot_Message.txt を参照のこと。
# 2017-04-10-raspbian-jessie.zip版
root@rapi3:/boot# reboot
[  OK  ] Started Show Plymouth Reboot Screen.
[  OK  ] Removed slice user-1000.slice.
         Stopping Permit User Sessions...
         Stopping Login Service...
[  OK  ] Stopped Login Service.
[  OK  ] Stopped Permit User Sessions.
[  OK  ] Stopped target Network.
         Stopping dhcpcd on all interfaces...

#(たち下げ 省略)

[  OK  ] Stopped Create Static Device Nodes in /dev.
         Stopping Remount Root and Kernel File Systems...
[  OK  ] Stopped Remount Root and Kernel File Systems.
[  OK  ] Reached target Shutdown.
[  146.546572] watchdog watchdog0: watchdog did not stop!
[  146.842584] reboot: Restarting system

#(ここで再起動)

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 4.4.50-v7+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611) ) #970 SMP Mon Feb 20 19:18:29 GMT 2017
[    0.000000] CPU: ARMv7 Processor [410fd034] revision 4 (ARMv7), cr=10c5383d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine model: Raspberry Pi 3 Model B Rev 1.2
[    0.000000] cma: Reserved 8 MiB at 0x3a800000
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] [bcm2709_smp_init_cpus] enter (9520->f3003010)
[    0.000000] [bcm2709_smp_init_cpus] ncores=4
[    0.000000] PERCPU: Embedded 13 pages/cpu @b9f62000 s22592 r8192 d22464 u53248
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 239540
[    0.000000] Kernel command line: 8250.nr_uarts=1 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708_fb.fbswap=1 dma.dmachans=0x7f35 bcm2709.boardrev=0xa32082 bcm2709.serial=0xecc73d96 bcm2709.uart_clock=48000000 smsc95xx.macaddr=B8:27:EB:C7:3D:96 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000  dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=PARTUUID=cedef3be-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
[    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Memory: 939064K/966656K available (6357K kernel code, 432K rwdata, 1716K rodata, 476K init, 764K bss, 19400K reserved, 8192K cma-reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xbb800000 - 0xff800000   (1088 MB)
[    0.000000]     lowmem  : 0x80000000 - 0xbb000000   ( 944 MB)
[    0.000000]     modules : 0x7f000000 - 0x80000000   (  16 MB)
[    0.000000]       .text : 0x80008000 - 0x807ea73c   (8074 kB)
[    0.000000]       .init : 0x807eb000 - 0x80862000   ( 476 kB)
[    0.000000]       .data : 0x80862000 - 0x808ce350   ( 433 kB)
[    0.000000]        .bss : 0x808d1000 - 0x809901ec   ( 765 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000]  Build-time adjustment of leaf fanout to 32.
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000000] Architected cp15 timer(s) running at 19.20MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x46d987e47, max_idle_ns: 440795202767 ns
[    0.000009] sched_clock: 56 bits at 19MHz, resolution 52ns, wraps every 4398046511078ns
[    0.000026] Switching to timer-based delay loop, resolution 52ns
[    0.000289] Console: colour dummy device 80x30
[    0.001351] console [tty1] enabled
[    0.001402] Calibrating delay loop (skipped), value calculated using timer frequency.. 38.40 BogoMIPS (lpj=192000)
[    0.001471] pid_max: default: 32768 minimum: 301
[    0.001804] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.001847] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.002805] Disabling cpuset control group subsystem
[    0.002865] Initializing cgroup subsys io
[    0.002917] Initializing cgroup subsys memory
[    0.002983] Initializing cgroup subsys devices
[    0.003026] Initializing cgroup subsys freezer
[    0.003070] Initializing cgroup subsys net_cls
[    0.003141] CPU: Testing write buffer coherency: ok
[    0.003227] ftrace: allocating 21246 entries in 63 pages
[    0.051843] CPU0: update cpu_capacity 1024
[    0.051910] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.051943] [bcm2709_smp_prepare_cpus] enter

#(たち上げ 省略その1)

[    2.154465] console [ttyAMA0] enabled
[    2.160720] of_cfs_init
[    2.165326] of_cfs_init: OK
[    2.182922] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    2.195358] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[    2.212661] devtmpfs: mounted
[    2.218599] Freeing unused kernel memory: 476K (807eb000 - 80862000)
[    2.501294] random: systemd: uninitialized urandom read (16 bytes read, 71 bits of entropy available)
[    2.519201] systemd[1]: systemd 215 running in system mode. (+PAM +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ -SECCOMP -APPARMOR)
[    2.538021] systemd[1]: Detected architecture 'arm'.
[    2.664486] NET: Registered protocol family 10
[    2.673050] systemd[1]: Inserted module 'ipv6'
[    2.681886] systemd[1]: Set hostname to .
[    2.689294] random: systemd: uninitialized urandom read (16 bytes read, 71 bits of entropy available)
[    2.703853] systemd[1]: Initializing machine ID from random generator.
[    2.713430] systemd[1]: Installed transient /etc/machine-id file.
[    2.794797] uart-pl011 3f201000.uart: no DMA platform data

#(たち上げ 省略その2)

[    4.288162] systemd[1]: Starting Create Static Device Nodes in /dev...
[  OK  ] Started Load/Save Random Seed.
[  OK  ] Started Show Plymouth Boot Screen.
[  OK  ] Reached target Paths.
[  OK  ] Created slice system-systemd\x2drfkill.slice.
         Starting Load/Save RF Kill Switch Status of rfkill0...
[  OK  ] Started Load/Save RF Kill Switch Status of rfkill0.
[  OK  ] Created slice system-ifup.slice.
[    5.542455] systemd-fsck[210]: fsck.fat 3.0.27 (2014-11-12)
[    5.544082] systemd-fsck[210]: /dev/mmcblk0p1: 132 files, 41536/82644 clusters
[  OK  ] Started File System Check on /dev/disk/by-partuuid/cedef3be-01.
         Mounting /boot...
[  OK  ] Mounted /boot.
[  OK  ] Reached target Local File Systems.

#(たち上げ 省略その3)

[  OK  ] Started D-Bus System Message Bus.
[  OK  ] Started Avahi mDNS/DNS-SD Stack.
         Starting System Logging Service...
[  OK  ] Started Restore Sound Card State.
[  OK  ] Started dhcpcd on all interfaces.
[  OK  ] Started LSB: triggerhappy hotkey daemon.
[  OK  ] Started LSB: Autogenerate and use a swap file.
[FAILED] Failed to start LSB: Start VNC Server at boot time.
See 'systemctl status vncboot.service' for details.
[  OK  ] Reached target Network.
         Starting OpenBSD Secure Shell server...
[  OK  ] Started OpenBSD Secure Shell server.
         Starting /etc/rc.local Compatibility...
[  OK  ] Reached target Network is Online.
         Starting LSB: Start NTP daemon...
         Starting Permit User Sessions...
[  OK  ] Started Login Service.
[  OK  ] Started Permit User Sessions.
         Starting Light Display Manager...
[  OK  ] Started System Logging Service.
[  OK  ] Started /etc/rc.local Compatibility.
[  OK  ] Started LSB: Start NTP daemon.
         Starting Terminate Plymouth Boot Screen...
         Starting Hold until boot process finishes up...

Raspbian GNU/Linux 8 rapi3 ttyAMA0

rapi3 login: root
Password: 
Last login: Wed May 31 09:17:47 JST 2017 on ttyAMA0
Linux rapi3 4.4.50-v7+ #970 SMP Mon Feb 20 19:18:29 GMT 2017 armv7l

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@rapi3:~# date
Wed 31 May 09:19:30 JST 2017
root@rapi3:~# 



(3)起動に問題があるときは、[FAILED]が赤文字で出て分かりやすい。


% ls -l /dev/tty.usbserial
crw-rw-rw-  1 root  wheel   37,  22  5 31 14:55 /dev/tty.usbserial

% system_profiler SPUSBDataType \
    | awk '
      /Product ID:/{p=$3}
      /Vendor ID:/{v=$3}
      /Manufacturer:/{sub(/.*: /,""); m=$0}
      /Location ID:/{sub(/.*: /,""); printf("%s:%s %s (%s)\n", v, p, $0, m);}
    ' | grep 2303
0x067b:0x2303 0x14100000 / 30 (Prolific Technology Inc.)
%

このMacについて>システムレポート
▼ USB 3.0バス
  USB-Serial Controller
USB-Serial Controller:
  製品ID:  0x2303
  製造元ID:  0x067b  (Prolific Technology, Inc.)
  バージョン:  3.00
  速度:  最高12 Mb/秒
  製造元:  Prolific Technology Inc.
  場所ID:  0x14100000 / 30
  利用可能な電流(mA):  500
  必要な電流(mA):  100
  高負荷時消費電流(mA):  0

(4)macOS Sierra でこのシリアルUSBケーブルが認識されると、macOSでは上記ように見える。

チップメーカURL
http://prolificusa.com/portfolio/pl2303hx-rev-d-usb-to-serial-bridge-controller/

(5)シリアルポートからのメッセージは以下のスクリプト usb_kermit_raspi.sh で自動で記録されるようにしている。ツールは伝統的な kermit を Homebrew からインストールして使っている。
% cat /usr/local/bin/usb_kermit_raspi.sh
#!/bin/sh
set -x
YMDHM=`date '+%Y%m%d_%H%M'`
cat /Users/myname/.kermrc_raspi |\
  sed -e s/append_raspi/append_raspi_${YMDHM}/ > \
  /Users/myname/.kermrc_raspi_YMD
kermit -y /Users/myname/.kermrc_raspi_YMD

% cat /Users/myname/.kermrc_raspi
set line /dev/tty.usbserial
set speed 115200
SET CARRIER-WATCH OFF
log session /Users/myname/Usr/RaspberryPi/ConsLog/append_raspi
connect

% ls -l /usr/local/bin/kermit
... Feb  3  2015 /usr/local/bin/kermit -> ../Cellar/c-kermit/9.0.302/bin/kermit

% head -7 /Users/myname/Usr/RaspberryPi/ConsLog/append_raspi_20170531_0917

Raspbian GNU/Linux 8 rapi3 ttyAMA0

rapi3 login: root
Password:
Last login: Wed May 31 09:16:10 JST 2017 on ttyAMA0
Linux rapi3 4.4.50-v7+ #970 SMP Mon Feb 20 19:18:29 GMT 2017 armv7l

シェルスクリプトの usb_kermit_raspi.sh は、ワークファイルが2つあって不細工である。ヒアドキュメント(heredoc)でスクリプト一つで書きたかったが、動いていれば、まあいいかと、なかなか書き直せない。


(6)シリアルポート接続(windows編)
  別記事 RPi_0023 win10_PL2303_teraterm

(7)PL2303 Mac OS X Driver Download
このWebページ、
http://www.prolific.com.tw/US/ShowProduct.aspx?p_id=229&pcid=41
を開いて、
PL2303 Mac OS X Driver Download  

Download File: PL2303_MacOSX_1.6.1_20160309.zip
 Mac OS X Universal Binary Driver v1.6.0 (PKG file format)
  For Mac OS Sierra (version 10.12)
  For Mac OS X El Capitan (version 10.11)
  For Mac OS X Yosemite (version 10.10)
  For Mac OS X Mavericks (version 10.9)
  For PL2303 H/HX/HXD/EA/RA/SA/TA/TB chip versions
  For Prolific USB VID_067B&PID_2303 Only
 Includes Driver Installation Manual
この PL2303_MacOSX_1_6_1_20160309.zip を展開してインストールでドライバはOKとなった。
% ls -l PL2303_MacOSX_1_6_1_20160309.zip
7135649 Mar  9  2016 PL2303_MacOSX_1_6_1_20160309.zip
% shasum PL2303_MacOSX_1_6_1_20160309.zip
52c3031ab1fda0b6fe58bc09c856cb6232aed782  PL2303_MacOSX_1_6_1_20160309.zip



2017年5月29日月曜日

RPi_0021 SSHクライアント

Windows版のsshクライアントはたくさんある。

ちら見でよさそうに見えたのは、
[windows ssh クライアント]でググって。

http://qiita.com/murachi1208/items/d6e4ce7ba75f1625fe51
Windowsターミナルソフト + Rlogin が最高すぎる!!

ダウンロードページ
http://nanno.dip.jp/softlib/man/rlogin/
RLoginは、Windows上で動作するターミナルソフトです。
RLogin (2.22.3) 2017/05/29

ここから rlogin_x64.zipをダウンロードして、すべて展開のあとRLogin.exeを走らせる。

起動時の初期画面

ここで、新規(N)を選ぶ

Server Edit Entry
エントリー/コメント、Server Address、User Name、Password、と
Terminal(T)は、kterm-colorとした。[OK]を押す。


さらに、表示(V) >オプション設定>スクリーン>
●フォントサイズから一行あたりの文字数を決定
初期値16(7.68) から 25(12.00)と文字を大きくした。


ファイル>サーバーに接続で、エントリーrapi3で、リモートログインできた。
※画面のコマンド lptest 80 12 は80カラム12 で表示フォントイメージの確認のため。


2017年5月27日土曜日

RPi_0020 初期設定

Raspberry PiでのRaspbian Jessie の2017-04-10版の初期設定の内容。

microSD をセットし電源投入後の、最初に行った設定処理をメモする。

Raspbianにログインするには、以下の4つの方法があるようだ。
1. HDMIディスプレイ表示(ディスプレイやUSBキーボードを接続)
2. LANケーブル接続(FingアプリやdhcpdログからIPアドレスを知る)
3. シリアルコンソール(要シリアルケーブル)
4. Pi ZeroをUSB OTGスレーブモード(要USBケーブルで設定:dwc2,g_ether)

このうち1.は一般的なHDMIケーブルとKB/MOUSEさえあれば、準備できるので簡単。
PIXEL desktopだと画面の説明が増えるので、コマンドラインからの操作説明とする。

LAN接続も/boot/sshの空ファイルがあると、sshリモートログイン可能だが、有線LANの無いモデルや、ネットワーク越しにsshできなくなったときのために、初回は、HDMIディスプレイとキーボード入力で処理しよう。

使ったKB/MOUSEは、ELECOM TK-FDM063BK で、

RasPi側のUSBポートにマイクロレシーバユニットを取り付けるだけで認識された。
$ lsusb の表示は、ID 1a81:1004 Holtek Semiconductor, Inc.

(1) 日本語キーボードの設定

# raspi-config
4 Localisation Options > I3 Change Keyboard Layout >
|Keyboard mode: Generic 105-key (Intl) PC
|Keyboard layout: Japanese
|Key to function as AltGr: The default for the keyboard layout
|Compose key: No compose key
とした。

手動での設定直しは、たとえば[rasbian keyboard 設定]とかでググるとよい。

a. キーボードの再構成

# dpkg-reconfigure keyboard-configuration
# service keyboard-setup restart

b. /etc/default/keyboard を編集

英語キーボードのとき
 /etc/default/keyboard
 XKBMODEL="pc105"
 XKBLAYOUT="us"
日本語キーボードのとき
 /etc/default/keyboard
 XKBMODEL="jp106"
 XKBLAYOUT="jp"

(2) ロケール(locale)

まずは今のロケールを見る。
% /usr/bin/localectl # 現在の設定を表示
   System Locale: LANG=en_GB.UTF-8
       VC Keymap: n/a
      X11 Layout: jp
       X11 Model: pc105
% egrep -v '^$|^#' /etc/locale.gen
en_GB.UTF-8 UTF-8
raspi-configで変更設定するのが簡単だが、関連項目も記載する。
# raspi-config
4 Localisation Options > I1 Change Locale(Set up language and regional setting)
Configuring locales
[ ] en_GB.UTF-8 UTF-8 を外して、
[*] en_US ISO-8859-1 をチェック。
[*] ja_JP.UTF-8 UTF-8 をチェック。
Default locale for the system environment: en_US とする。
# egrep -v '^$|^#' /etc/locale.gen
en_US ISO-8859-1
ja_JP.UTF-8 UTF-8
あるいは、# dpkg-reconfigure locales

4 Localisation Options > I2 Change Timezone(Set up timezone to match your locale)
Configuring tzdata
Asia > Tokyo
あるいは、# dpkg-reconfigure tzdata

# cat /etc/timezone
Asia/Tokyo
# ls -l /etc/timezone /etc/localtime
-rw-r--r-- 1 root root 333 Jun 29 11:21 /etc/localtime
-rw-r--r-- 1 root root  11 Jun 29 11:21 /etc/timezone
# cmp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
#/usr/share/zoneinfo以下のファイルが、/etc/localtimeにリンクされる。

必要に応じて、
Archのwiki を参照して、ロケールを設定する。
https://wiki.archlinuxjp.org/index.php/ロケール
man 1 locale, man 5 locale, man 7 localeなども役立つ。
 1 だれもが実行できるユーザコマンド
 5 ファイルフォーマットの説明、例 /etc/passwd
 7 その他 例:マクロパッケージや取り決め的な文書
関連項目:$ whereis locale; whatis locale

(3) ホスト名を変える

/etc/hostnameをviやnanoで編集するかもしくは、
# echo myhostname > /etc/hostname でもよい。

この変更したホスト名で*.localでアドレス指定したければAvahiや、Windowsでは、Bonjourを調べると良い。

(4) 作業ユーザーの作成

このWebページの説明がよくまとまっている。
04 Raspberry Pi 初期セキュリティ設定等
http://wings2fly.jp/yaneura/raspberry-pi-first-security-setting/
を参照して、adduser設定操作例を示す。
root@rapiz:/home/pi# adduser myname
Adding user `myname' ...
Adding new group `myname' (1001) ...
Adding new user `myname' (1001) with group `myname' ...
Creating home directory `/home/myname' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for myname
Enter the new value, or press ENTER for the default
 Full Name []: MYNAME
 Room Number []:
 Work Phone []:
 Home Phone []:
 Other []:
Is the information correct? [Y/n] y
root@rapiz:/home/pi#

(5) ネットワークの設定

・無線LANは、以下のように設定した。
# cd /etc/wpa_supplicant
# cp -p wpa_supplicant.conf wpa_supplicant.conf.org
# wpa_passphrase SSID PASSWORD >> wpa_supplicant.conf
# cat wpa_supplicant.conf #確認
 # network={} を複数おくことが可能。

# ifdown wlan0 # wlan0インターフェイス DOWN
# ifup wlan0  # wlan0インターフェイス UP

# iwconfig wlan0 #SSID確認
# ifconfig wlan0 #IPアドレス確認

・有線LANで、固定アドレスを振りたいとき。
Debian(Raspbian)8 jessieでは、ネットワーク周りの設定は/etc/dhcpcd.confで行う。
従来の/etc/network/interfacesを編集してもdhcpcdにより上書きされるとのこと。

バージョン見方
% lsb_release -a ; cat /etc/debian_version /etc/issue

/etc/dhcpcd.confの初期状態は、
# egrep -v '^$|^#' /etc/dhcpcd.conf
hostname
clientid
persistent
option rapid_commit
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
option ntp_servers
require dhcp_server_identifier
slaac private
nohook lookup-hostname


2017年5月23日火曜日

RPi_0011 win32diskimager

RPi_0010 microSDの作成
(3-1)SDカードに書き込む(windows編)
  別記事 RPi_0011 win32diskimager
の記事で、以下はWindows10で操作した内容。
の記事にあたり、以下はWindows10で操作した内容。
 尚、書き込むイメージは(macOS編)はその2Raspbian Jessie Liteを使ったが、
 ここでは、その1のRaspbian Jessie with PIXEL desktop版を例としている。
 ファイル名 2017-04-10-raspbian-jessie.img サイズ4.0GB

・Win32 Disk Imagerの入手
http://sourceforge.jp/projects/sfnet_win32diskimager/ から、
https://ja.osdn.net/projects/sfnet_win32diskimager/ へ飛んだ。
最新ダウンロードファイル
readme-buildtools.txt (日付: 2017-03-14, サイズ: 592.00 B )
diskimager_de.qm (日付: 2017-03-09, サイズ: 12.79 KB)
Win32DiskImager-1.0.0-binary.zip (日付: 2017-03-08, サイズ: 16.19 MB)
Win32DiskImager-1.0.0-src.zip (日付: 2017-03-08, サイズ: 100.79 KB)
win32diskimager-1.0.0-install.exe (日付: 2017-03-08, サイズ: 11.99 MB)

ここで、Win32DiskImager-1.0.0-binary.zip をダウンロードした。
これを展開すると、

一番したのWin32DiskImager.exeをダブルクリックする。
ほんとうに実行していいかと聞かれる。ウィルス感染したら復旧できない方は、ここでいいえ。

自己責任ではいと、答えた方は以下の画面へ進む。

1.起動画面

(1) microSDをPCに挿すと、この例では、ファイルエクスプローラーにE:が出現して、8GB容量だとそれらしい7.39GBと表示される。これが、出力側Device [E:¥]となる。
(2) 入力ファイルのImage Fileは、2017-04-10-raspbian-jessie.imgを選択する。
(3) Writeボタンを押してmicroSDに書き込み手続き。


(4)実行最終確認。Confirm Target Device E:¥。出力がmicroSD Eドライブに間違いなければYesボタンで実行する。


(5)無事に書き込み成功すると、Write Successful.と出る。4GBの書き込みに、22分41秒かかった。正常な書き込みが行われているとファイルエクスプローラーにboot(E:)が出現する。
(6)本win32diskimagerを終了させて、microSDの安全に取り外すを行って、microSDを抜く。


2017年5月20日土曜日

RPi_0010 microSDの作成

Raspberry Pi3とケースと電源アダプタが到着したので、microSDの作成から開始する。

・購入品のメモ。価格はAmazonから購入時点。
1.Raspberry Pi 3 Model B V1.2 (日本製) 国内正規代理店品
 チップワンストップ 価格:¥5,222
2.Raspberry Pi 3 Model B ケース + ヒートシンク クリア
 KuGi 価格:¥829
3.Raspberry Pi 3 model B 専用電源 ACアダプタ 5.1V/2.5A
きばん本舗 価格:¥1,640

本家のraspberrypi.orgからRaspbianのmicroSDイメージファイルをダウンロードする。
https://www.raspberrypi.org/downloads/raspbian/

その1
|Raspbian Jessie with PIXEL
|RImage with PIXEL desktop based on Debian Jessie
|RVersion: April 2017
|RRelease date: 2017-04-10
|RKernel version: 4.4
|RSHA-1: 6d7b11bb3d64524203edf6c80c499456fb5fef53

その2
|Raspbian Jessie Lite
|RMinimal image based on Debian Jessie
|RVersion: April 2017
|RRelease date: 2017-04-10
|RKernel version: 4.4
|RSHA-1: c24a4c7dd1a5957f303193fee712d0d2c0c6372d

(1)ここではその2のRaspbian Jessie Liteをダウンロードする。

https://downloads.raspberrypi.org/raspbian_lite_latest
のページを開くと、
http://director.downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2017-04-10/2017-04-10-raspbian-jessie-lite.zip
が呼びだされる。

(2)macOSターミナルでのダウンロードファイルの確認と展開
% ls -l 2017-04-10-raspbian-jessie-lite.zip
 307785777  5 20 21:46 2017-04-10-raspbian-jessie-lite.zip
% ls -lh 2017-04-10-raspbian-jessie-lite.zip
      294M  5 20 21:46 2017-04-10-raspbian-jessie-lite.zip
% shasum 2017-04-10-raspbian-jessie-lite.zip   # sumチェック
c24a4c7dd1a5957f303193fee712d0d2c0c6372d  2017-04-10-raspbian-jessie-lite.zip
%
% unzip 2017-04-10-raspbian-jessie-lite.zip    # 展開
Archive:  2017-04-10-raspbian-jessie-lite.zip
  inflating: 2017-04-10-raspbian-jessie-lite.img
% ls -l 2017-04-10-raspbian-jessie-lite.img
  1297862656  4 10 18:58 2017-04-10-raspbian-jessie-lite.img
% ls -lh 2017-04-10-raspbian-jessie-lite.img    #約1.2GBの.imgが出来ている
               1.2G  4 10 18:58 2017-04-10-raspbian-jessie-lite.img

(3)SDカードに書き込む(macOS編)
# 書き込むmicroSDを取り付けると勝手にマウントされる。
# df -H
Filesystem      Size   Used  Avail   Mounted on
/dev/disk0s2    999G   635G   364G   /
devfs           201k   201k     0B   /dev
map -hosts        0B     0B     0B   /net
map auto_home     0B     0B     0B   /home
/dev/disk2s1     79M    21M    57M   /Volumes/Untitled

# Untitledボリュームをアンマウントする。
# diskutil unmountDisk /dev/disk2
Unmount of all volumes on disk2 was successful

# 出力ファイル側が、microSDの /dev/disk2 であること十分確認。
# time dd bs=1m if=2017-04-10-raspbian-jessie-lite.img of=/dev/disk2
1237+1 records in
1237+1 records out
1297862656 bytes transferred in 570.426499 secs (2275250 bytes/sec)
dd bs=1m if=2017-04-10-raspbian-jessie-lite.img of=/dev/disk2  0.00s user 6.94s system 1% cpu 9:31.66 total
# 1.3GBのファイルをmicroSDに書き込むのに9分30秒かかった。

# df -H
Filesystem      Size   Used  Avail   Mounted on
/dev/disk0s2    999G   635G   364G   /
devfs           201k   201k     0B   /dev
map -hosts        0B     0B     0B   /net
map auto_home     0B     0B     0B   /home
/dev/disk2s1     42M    21M    21M   /Volumes/boot
# macOSのオートマウントでmicroSDのRaspbian bootパーティションが勝手にマウントされる。
# bootのボリュームをアンマウントして、microSDを取り外す。
# diskutil unmountDisk /dev/disk2
Unmount of all volumes on disk2 was successful

# 念入りは人はさらに# df -H して /Volumes/boot がないことを確認してから、
# microSDを取り外すと良い。


(3-1)SDカードに書き込む(windows編)
  別記事 RPi_0011 win32diskimager

ここで出来たmicroSDをRaspberry Pi3の底にあるmicroSDスロットに挿す。