Quantcast
Channel: NKBMobile のメモ
Viewing all 42 articles
Browse latest View live

Android-004 root化(EM01L)

$
0
0

6.EMOBILE Nexus 5 (EM01L)編 [6/6]

GooglePlayの販売と同じMODEL LG-D821。
手持ちのEM01Lの履歴。
入手日2014年01月26日 ソフトウェアの番号:KOT49H Androidバージョン:4.4.2

(1)Google USB Driverのダウンロード
新型Nexus7(2013)のドライバインストール方法。
を見て、http://developer.android.com/sdk/win-usb.html から
latest_usb_driver_windows.zipをインストールする。

(2)Nexus5のブートローダーアンロック
Nexus5のブートローダーアンロック方法。
とても丁寧な解説でわかりやすい。

(3)カスタムリカバリ TWRPを導入
Nexus5にカスタムリカバリ TWRPを導入する方法。
とても丁寧な解説でわかりやすい。

(4)Nexus5のRoot化
Nexus5 Android4.4.1(KOT49E)のRoot化方法・手順
手持ちのEM01LはKOT49Hだったが、とくに問題はなくRoot化できた。 SuperSUは以下のバージョンを/sdcardに配置した。 MD5 (UPDATE-SuperSU-v1.91.zip) = f8ff8a15aea0fa196366d8bfb102d990 SuperSUを書き込むのと、バックアップのようす。

(5)番外コラム
rootを取るとTitaniumBackupで無効化と削除で不要アプリを整理できる。調子に乗ってどんどん消していくときで、Launcher系のアプリまでを無効にしてしまってHOME画面が立ち上がらないときには、以下のコマンドが役に立つかもしれない。

% adb shell
shell@hammerhead:/ $ am start -n com.keramidas.TitaniumBackup/.MainActivity
Starting: Intent { cmp=com.keramidas.TitaniumBackup/.MainActivity }
#実は、画面真っ黒になったことがあって、これでTitaniumを起動して回復することができました。(^^)



Android-005 root化(C6833)

$
0
0

7.XPERIA Z Ultra(C6833)編

[xperia z ultra c6833 root化]でググるといっぱい出てくる。
先人の有用な情報を掲載くださった方々に感謝します。
当方はAmazonで購入した。Amazon評価はおおむね良い。
手持ちのC6833の履歴。
入手日2014年7月19日 ビルド番号:14.2.A.1.136 Androidバージョン:4.3

(1)USB Driverのダウンロード
参照ページ:FlashTool Xperia Driver Pack!
を見て、FlashTool Xperia Drivers Pack v1.5-20140318 から
Flashtool-drivers-1.5-20140318.exeをインストールする。

MD5 (Flashtool-drivers-1.5-20140318.exe) = 50955f8198bf37025d40a7cdcee7978c
Setup>Select components to install: Flashmode DriversとFastboot DriversとXperia Z Ultra driversにチェックを入れてInstallをクリック。

(2)C6833のブートローダーアンロック
参照ページ:Xperia Z Ultra (C6833) ブートローダーアンロック
丁寧な解説でわかりやすい。アンロックキーを取得画面は現在変化しているが画面の指示に従えば良い。IMEIは15桁入力し、「Your unlock code:」の16桁を得る。
Volume upボタンを押してUSBケーブルをつないだときのデバイスマネージャ。
fastbootコマンドUNLOCK実行のようす。fastboot reboot後に初期化が始まる。

C:\Users\myname>fastboot.exe -i 0x0fce getvar version
version: 0.5
finished. total time: -0.000s
C:\Users\myname>fastboot.exe -i 0x0fce oem unlock 0x1234567890123456
...
OKAY [ 1.121s]
finished. total time: 1.121s
C:\Users\myname>
C:\Users\myname>fastboot reboot
rebooting...
finished. total time: 0.010s
C:\Users\myname>
アンロックに成功すると、Rooting status:Bootloader(unlock allowed:Yes)が(unlocked:Yes)になる。
この画面は、アプリQuickShortcutMaker (SIKA524) インストールして
インクリメンタル検索>キーワード絞込 [Service Menu]
com.sonyericsson.android.servicemenu のショートカットを作成。
そのショートカットから Service info>Configuration>Rooting status:にて。

(3)C6833のRoot化
参照ページ:Sony XPERIA Z Ultraを購入し、root化してみました
丁寧な解説でわかりやすい。当方は同様にビルド番号14.2.A.1.136だったのでこのWebページと同じくの作業を行った。
それぞれのMD5

MD5 (136.img) = c7ca5cc644c9991245d1eaa757e3f584
MD5 (supersu.zip) = 0b85474f0f139e1e6137f9eab40c3ecb
supersu.zip はSDCARD領域に転送しておく。

% adb push supersu.zip /sdcard/supersu.zip
そして136.imgをflashする。

C:\Users\myname>fastboot.exe flash boot 136.img
sending 'boot' (16800 KB)...
OKAY [ 0.690s]
writing 'boot'...
OKAY [ 1.111s]
finished. total time: 1.801s
C:\Users\myname>fastboot reboot
C:\Users\myname>
たったこれだけで、root化できてるか心配だったが、supersu.zipをあてて、再起動でOKだった。

SuperSUへのリクエスト。root化成功。
C6833本体電源ONで紫LED点灯したらVOLupでCWMリカバリでバックアップ。
おなじくVOLdownでTWRPリカバリでバックアップ。VOLup/downボタンは一回ポチッと押下操作するだけで反応した。
◯ root化でけっこううれしいのは、APN Managerだ。
/sdcard/ApnManager/ApnBackup.xmlを変更しRESTOREすればサクッとAPNの切替えができる。
・次はしばらく待ってKitKat4.4バージョンにしたい。


Android-006 root化(Nexus6)

$
0
0

8.Nexus6 (XT1100)編

Nexus Root Toolkit v2.0.4でroot化できそうなのでやってみた。
当方はNexus6発売初日にY!mobileで購入した。
手持ちのNexus6の履歴。
入手日2014年12月11日 ビルド番号:LRX210 Androidバージョン:5.0
更新日2014年12月19日 ビルド番号:LRX22C Androidバージョン:5.0.1(OTAにて)
いつものことでしどろもどろで間違っているかもしれないので参考程度とされたい。

(1)Nexus Root Toolkit(NRT)のダウンロード
参照ページ:Nexus Root Toolkit v2.0.4
から、NRT_v2.0.4.sfx.exeをダウンロードしてWin7機にをインストールした。

MD5 (NRT_v2.0.4.sfx.exe) = bf2b0e58f6499f2961f7552a56f57127
このNRT(v2.0.4)だけで、Nexus6のブートローダーアンロックとroot化できた。電源キー操作は(4-3)で押しただけで、NRTにおまかせでroot化まで処理が進んだ。

(2)Nexus Root Toolkit(NRT)のインストール
(2-1)NRT_v2.0.4.sfx.exeをクリックして、[Install]ボタンを押す。

(2-2)Nexus6(XT1100)とBuild:LRX22Cを選ぶ。

(2-3)[Download+Update All File Dependencies]ボタンを押す。
たぶん、
 modified_boot_shamu_5.0.1_LRX22C.img
 busybox-signed.zip
 UPDATE-SuperSU-v2.46.zip
 openrecovery-twrp-2.8.5.0-shamu.img
あたりがダウンロードされるのだろう。

(3)メインパネルの[Full Driver Installation Guide - Automatic + Manual]ボタンを押す。Step1からStep4までをこなす。

(3-1)Step1。

(3-2)Step2。

(3-3)Step3推奨は#1と出ているので、DriverSolution#1 [Google Drivers]を押した。

(3-4)Google Driversインストール完了

(3-5)Step4[Full Driver Test]を押すと、Success!と出た。

(4)メインパネルの[Unlock]ボタンを押す。

(4-1)BEFORE PROCEEDING: - Check 'Enable OEM Unlock'たぶん"OEMロック解除を有効にする"にチェックせよということだろう。

(4-2)いよいよアンロック Press'YES'で[はい]を押した。

(4-3)端末側でYes Unlock bootloaderする

(4-4)消去していますで5分くらいは待ったよう。

(4-5)なんだかアンロックはうまくいったみたい。初期化されているのでもう一度「設定>ビルド番号7回押しで」開発者向けオプションをだす。USBデバッグをチェック入れる。

(5)メインパネルの[Root]ボタンを押す。
ここではたぶんCustom RecoveryにチェックをいれてTWRPがつかえるようにしておくのが順当なんだろうが、あえてチェックしなかった。
fastboot boot openrecovery-twrp-2.8.5.0-shamu.img
とかすれば間に合うのであれば。

(5-1)Enjoy your rooted device ^_^がでた。

(6)NRT - Live Log このRoot化時の一連のログの記録。

Nexus Root Toolkit v2.0.4

Masterlists:
- LatestToolkitFiles.ini 3013
- AndroidDeviceListFull.ini 3013
- AndroidDeviceListFlash.ini 3013

SHAMU-SHAMU: Android 5.0.1 - Build: LRX22C

Live log initiated [2015-03-05]:

Information: Checking ADB Connectivity
adb devices
adb server is out of date. killing...
* daemon started successfully *
List of devices attached
MySerialNo device


Connectivity Status: ADB Device Connected
Information: Rebooting your device into bootloader mode...
adb reboot bootloader

Information: Checking Fastboot Connectivity
fastboot devices

Information: Retrying.. Checking Fastboot Connectivity
fastboot devices

Information: Checking Fastboot Connectivity
fastboot devices
MySerialNo fastboot

Connectivity Status: Fastboot Device Connected
Information: Rebooting your device...
Information: Waiting for your device...
Information: Device Detected
Information: Checking ADB/FASTBOOT Connectivity
adb devices
adb server is out of date. killing...
* daemon started successfully *
List of devices attached
MySerialNo device

fastboot devices

Connectivity Status: ADB Device Connected
Information: Rebooting your device into bootloader mode...
adb reboot bootloader

Information: Checking Fastboot Connectivity
fastboot devices
MySerialNo fastboot

Connectivity Status: Fastboot Device Connected
fastboot oem unlock

Information: Rebooting your device...
Information: Checking ADB/FASTBOOT Connectivity
adb devices
List of devices attached
MySerialNo device


fastboot devices

Connectivity Status: ADB Device Connected
Information: Rebooting your device into bootloader mode...
adb reboot bootloader

Information: Checking Fastboot Connectivity
fastboot devices
MySerialNo fastboot

Connectivity Status: Fastboot Device Connected
Information: Temporarily Booting modified boot.img to enable running privileged commands...
fastboot boot "C:\Program Files (x86)\WugFresh Development\Nexus Root Toolkit\data\Modified_Boot\modified_boot_shamu_5.0.1_LRX22C.img"

Information: Waiting for your device...
Information: Device Detected
Information: Pushing root files to your device...
adb push "C:\Program Files (x86)\WugFresh Development\Nexus Root Toolkit\data\Root_Files\busybox-signed.zip""/sdcard/!ReadyToFlash/Root_Files/busybox-signed.zip"
adb server is out of date. killing...
* daemon started successfully *

adb push "C:\Program Files (x86)\WugFresh Development\Nexus Root Toolkit\data\Root_Files\UPDATE-SuperSU-v2.46.zip""/sdcard/!ReadyToFlash/Root_Files/UPDATE-SuperSU-v2.46.zip"

adb push "C:\Program Files (x86)\WugFresh Development\Nexus Root Toolkit\data\Root_Files\openrecoveryscript""/cache/recovery/openrecoveryscript"

Information: Rebooting your device into bootloader mode...
adb reboot bootloader

Information: Checking Fastboot Connectivity
fastboot devices
MySerialNo fastboot

Connectivity Status: Fastboot Device Connected
Information: Temporarily Booting TWRP...
fastboot boot "C:\Program Files (x86)\WugFresh Development\Nexus Root Toolkit\data\Recovery_Custom\TWRP\openrecovery-twrp-2.8.5.0-shamu.img"

Information: Rooting...
Information: Waiting for your device...
Information: Device Detected

(7)Root化の確認。
ESファイルエクスプローラでRootエクスプローラがオンにできた。



Android-007 lollipop化(Nexus5)

$
0
0

9.Nexus5 (LG-D821)lollipop編

前項の Android-006 root化(Nexus6)に引き続いてNexus5をlollipop Androidバージョン:5.0.1 ビルド番号:LRX22Cにアップデートした。
これは以前の Android-004 root化(EM01L)からの更新だ。

(1)メインパネル確認
 [Change]ボタンで、Your model type:アップデート前の現バージョンNexus5(LG-D821)とBuild:KOT49Hを選ぶ。

(1-1)ドライバ動作確認
 [Full Driver Installation Guide - Automatic + Manual]ボタンでStep4[Full Driver Test]が成功しない。理由は不明だが、メディアデバイス(MTP)にチェックを入れると、Success!と出た。

(2)メインパネルの[Flash Stock+Unroot]ボタンを押す。
 ここで、純正Stock ROMをFlashする。

(2-1)Factory imageは、[Recommended Settings]ボタンで選ばれたものを使用した。
 Settins:の'Force Flash Mode'にチェックが入った。このチェックによりどのような動作になるかは不明のまま[OK]を押して進む。

(2-2)Factory imageがダウンロードされる。
 ファイル名はhammerhead-lrx22c-factory-0f9eda1b.tgzで、解凍と展開が行われる。

(2-3)DOS窓が開いた。
 'bootloader','radio','boot','cache','recovery','system','userdata'の領域がFlashされていく。

(2-4)Flash Stockの成功。
 HAMMERHEAD: Android 5.0.1 - Build:LRX22Cが書き込めたようだ。

(3)メインパネルの[Root]ボタンを押す。
 ここでこんどはCustom Recoveryにチェックをいれた。

(3-1)Enjoy your rooted device ^_^がでた。

(4)NRT - Live Log
 このFlash Stock時の一連のログの記録。

Nexus Root Toolkit v2.0.4

Masterlists:
- LatestToolkitFiles.ini 3013
- AndroidDeviceListFull.ini 3013
- AndroidDeviceListFlash.ini 3013

HAMMERHEAD-HAMMERHEAD: Android 4.4.2 - Build: KOT49H

Live log initiated [2015-03-06]:

Information: Checking ADB Connectivity
adb devices
adb server is out of date. killing...
* daemon started successfully *
List of devices attached
MySerialNo device


Connectivity Status: ADB Device Connected
Information: Rebooting your device into bootloader mode...
adb reboot bootloader

Information: Checking Fastboot Connectivity
fastboot devices
MySerialNo fastboot

Connectivity Status: Fastboot Device Connected
Information: Rebooting your device...
Information: Waiting for your device...
Information: Device Detected
Information: Checking ADB/FASTBOOT Connectivity
adb devices
adb server is out of date. killing...
* daemon started successfully *
List of devices attached
MySerialNo device


fastboot devices

Connectivity Status: ADB Device Connected
Information: Rebooting your device into bootloader mode...
adb reboot bootloader

Information: Checking Fastboot Connectivity
fastboot devices
MySerialNo fastboot

Connectivity Status: Fastboot Device Connected
Launching flashstock.bat
Nexus Root Toolkit v2.0.4

Masterlists:
- LatestToolkitFiles.ini 3013
- AndroidDeviceListFull.ini 3013
- AndroidDeviceListFlash.ini 3013

HAMMERHEAD-HAMMERHEAD: Android 5.0.1 - Build: LRX22C

Live log initiated [2015-03-07]:

Information: Checking ADB/FASTBOOT Connectivity
adb devices

fastboot devices

Information: Checking ADB/FASTBOOT Connectivity
adb devices
List of devices attached
MySerialNo device


fastboot devices

Connectivity Status: ADB Device Connected
Information: Rebooting your device into bootloader mode...
adb reboot bootloader

Information: Checking Fastboot Connectivity
fastboot devices
MySerialNo fastboot

Connectivity Status: Fastboot Device Connected
Information: Temporarily Booting modified boot.img to enable running privileged commands...
fastboot boot "C:\Program Files (x86)\WugFresh Development\Nexus Root Toolkit\data\Modified_Boot\modified_boot_hammerhead_5.0.1_LRX22C.img"

Information: Waiting for your device...
Information: Device Detected
Information: Pushing root files to your device...
adb push "C:\Program Files (x86)\WugFresh Development\Nexus Root Toolkit\data\Root_Files\busybox-signed.zip""/sdcard/!ReadyToFlash/Root_Files/busybox-signed.zip"
adb server is out of date. killing...
* daemon started successfully *

adb push "C:\Program Files (x86)\WugFresh Development\Nexus Root Toolkit\data\Root_Files\UPDATE-SuperSU-v2.46.zip""/sdcard/!ReadyToFlash/Root_Files/UPDATE-SuperSU-v2.46.zip"

adb push "C:\Program Files (x86)\WugFresh Development\Nexus Root Toolkit\data\Root_Files\perm-recovery-signed.zip""/sdcard/!ReadyToFlash/Root_Files/"perm-recovery-signed.zip"

adb push "C:\Program Files (x86)\WugFresh Development\Nexus Root Toolkit\data\Root_Files\openrecoveryscript""/cache/recovery/openrecoveryscript"

Information: Rebooting your device into bootloader mode...
adb reboot bootloader

Information: Checking Fastboot Connectivity
fastboot devices
MySerialNo fastboot

Connectivity Status: Fastboot Device Connected
Information: Flashing Custom Recovery to RECOVERY partition...
fastboot flash recovery "C:\Program Files (x86)\WugFresh Development\Nexus Root Toolkit\data\Recovery_Custom\TWRP\openrecovery-twrp-2.8.5.2-hammerhead.img"

Information: Temporarily Booting TWRP...
fastboot boot "C:\Program Files (x86)\WugFresh Development\Nexus Root Toolkit\data\Recovery_Custom\TWRP\openrecovery-twrp-2.8.5.2-hammerhead.img"

Information: Rooting...
Information: Waiting for your device...
Information: Device Detected

(5)Root化の確認。



Android-008 lollipop化(Nexus7)

$
0
0

10.Nexus7 (2012 Model:ME370T)lollipop編

前出の Android-006 root化(Nexus6)と同様に、
に引き続いてNexus7 (2012版)をlollipop Androidバージョン:5.0.2 ビルド番号:LRX22Gにアップデートした。
これは以前の Nexus7-01 4.2.2(JDQ39)からの更新だ。

(1)メインパネル確認
[Change]ボタンで、Your model type:アップデート前の現バージョンNexus7(Wi-Fi Tablet)とAndroid:4.2.2 Build:JDQ39を選ぶ。

(1-1)ドライバ動作確認
[Full Driver Installation Guide - Automatic + Manual]ボタンでStep4[Full Driver Test]をSuccess!の動作確認する。

(2)メインパネルの[Flash Stock+Unroot]ボタンを押す。
Android:5.0.2 Build:LRX22Gを選ぶ。

(2-1)Factory imageは、'Force Flash Mode'でLRX22GのStock ROMをFlashする。

(2-1)Factory imageはすでにダウンロードされていた。ファイル名はnakashi-lrx22g-factory-2291c36b.tgzのはず。

(2-2)DOS窓が開いて、'bootloader','radio','boot','cache','recovery','system','userdata'の領域がFlashされていく。ところが、ここで、


sending 'bootloader' (2100 KB)...
OKAY [ 0.296s]
writing 'bootloader'...
FAILED (remote: (InvalidState))
finished. total time: 0.452s
rebooting into bootloader...
OKAY [ 0.016s]
finished. total time: 0.016s

bootloader書込みでエラー発生か。FAILEDが眼に留まって、だめかもとも思ったが影響は不明であるが不都合なく続行した。

(2-2)Flash Stockの成功したか。NAKASI-GROUPER: Android 5.0.2 - Build:LRX22Gが書き込めたように見える。

(3)メインパネルの[Root]ボタンを押す。
ここでこんどもCustom Recoveryにチェックをいれた。

(3-1)Enjoy your rooted device ^_^がでた。

(4)NRT - Live Log このFlash Stock時の一連のログの記録。

Information: Checking ADB/FASTBOOT Connectivity
adb devices
adb server is out of date. killing...
* daemon started successfully *
List of devices attached
MySerialNo device


fastboot devices

Connectivity Status: ADB Device Connected
Information: Rebooting your device into bootloader mode...
adb reboot bootloader

Information: Checking Fastboot Connectivity
fastboot devices
MySerialNo fastboot

Connectivity Status: Fastboot Device Connected
Launching flashstock.bat
Nexus Root Toolkit v2.0.4

Masterlists:
- LatestToolkitFiles.ini 3013
- AndroidDeviceListFull.ini 3013
- AndroidDeviceListFlash.ini 3013

NAKASI-GROUPER: Android 5.0.2 - Build: LRX22G

Live log initiated [2015-03-09]:

Information: Checking ADB Connectivity
adb devices
List of devices attached
MySerialNo device


Connectivity Status: ADB Device Connected
Information: Rebooting your device into bootloader mode...
adb reboot bootloader

Information: Checking Fastboot Connectivity
fastboot devices
MySerialNo fastboot

Connectivity Status: Fastboot Device Connected
Information: Rebooting your device...
Information: Waiting for your device...
Information: Device Detected
Information: Checking ADB/FASTBOOT Connectivity
adb devices
adb server is out of date. killing...
* daemon started successfully *
List of devices attached
MySerialNo device


fastboot devices

Connectivity Status: ADB Device Connected
Information: Rebooting your device into bootloader mode...
adb reboot bootloader

Information: Checking Fastboot Connectivity
fastboot devices
MySerialNo fastboot

Connectivity Status: Fastboot Device Connected
Launching flashstock.bat
Information: Checking ADB/FASTBOOT Connectivity
adb devices
List of devices attached
MySerialNo device


fastboot devices

Connectivity Status: ADB Device Connected
Information: Rebooting your device into bootloader mode...
adb reboot bootloader

Information: Checking Fastboot Connectivity
fastboot devices
MySerialNo fastboot

Connectivity Status: Fastboot Device Connected
Information: Temporarily Booting modified boot.img to enable running privileged commands...
fastboot boot "C:\Program Files (x86)\WugFresh Development\Nexus Root Toolkit\data\Modified_Boot\modified_boot_nakasi_5.0.2_LRX22G.img"

Information: Waiting for your device...
Information: Device Detected
Information: Pushing root files to your device...
adb push "C:\Program Files (x86)\WugFresh Development\Nexus Root Toolkit\data\Root_Files\busybox-signed.zip""/sdcard/!ReadyToFlash/Root_Files/busybox-signed.zip"
adb server is out of date. killing...
* daemon started successfully *

adb push "C:\Program Files (x86)\WugFresh Development\Nexus Root Toolkit\data\Root_Files\UPDATE-SuperSU-v2.46.zip""/sdcard/!ReadyToFlash/Root_Files/UPDATE-SuperSU-v2.46.zip"

adb push "C:\Program Files (x86)\WugFresh Development\Nexus Root Toolkit\data\Root_Files\perm-recovery-signed.zip""/sdcard/!ReadyToFlash/Root_Files/"perm-recovery-signed.zip"

adb push "C:\Program Files (x86)\WugFresh Development\Nexus Root Toolkit\data\Root_Files\openrecoveryscript""/cache/recovery/openrecoveryscript"

Information: Rebooting your device into bootloader mode...
adb reboot bootloader

Information: Checking Fastboot Connectivity
fastboot devices
MySerialNo fastboot

Connectivity Status: Fastboot Device Connected
Information: Flashing Custom Recovery to RECOVERY partition...
fastboot flash recovery "C:\Program Files (x86)\WugFresh Development\Nexus Root Toolkit\data\Recovery_Custom\TWRP\openrecovery-twrp-2.8.5.1-grouper.img"

Information: Temporarily Booting TWRP...
fastboot boot "C:\Program Files (x86)\WugFresh Development\Nexus Root Toolkit\data\Recovery_Custom\TWRP\openrecovery-twrp-2.8.5.1-grouper.img"

Information: Rooting...
Information: Waiting for your device...
Information: Device Detected

(5)Root化の確認。

(6)雑感。
NRTはボタンを押すだけで所望の更新動作をしてくれるので大変ありがたい。
ユーザデータも、Android-001 root化(ISW13HT) 0.事前準備・予備知識での、
% adb backup / adb restore でほとんど綺麗に退避/復元してくれた。
さらに、Nexus7は2012年9月の購入なのに、いまだにAndroid5.xにアップデートできるのには感心する。Nexus6ほどサクサクは動かなくとも実用十分でまだまだ現役で使えそうだ。



obsA7-009 Debian8 jessie

$
0
0
obsA7のDebian7 wheezy 再起動不可をきっかけに、Debian8 jessie に移行した時のメモです。

1.Debian7 wheezy 再起動不可

初回のDebian7 wheezyインストール (記事2013年12月16日 obsA7-001 購入SSD取付け起動) から、問題なく動いていたが、ある日のこと2016.8.11再起動するとread: ERRORとBad Data CRCで停止してしまった。

reading NAND page at offset 0x128c800 failed
62914560 bytes read: ERROR
## Booting image at 02000000 ...
Image Name: OBSA7 3.2.54-1
Created: 2014-11-26 1:15:22 UTC
Image Type: ARM Linux Multi-File Image (uncompressed)
Data Size: 47747335 Bytes = 45.5 MB
Load Address: 00008000
Entry Point: 00008000
Contents:
Image 0: 2583736 Bytes = 2.5 MB
Image 1: 45163587 Bytes = 43.1 MB
Verifying Checksum ... Bad Data CRC
openblocks>>

パッケージuboot-imageは1.2.13-2だけれど、これは以下のFAQから、
http://openblocks.plathome.co.jp/products/obs_a/a7/faq4.html#faq-517
FAQ.ファームウェアアップデートを実行したら起動しなくなりました。どうすれば復旧できますか。
A.TFTPサーバを利用したファームウェアのアップデートを行うことで復旧できます。

にて復活するようだったが、これを機会にDebian7 wheezyからDebian8 jessieにアップグレードし、kernelは3.2.54から4.1.19になる。さらにSSDも増量することにした。

2.準備物と参照したページと必要ファイル

2-1. OpenBlocks A7 リリース情報 http://openblocks.plathome.co.jp/support/software/a7/

2-1-1. OpenBlocks A7 7から8へのアップグレード
http://openblocks.plathome.co.jp/support/guide/a7/verup_to_8.html

2-1-2. Debian 8のファームウェアのダウンロード(2016-04-04版)
http://ftp.plathome.co.jp/pub/OBSA7/jessie/4.1.19-0/uImage.initrd.obsa7
ここのuImage.initrd.obsa7をTFTPサーバ側に置いて、obsA7のSW2 ON起動でobsA7復旧用となる。
このuImage.initrd.obsa7で不便がなければ以降のkernelビルド操作は不要。
obsa7_defconfig.txt:42:# CONFIG_BRIDGE is not set
この2016-04-04版のuImage.initrd.obsa7はBRIDGEが無効だったので、kernelビルドすることにした。

2.2. OpenBlocksファームウェア作成ガイド
https://github.com/plathome/debian_based_firmware
対応ファームウェア
機種 Debian TARGET DIST ARCH
A7 8 obsa7 jessie armel
にてobsa7はjessieに対応している。で、
# cd build_ramdisk
# ./buildall.sh -M obsa7 -D jessie
準備ブツが整っていれば、このbuildall.sh一発でuImage.initrd.obsa7ができそうだが、 ここplathomeガイドの丁寧な解説に補足してステップごとに確認しながら作業を進める。

2.3. 調達したSSD
Samsung SSD 850EVOシリーズ 250GB(ベーシックキット) MZ-75E250B/IT
SSDの選定が正しいか不明だが、コスパで選んだ。
https://www.google.co.jp/webhp?rls=ig&gws_rd=ssl#q=MZ-75E250B

3. 準備

3.1 作成ホスト
Macbook Pro(Early 2011)OSX El Capitan のParallels Desktop 11 for Macに、
ubuntu-ja-16.04-desktop-amd64.isoからUbuntuをインストールして母艦とした。
◯ubuntu 16.04 LTS 日本語 Remix リリース
https://www.ubuntulinux.jp/News/ubuntu1604-ja-remix
tsubota@macbp:Ubuntu16.04% ls -lh ubuntu-ja-16.04-desktop-amd64.iso
-rw-rw-r-- 1 tsubota wheel 1.3G 4 29 13:24 ubuntu-ja-16.04-desktop-amd64.iso
[ubuntu 16.04 parallels]でググるとデスクトップ画面が真っ黒になるのは、3Dアクセラレーション設定をオンにした状態でParallels Toolsを再インストールとありにて解決。

3.2. Gitリポジトリの取得
Ubuntu16.04# apt-get update
Ubuntu16.04# apt-get install git

Gitリポジトリを取得します。

Ubuntu16.04$ git clone git://github.com/plathome/debian_based_firmware.git
以下では、ディレクトリdebian_based_firmwareに移動したものとして説明。とあり、ここではパス${BASEDIR}/debian_based_firmwareとする。

3.3. クロス開発環境
ファームウェアの作成に必要なパッケージをインストール。
Ubuntu16.04# cd ${BASEDIR}/debian_based_firmware/build_ramdisk
Ubuntu16.04# ./build_crossenv.sh
問題なくbuild_crossenv.shは実行された。$ gcc --version|head -1で、
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.2) 5.4.0 20160609 がgccバージョン。

3.4. カーネルソース
3.4.1. カーネル取得
カーネルソースをぷらっとホームのFTPサイトからダウンロード。
Ubuntu16.04$ cd ${BASEDIR}/debian_based_firmware/source/obsa7
Ubuntu16.04:obsa7$ wget http://ftp.plathome.co.jp/pub/OBSA7/jessie/4.1.19-0/linux-4.1.19-obs-20160401.tar.xz
Ubuntu16.04:obsa7$ ls -l linux-4.1.19-obs-20160401.tar.xz
86704504 Apr 1 12:01 linux-4.1.19-obs-20160401.tar.xz

3.4.2. カーネル展開
Ubuntu16.04$ cd ${BASEDIR}/debian_based_firmware/source/obsa7
Ubuntu16.04:obsa7$ xz -dc linux-4.1.19-obs-20160401.tar.xz| tar xf -

3.5. DVDイメージ取得
Ubuntu16.04$ cd ${BASEDIR}/debian_based_firmware/isofiles
Ubuntu16.04:isofiles$ wget http://ftp.riken.jp/Linux/debian/debian-cd/current/armel/iso-dvd/debian-8.5.0-armel-DVD-1.iso
Ubuntu16.04:isofiles$ ls -l debian-8.5.0-armel-DVD-1.iso
4694073344 Jun 5 06:17 debian-8.5.0-armel-DVD-1.iso

4. ファームウェアを作成する。

Ubuntu16.04# cd ${BASEDIR}/debian_based_firmware/build_ramdisk
#### ./buildall.sh -M obsa7 -D jessie
buildall.shはステップごとに確認するのでこの一発スクリプトは実行せず5.へ。

5. カスタマイズはステップごとに

シェルスクリプトbuild_ramdisk/buildall.shを実行することは、DIST=jessie, TARGET=obsa7の場合、以下の通り実行することと同じ。
Ubuntu16.04# cd ${BASEDIR}/debian_based_firmware/build_ramdisk
Ubuntu16.04:build_ramdisk# DIST=jessie TARGET=obsa7 ./build_debootstrap.sh
Ubuntu16.04:build_ramdisk# DIST=jessie TARGET=obsa7 ./build_kernel.sh
Ubuntu16.04:build_ramdisk# DIST=jessie TARGET=obsa7 ./build_ramdisk.sh
Ubuntu16.04:build_ramdisk# DIST=jessie TARGET=obsa7 ./release_firmware.sh
(# export DIST=jessie TARGET=obsa7とするのもよい)

5.0.1 build_debootstrap.sh
Debian 基本システムをインストールdebootstrapを実行し、ディレクトリrootfs/jessie_obsa7以下にDebianを仮インストールする。
<Check_5.0.1>
→cd ${BASEDIR}/debian_based_firmware/rootfs/jessie_obsa7
にルート構成があるか?

5.0.2 build_kernel.sh
カーネルとカーネルモジュールのコンパイル。
<Check_5.0.2>
→cd ${BASEDIR}/debian_based_firmware/source/obsa7/linux-4.1.19
に以下のファイルが出来ているか?
Ubuntu16.04:linux-4.1.19# ls -l net/bridge/bridge.ko
-rw-r--r-- 1 root wheel 116300 8 25 13:58 net/bridge/bridge.ko
Ubuntu16.04:linux-4.1.19# ls -l arch/arm/boot/zImage
-rwxr-xr-x 1 root wheel 2899384 8 25 13:58 arch/arm/boot/zImage
Ubuntu16.04:linux-4.1.19# ls -l arch/arm/boot/dts/kirkwood-openblocks_a7.dtb
-rw-r--r-- 1 root wheel 11479 8 25 13:22 arch/arm/boot/dts/kirkwood-openblocks_a7.dtb
zImageとkirkwood-openblocks_a7.dtbをcatして、zImage.dtbになる。

5.0.3 build_ramdisk.sh
ディレクトリrootfs/jessie_obsa7以下に仮インストールしたDebianをOpenBlocks用に変更して、RAMディスクイメージを作成。
<Check_5.0.3>
→cd ${BASEDIR}/debian_based_firmware/rootfs
に以下のファイルが出来ているか?
Ubuntu16.04:rootfs# ls -l ramdisk-jessie.obsa7.img
-rw-r--r-- root wheel 188743680 Aug 25 14:04 ramdisk-jessie.obsa7.img

5.0.4 release_firmware.sh
ファームウェア一式を作成。
→cd ${BASEDIR}/debian_based_firmware/release/obsa7/jessie/4.1.19-0
に以下のファイルが出来ているか?
Ubuntu16.04:4.1.19-0# ls -l
-rw-r--r-- 1 root wheel 337 Aug 28 23:18 MD5.obsa7
-rw-r--r-- 1 root wheel 1237687 Aug 28 23:17 System.map
-rw-r--r-- 1 root wheel 8950032 Aug 28 23:17 kernel+modules-4.1.19-0.tar.xz
-rw-r--r-- 1 root wheel 59792790 Aug 28 23:17 kernel-image-4.1.19-0-obsa7.deb
-rw-r--r-- 1 root wheel 58335052 Aug 28 23:17 ramdisk-jessie.obsa7.img.gz
-rw-r--r-- 1 root wheel 61245992 Aug 28 23:17 uImage.initrd.obsa7
-rw-r--r-- 1 root wheel 2910863 Aug 28 23:17 zImage.dtb
ここで出来たuImage.initrd.obsa7をflashcfgする。

5.1. カーネル
5.1.1. コンフィグレーションの変更
cd ${BASEDIR}/debian_based_firmware/source/obsa7/linux-4.1.19/
の.configからビルド構成される。元ネタは、
Ubuntu16.04:linux-4.1.19# ls -l arch/arm/configs/obsa7_defconfig
-rw-r--r-- 1 root wheel 96194 3 31 17:09 arch/arm/configs/obsa7_defconfig

# cp -p arch/arm/configs/obsa7_defconfig .config
# make oldconfig
# make menuconfig ここで、CONFIG_BRIDGEを生かす。
# cp -p .config ../linux-4.1.19.dot.config
もしくは、
# DIST=jessie TARGET=obsa7 ./kernel_menuconfig.sh
オリジナルなobsa7_defconfigで5.0.2 build_kernel.shが通り、5.0.4 release_firmware.shで出来たuImage.initrd.obsa7をflashcfgして正しく起動確認したあと、CONFIG_BRIDGEを有効にした。
*menuconfigのBRIDGEモジュールへ変更位置
  Networking  --->
Networking options --->
<M> 802.1d Ethernet Bridging ←BRIDGEモジュールへ変更
いろいろいじったので正確さに欠けるがついでに以下のあたりが変わった。
% diff linux-4.1.19.dot.config_ORG linux-4.1.19.dot.config_3
633a634
> CONFIG_BRIDGE_NETFILTER=m
767a769
> # CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set
915a918,919
> # CONFIG_NF_TABLES_BRIDGE is not set
> # CONFIG_BRIDGE_NF_EBTABLES is not set
924c928,930
< # CONFIG_BRIDGE is not set
---
> CONFIG_STP=m
> CONFIG_BRIDGE=m
> CONFIG_BRIDGE_IGMP_SNOOPING=y
927a934
> CONFIG_LLC=m

5.9 気づいたことの変更点

正常に起動するものの /sbin/initからの/etc/init.d/rcSが起動するコンソールメッセージがttyS0に表示されなかった。以下のように/dev/consoleを作ると解消された。
<Update_5.0.1>
cd ${BASEDIR}/debian_based_firmware/rootfs/jessie_obsa7/dev

root@ubuntu1604:dev# mknod -m 600 console c 5 1
root@ubuntu1604:dev# ls -l console
crw------- 1 root root 5, 1 8月 28 22:37 console
この後、RAMディスクイメージを作成しなおす。
# DIST=jessie TARGET=obsa7 ./99_create_ramdisk.sh
さらに、ファームウェアを作成しなおす。
# DIST=jessie TARGET=obsa7 ./release_firmware.sh

6. ファームウェアの反映

uImage.initrd.obsa7をOBSA7に送って、flashcfgのあと再起動する。
root@obsa7:~# flashcfg -y -f uImage.initrd.obsa7
root@obsa7:~# reboot

再起動のコンソールメッセージを以下に示す。

Broadcast message from root@obsa7 (ttyS0) (Mon Aug 29 11:04:51 2016):

The system is going down for reboot NOW!
[ ok Sending processes the T[....] Stopping MTA: exim4_listener.
[ ok ] Stopping ISC DHCP server: dhcpd.
[ ok ] Stopping internet superserver: inetd.
[ ok ] Stopping monitoring init button daemon for openblocks: pshd.
[ ok ] Stopping LED control daemon for openblocks: runled.
[ ok ] Saving random seed...done.
[....] Stopping domain name service...: bind9waiting for pid 1753 to die
. ok
[ ok ] Asking all remaining processes to terminate...done.
[ ok ] All processes ended within 2 seconds...done.
[ ok ] Stopping enhanced syslogd: rsyslogd.
[info] Saving the system clock.
[info] Hardware Clock updated to Mon Aug 29 11:04:57 JST 2016.
[ ok ] Deconfiguring network interfaces...done.
[ ok ] Will now deactivate swap:.
[....] Will now unmount union filesystems ( /etc /bin /home /lib /sbin /usr /var[ ok t /opt /srv /media):.
[....] Will now unmount /.rw filesystem (/.rw):umount: /.rw (/dev/sda1) unmounted
. ok
[....] Will now unmount local filesystems:umount: /dsk/sda4 (/dev/sda4) unmounted
umount: /dsk/sda2 (/dev/sda2) unmounted
. ok
[info] Will now restart.
[42054.565904] reboot: Restarting system


U-Boot 1.1.4 (Feb 5 2014 - 12:38:30)
Plat'Home version: 1.2.13 A7 (Base: Marvell version: 3.5.9)

U-Boot code: 00600000 -> 0067FFF0 BSS: -> 006CF480

Soc: 88F6282 A1CPU running @ 600Mhz L2 running @ 300Mhz
SysClock = 300Mhz , TClock = 200Mhz

DRAM (DDR3) CAS Latency = 6 tRP = 5 tRAS = 15 tRCD=5
DRAM CS[0] base 0x00000000 size 256MB
DRAM CS[1] base 0x10000000 size 256MB
DRAM CS[2] base 0x20000000 size 256MB
DRAM CS[3] base 0x30000000 size 256MB
DRAM Total size 1GB 16bit width
Addresses 8M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (8M - 7M): Done
NAND:256 MB
POST: mac verify Eth0 PASSED Eth1 PASSED

CPU : Marvell Feroceon (Rev 1)

Streaming disabled
Write allocate disabled

Module 0 is RGMII

USB 0: host mode
USB 1: host mode
USB 2: host mode
USB 3: host mode
Net: egiga0, egiga1
Hit any key to stop autoboot: 0

Run Boot Selection Script

*** SW 1 IS OFF ***

*** SW 2 IS OFF ***

*** SW 3 IS OFF, Standard Boot ***

Bootargs: root=/dev/ram vmalloc=200M rootdelay=7 mtdparts=nand_mtd:0x1c0000@0x0(uboot)ro,0x2c0000@0x1c0000(env),0x160000@0x480000(test)ro,0x540000@0x5e0000(conf),0x3d40000@0xb20000(linux),0x9660000@0x4860000(user),0x2140000@0xdec0000(opt) ubi.mtd=4 console=ttyS0,115200

NAND read: device 0 offset 0xb20000, size 0x3c00000

Reading data from 0x471f800 -- 100% complete.
62914560 bytes read: OK
## Booting image at 02000000 ...
Image Name: OBSA7 4.1.19-0
Created: 2016-08-28 14:17:25 UTC
Image Type: ARM Linux Multi-File Image (uncompressed)
Data Size: 61245928 Bytes = 58.4 MB
Load Address: 00008000
Entry Point: 00008000
Contents:
Image 0: 2910863 Bytes = 2.8 MB
Image 1: 58335052 Bytes = 55.6 MB
Verifying Checksum ... OK
OK

Starting kernel ...

[ 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.1.19 (root@ubuntu1604) (gcc version 5.4.0 20160609 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.1) ) #2 PREEMPT Thu Aug 25 13:58:36 JST 2016
[ 0.000000] CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=0005397f
[ 0.000000] CPU: VIVT data cache, VIVT instruction cache
[ 0.000000] Machine model: Plat'Home OpenBlocksA7
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 260528
[ 0.000000] Kernel command line: root=/dev/ram vmalloc=200M rootdelay=7 mtdparts=nand_mtd:0x1c0000@0x0(uboot)ro,0x2c0000@0x1c0000(env),0x160000@0x480000(test)ro,0x540000@0x5e0000(conf),0x3d40000@0xb20000(linux),0x9660000@0x4860000(user),0x2140000@0xdec0000(opt) ubi.mtd=4 console=ttyS0,115200
[ 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: 976768K/1048576K available (4167K kernel code, 173K rwdata, 1128K rodata, 152K init, 98K bss, 71808K reserved, 0K cma-reserved, 221184K highmem)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
[ 0.000000] vmalloc : 0xf3000000 - 0xff000000 ( 192 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xf2800000 ( 808 MB)
[ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
[ 0.000000] modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
[ 0.000000] .text : 0xc0008000 - 0xc0533f18 (5296 kB)
[ 0.000000] .init : 0xc0534000 - 0xc055a000 ( 152 kB)
[ 0.000000] .data : 0xc055a000 - 0xc0585700 ( 174 kB)
[ 0.000000] .bss : 0xc0585700 - 0xc059df78 ( 99 kB)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] Preemptible hierarchical RCU implementation.
[ 0.000000] Additional per-CPU info printed with stalls.
[ 0.000000] NR_IRQS:16 nr_irqs:16 16

(省略)

[ 2.275993] Waiting 7 sec before mounting root device...
[ 2.281794] ata1.00: supports DRM functions and may not be fully accessible
[ 2.289408] ata1.00: configured for UDMA/133
[ 2.306690] scsi 0:0:0:0: Direct-Access ATA Samsung SSD 850 2B6Q PQ: 0 ANSI: 5
[ 2.316454] sd 0:0:0:0: [sda] 488397168 512-byte logical blocks: (250 GB/233 GiB)
[ 2.324641] sd 0:0:0:0: Attached scsi generic sg0 type 0
[ 2.331072] sd 0:0:0:0: [sda] Write Protect is off
[ 2.336689] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 2.347862] sda: sda1 sda2 sda3 sda4
[ 2.354801] sd 0:0:0:0: [sda] Attached SCSI disk
[ 2.506247] usb 1-1: new high-speed USB device number 2 using orion-ehci
[ 2.656778] usb 1-1: New USB device found, idVendor=0424, idProduct=2514
[ 2.663542] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 2.672070] hub 1-1:1.0: USB hub found
[ 2.676042] hub 1-1:1.0: 4 ports detected
[ 2.956242] usb 1-1.2: new high-speed USB device number 3 using orion-ehci
[ 3.104024] usb 1-1.2: New USB device found, idVendor=0411, idProduct=015d
[ 3.110997] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 3.118376] usb 1-1.2: Product: 802.11 n WLAN
[ 3.122773] usb 1-1.2: Manufacturer: Ralink
[ 3.127008] usb 1-1.2: SerialNumber: 1.0
[ 9.296368] RAMDISK: gzip image found at block 0
[ 20.045354] EXT4-fs (ram0): couldn't mount as ext3 due to feature incompatibilities
[ 20.053454] EXT4-fs (ram0): mounting ext2 file system using the ext4 subsystem
[ 20.062703] EXT4-fs (ram0): mounted filesystem without journal. Opts: (null)
[ 20.070100] VFS: Mounted root (ext2 filesystem) readonly on device 1:0.
[ 20.077605] Freeing unused kernel memory: 152K (c0534000 - c055a000)
Mount failed for selinuxfs on /sys/fs/selinux: No such file or directory
INIT: version 2.88 booting
[....] Starting the hotplug events dispatcher: udevd[ 20.833029] systemd-udevd[654]: starting version 215
[ 20.852631] random: udevd urandom read with 31 bits of entropy available
. ok
[....] Synthesizing the initial hotplug events...[ 21.336776] orion_wdt: Initial timeout 21 sec
[ 21.562971] cfg80211: Calling CRDA to update world regulatory domain
done.
[....] Waiting for /dev to be fully populated...[ 21.986330] usb 1-1.2: reset high-speed USB device number 3 using orion-ehci
[ 22.169046] ieee80211 phy0: rt2x00_set_rt: Info - RT chipset 3070, rev 0201 detected
[ 22.250825] ieee80211 phy0: rt2x00_set_rf: Info - RF chipset 0005 detected
[ 22.362382] usbcore: registered new interface driver rt2800usb
done.
[ 24.266767] EXT4-fs (ram0): re-mounted. Opts: (null)
[ 24.766317] cfg80211: Calling CRDA to update world regulatory domain
fsck from util-linux 2.25.2
DEBIAN: clean, 95279/1313760 files, 723360/5245214 blocks
dumpe2fs 1.42.12 (29-Aug-2014)
[ 25.451062] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
[ 25.538766] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
[ 25.592866] EXT4-fs (sda1): re-mounted. Opts: discard
[ 25.653320] aufs test_add:283:mount[893]: uid/gid/perm /etc 0/0/0775, 0/0/0755
[ 26.057151] aufs test_add:283:mount[921]: uid/gid/perm /root 0/0/0700, 0/0/0755
[....] Starting the hotplug events dispatcher: udevd[ 26.573598] systemd-udevd[955]: starting version 215
. ok
[ ok ] Synthesizing the initial hotplug events...done.
[....] Waiting for /dev to be fully populated...[ 27.946330] cfg80211: Calling CRDA to update world regulatory domain
done.
Extract optional files from FlashROM(mtd6)... [ 31.106499] cfg80211: Calling CRDA to update world regulatory domain
fail(or empty).
[ ok ] Setting hostname to 'obsa7'...done.
[ ok ] Will now activate lvm and md swap:done.
[info] Will now check all file systems.
fsck from util-linux 2.25.2
Checking all file systems.
[....] Done checking file systems. A log is being saved in /var/log/fsck/checkfs[ ok hat location is writable..
[ ok ] Cleaning up temporary files...[....] Cleaning /tmp...done.
[ ok .
[info] Loading kernel module ipv6.
[ 32.701231] NET: Registered protocol family 10
[ 32.826989] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
[ 34.326253] cfg80211: Calling CRDA to update world regulatory domain
[ 35.967705] mv643xx_eth_port mv643xx_eth_port.1 eth1: link up, 1000 Mb/s, full duplex, flow control disabled
[ 35.977659] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
[ 37.506275] cfg80211: Calling CRDA to update world regulatory domain
[ 37.987206] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
[ ok ] Will now mount local filesystems:.
[ ok ] Will now activate swapfile swap:done.
[ ok ] Checking minimum space in /tmp...done.
[ ok ] Cleaning up temporary files....
[ ok ] Setting kernel variables ...done.
[ ok ] Initializing random number generator...done.
[ ok ] Configuring network interfaces...done.
[ ok ] Cleaning up temporary files....
INIT: Entering runlevel: 2
[ ok ] Starting enhanced syslogd: rsyslogd.
[ ok ] Starting domain name service...: bind9.
[ ok ] Starting internet superserver: inetd.
[ ok ] Starting monitoring init button daemon for openblocks: pshd.
[ ok ] Starting LED control daemon for openblocks: runled.
[ ok ] Starting OpenBSD Secure Shell server: sshd.
[ ok ] Starting periodic command scheduler: cron.
[ ok ] Starting MTA: exim4.
[....] Running local boot scripts (/etc/rc.local)/etc/init.d/bridge.sh start

Debian GNU/Linux 8 obsa7 ttyS0

obsa7 login: root
Password:
Last login: Sun Aug 28 23:26:19 JST 2016 on ttyS0
Linux obsa7 4.1.19 #2 PREEMPT Thu Aug 25 13:58:36 JST 2016 armv5tel

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@obsa7:~# date
Mon Aug 29 11:08:04 JST 2016
root@obsa7:~# uname -a
Linux obsa7 4.1.19 #2 PREEMPT Thu Aug 25 13:58:36 JST 2016 armv5tel GNU/Linux
root@obsa7:~# cat /etc/issue
Debian GNU/Linux 8 \n \l

root@obsa7:~# cat /etc/os-release|head -1
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
root@obsa7:~#

root@obsa7:~# df -H [995] (16-08-29 Mon 11:15:58 AM)
Filesystem Size Used Avail Use% Mounted on
/dev/root 183M 153M 22M 88% /
tmpfs 106M 189k 106M 1% /run
tmpfs 5.3M 0 5.3M 0% /run/lock
devtmpfs 11M 0 11M 0% /dev
tmpfs 212M 0 212M 0% /run/shm
/dev/sda1 22G 2.5G 18G 13% /.rw
aufs 22G 2.5G 18G 13% /etc
aufs 22G 2.5G 18G 13% /bin
aufs 22G 2.5G 18G 13% /home
aufs 22G 2.5G 18G 13% /lib
aufs 22G 2.5G 18G 13% /sbin
aufs 22G 2.5G 18G 13% /usr
aufs 22G 2.5G 18G 13% /var
aufs 22G 2.5G 18G 13% /root
aufs 22G 2.5G 18G 13% /opt
aufs 22G 2.5G 18G 13% /srv
aufs 22G 2.5G 18G 13% /media
/dev/sda2 32G 9.3G 21G 31% /dsk/sda2
/dev/sda4 189G 5.7G 174G 4% /dsk/sda4
root@obsa7:~# [996] (16-08-29 Mon 11:17:13 AM)
root@obsa7:~# brctl show [1001] (16-08-30 Tue 18:24:24 PM)
bridge name bridge id STP enabled interfaces
br0 8000.000a85090174 no eth0
wlan0
安定版(stable)ディストリビューションのDebian8 jessieに無事アップデート出来た。このobsA7はさらに長生きし活躍するだろう。
この移行中にobs600が代行稼働していた。こちらも今はDebian7 wheezyなので、jessieに移行したい。


HTL21-20140212_LOG-run_me_Manual_LOG.txt

$
0
0
以下のテキストLogは、この記事
2014/02/19 2015/06/29 Android-002 root化(HTL21,HTL22)
http://nkbmobile.blogspot.com/2014/02/android-002-roothtl21htl22.html
で、
fastboot flash zip rom.zipあたりで止まっているのだろうと予想した。
C:\Users\myuser>adb shell
|<途中省略>
|<途中省略>
finished. total time: 0.031s 再起動で、ソフトウェアの番号:1.15.970.1 にバージョンダウンされていた。
文中の途中省略をせずLogのすべてを次に示す。



<12218 Feb 12  2014 run_me_Manual_LOG.txt>

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\kana>usebackq
'usebackq'は、内部コマンドまたは外部コマンド、
操作可能なプログラムまたはバッチ ファイルとして認識されていません。

C:\Users\kana>adb shell
shell@android:/ $ cd /data/local/tmp
cd /data/local/tmp
shell@android:/data/local/tmp $ dir
dir
/system/bin/sh: dir: not found
127|shell@android:/data/local/tmp $ ls
ls
device.db
run_root_shell
shell@android:/data/local/tmp $ ls -l
ls -l
-rwxr-xr-x shell    shell       55296 2014-01-22 18:33 device.db
-rwxr-xr-x shell    shell      396588 2014-01-22 18:47 run_root_shell
shell@android:/data/local/tmp $ ls -l /sdcard/mmc*
ls -l /sdcard/mmc*
-rwSrwSr-T root     sdcard_rw  1047040 2014-02-06 17:32 mmcblk0p21_misc_backup
-rw-rw-r-- root     sdcard_rw  1047040 2014-02-06 17:31 mmcblk0p21_misc_fake
shell@android:/data/local/tmp $ ./run_root_shell
./run_root_shell


Device detected: HTL21 (JRO03C)

Attempt acdb exploit...
failed to open /dev/msm_acdb due to Permission denied.

Attempt fj_hdcp exploit...

Attempt msm_cameraconfig exploit...
Detected kernel physical address at 0x80608000 form iomem

Attempt put_user exploit...
shell@android:/data/local/tmp # cmp
cmp
Usage: cmp [-b] [-l] [-n count] file1 file2
1|shell@android:/data/local/tmp # cmp -l /dev/block/mmcblk0p21 /sdcard/mmcblk0p2
1_misc_backup
lk0p21 /sdcard/mmcblk0p21_misc_backup                                         <
/dev/block/mmcblk0p21 /sdcard/mmcblk0p21_misc_backup differ byte 162
/dev/block/mmcblk0p21 /sdcard/mmcblk0p21_misc_backup differ byte 163
/dev/block/mmcblk0p21 /sdcard/mmcblk0p21_misc_backup differ byte 165
/dev/block/mmcblk0p21 /sdcard/mmcblk0p21_misc_backup differ byte 166
/dev/block/mmcblk0p21 /sdcard/mmcblk0p21_misc_backup differ byte 169
1|shell@android:/data/local/tmp # cmp -l /dev/block/mmcblk0p21 /sdcard/mmcblk0p2
1_misc_fake
lk0p21 /sdcard/mmcblk0p21_misc_fake                                           <
shell@android:/data/local/tmp #
C:\Users\kana>


(bootloader) [RUU]WP,hboot,0
(bootloader) [RUU]WP,hboot,99
(bootloader) [RUU]WP,hboot,100
(bootloader) ...... Successful
FAILED (remote: 90 hboot pre-update! please flush image again immediately)
finished. total time: 10.452s

C:\Usr\Android\HTC_site\C_HTL21\downgrad_tool>fastboot flash zip rom.zip
sending 'zip' (821718 KB)...
OKAY [ 43.181s]
writing 'zip'...
(bootloader) adopting the signature contained in this image...
(bootloader) signature checking...
(bootloader) rom parsing start ...
(bootloader) rom parsing finish ...
(bootloader) zip header checking...
(bootloader) zip info parsing...
(bootloader) checking model ID...
(bootloader) checking custom ID...
(bootloader) checking main version...
(bootloader) checking hboot version...
(bootloader) start image[sbl3] unzipping & flushing...
(bootloader) [RUU]UZ,sbl3,0
(bootloader) [RUU]UZ,sbl3,100
(bootloader) signature checking...
(bootloader) ...... Successful
(bootloader) start image[boot] unzipping & flushing...
(bootloader) [RUU]UZ,boot,0
(bootloader) [RUU]UZ,boot,14
(bootloader) [RUU]UZ,boot,27
(bootloader) [RUU]UZ,boot,37
(bootloader) [RUU]UZ,boot,48
(bootloader) [RUU]UZ,boot,60
(bootloader) [RUU]UZ,boot,73
(bootloader) [RUU]UZ,boot,83
(bootloader) [RUU]UZ,boot,94
(bootloader) [RUU]UZ,boot,100
(bootloader) [RUU]WP,boot,0
(bootloader) [RUU]WP,boot,99
(bootloader) [RUU]WP,boot,100
(bootloader) ...... Successful
(bootloader) start image[rpm] unzipping & flushing...
(bootloader) [RUU]UZ,rpm,0
(bootloader) [RUU]UZ,rpm,100
(bootloader) signature checking...
(bootloader) ...... Successful
(bootloader) start image[pg2fs_spcustom] unzipping & flushing...
(bootloader) [RUU]UZ,pg2fs_spcustom,0
(bootloader) [RUU]UZ,pg2fs_spcustom,38
(bootloader) [RUU]UZ,pg2fs_spcustom,99
(bootloader) [RUU]UZ,pg2fs_spcustom,100
(bootloader) ...... Successful
(bootloader) start image[tz] unzipping & flushing...
(bootloader) [RUU]UZ,tz,0
(bootloader) [RUU]UZ,tz,100
(bootloader) signature checking...
(bootloader) ...... Successful
(bootloader) start image[dzdata] unzipping & flushing...
(bootloader) [RUU]UZ,dzdata,0
(bootloader) [RUU]UZ,dzdata,6
(bootloader) [RUU]UZ,dzdata,13
(bootloader) [RUU]UZ,dzdata,20
(bootloader) [RUU]UZ,dzdata,27
(bootloader) [RUU]UZ,dzdata,32
(bootloader) [RUU]UZ,dzdata,37
(bootloader) [RUU]UZ,dzdata,44
(bootloader) [RUU]UZ,dzdata,51
(bootloader) [RUU]UZ,dzdata,58
(bootloader) [RUU]UZ,dzdata,64
(bootloader) [RUU]UZ,dzdata,71
(bootloader) [RUU]UZ,dzdata,78
(bootloader) [RUU]UZ,dzdata,85
(bootloader) [RUU]UZ,dzdata,92
(bootloader) [RUU]UZ,dzdata,99
(bootloader) [RUU]UZ,dzdata,100
(bootloader) [RUU]WP,dzdata,0
(bootloader) [RUU]WP,dzdata,13
(bootloader) [RUU]WP,dzdata,18
(bootloader) [RUU]WP,dzdata,23
(bootloader) [RUU]WP,dzdata,33
(bootloader) [RUU]WP,dzdata,38
(bootloader) [RUU]WP,dzdata,52
(bootloader) [RUU]WP,dzdata,61
(bootloader) [RUU]WP,dzdata,87
(bootloader) [RUU]WP,dzdata,98
(bootloader) [RUU]WP,dzdata,100
(bootloader) ...... Successful
(bootloader) start image[sbl1-2] unzipping & flushing...
(bootloader) [RUU]UZ,sbl1-2,0
(bootloader) [RUU]UZ,sbl1-2,100
(bootloader) signature checking...
(bootloader) ...... Successful
(bootloader) start image[sbl1-1] unzipping & flushing...
(bootloader) [RUU]UZ,sbl1-1,0
(bootloader) [RUU]UZ,sbl1-1,100
(bootloader) signature checking...
(bootloader) verified fail
(bootloader) ..... Bypassed
(bootloader) start image[adsp] unzipping & flushing...
(bootloader) [RUU]UZ,adsp,0
(bootloader) [RUU]UZ,adsp,16
(bootloader) [RUU]UZ,adsp,26
(bootloader) [RUU]UZ,adsp,38
(bootloader) [RUU]UZ,adsp,49
(bootloader) [RUU]UZ,adsp,61
(bootloader) [RUU]UZ,adsp,72
(bootloader) [RUU]UZ,adsp,83
(bootloader) [RUU]UZ,adsp,95
(bootloader) [RUU]UZ,adsp,100
(bootloader) [RUU]WP,adsp,0
(bootloader) [RUU]WP,adsp,100
(bootloader) ...... Successful
(bootloader) start image[tp] unzipping & flushing...
(bootloader) [RUU]UZ,tp,0
(bootloader) [RUU]UZ,tp,100
(bootloader) ...... Successful
(bootloader) start image[sbl2] unzipping & flushing...
(bootloader) [RUU]UZ,sbl2,0
(bootloader) [RUU]UZ,sbl2,100
(bootloader) signature checking...
(bootloader) ...... Successful
(bootloader) start image[recovery] unzipping & flushing...
(bootloader) [RUU]UZ,recovery,0
(bootloader) [RUU]UZ,recovery,11
(bootloader) [RUU]UZ,recovery,22
(bootloader) [RUU]UZ,recovery,36
(bootloader) [RUU]UZ,recovery,48
(bootloader) [RUU]UZ,recovery,74
(bootloader) [RUU]UZ,recovery,85
(bootloader) [RUU]UZ,recovery,95
(bootloader) [RUU]UZ,recovery,100
(bootloader) [RUU]WP,recovery,0
(bootloader) [RUU]WP,recovery,99
(bootloader) [RUU]WP,recovery,100
(bootloader) ...... Successful
(bootloader) start image[system] unzipping & flushing...
(bootloader) [RUU]UZ,system,0
(bootloader) [RUU]UZ,system,1
(bootloader) [RUU]UZ,system,3
(bootloader) [RUU]UZ,system,5
(bootloader) [RUU]UZ,system,6
(bootloader) [RUU]UZ,system,8
(bootloader) [RUU]UZ,system,10
(bootloader) [RUU]UZ,system,12
(bootloader) [RUU]UZ,system,13
(bootloader) [RUU]UZ,system,15
(bootloader) [RUU]UZ,system,17
(bootloader) [RUU]UZ,system,18
(bootloader) [RUU]UZ,system,20
(bootloader) [RUU]UZ,system,22
(bootloader) [RUU]UZ,system,24
(bootloader) [RUU]UZ,system,25
(bootloader) [RUU]WP,system,0
(bootloader) [RUU]WP,system,1
(bootloader) [RUU]WP,system,3
(bootloader) [RUU]WP,system,5
(bootloader) [RUU]WP,system,6
(bootloader) [RUU]WP,system,8
(bootloader) [RUU]WP,system,10
(bootloader) [RUU]WP,system,12
(bootloader) [RUU]WP,system,13
(bootloader) [RUU]WP,system,15
(bootloader) [RUU]WP,system,17
(bootloader) [RUU]WP,system,18
(bootloader) [RUU]WP,system,20
(bootloader) [RUU]WP,system,22
(bootloader) [RUU]WP,system,24
(bootloader) [RUU]WP,system,25
(bootloader) [RUU]UZ,system,25
(bootloader) [RUU]UZ,system,26
(bootloader) [RUU]UZ,system,28
(bootloader) [RUU]UZ,system,30
(bootloader) [RUU]UZ,system,32
(bootloader) [RUU]UZ,system,33
(bootloader) [RUU]UZ,system,35
(bootloader) [RUU]UZ,system,37
(bootloader) [RUU]UZ,system,39
(bootloader) [RUU]UZ,system,41
(bootloader) [RUU]UZ,system,42
(bootloader) [RUU]UZ,system,44
(bootloader) [RUU]UZ,system,46
(bootloader) [RUU]UZ,system,48
(bootloader) [RUU]UZ,system,49
(bootloader) [RUU]UZ,system,51
(bootloader) [RUU]WP,system,25
(bootloader) [RUU]WP,system,26
(bootloader) [RUU]WP,system,28
(bootloader) [RUU]WP,system,30
(bootloader) [RUU]WP,system,32
(bootloader) [RUU]WP,system,33
(bootloader) [RUU]WP,system,35
(bootloader) [RUU]WP,system,37
(bootloader) [RUU]WP,system,39
(bootloader) [RUU]WP,system,41
(bootloader) [RUU]WP,system,42
(bootloader) [RUU]WP,system,44
(bootloader) [RUU]WP,system,46
(bootloader) [RUU]WP,system,48
(bootloader) [RUU]WP,system,49
(bootloader) [RUU]WP,system,51
(bootloader) [RUU]UZ,system,51
(bootloader) [RUU]UZ,system,52
(bootloader) [RUU]UZ,system,54
(bootloader) [RUU]UZ,system,56
(bootloader) [RUU]UZ,system,58
(bootloader) [RUU]UZ,system,59
(bootloader) [RUU]UZ,system,61
(bootloader) [RUU]UZ,system,63
(bootloader) [RUU]UZ,system,64
(bootloader) [RUU]UZ,system,66
(bootloader) [RUU]UZ,system,68
(bootloader) [RUU]UZ,system,69
(bootloader) [RUU]UZ,system,71
(bootloader) [RUU]UZ,system,73
(bootloader) [RUU]UZ,system,75
(bootloader) [RUU]UZ,system,77
(bootloader) [RUU]WP,system,51
(bootloader) [RUU]WP,system,52
(bootloader) [RUU]WP,system,54
(bootloader) [RUU]WP,system,56
(bootloader) [RUU]WP,system,58
(bootloader) [RUU]WP,system,59
(bootloader) [RUU]WP,system,61
(bootloader) [RUU]WP,system,63
(bootloader) [RUU]WP,system,65
(bootloader) [RUU]WP,system,67
(bootloader) [RUU]WP,system,68
(bootloader) [RUU]WP,system,70
(bootloader) [RUU]WP,system,72
(bootloader) [RUU]WP,system,74
(bootloader) [RUU]WP,system,75
(bootloader) [RUU]WP,system,77
(bootloader) [RUU]UZ,system,77
(bootloader) [RUU]UZ,system,78
(bootloader) [RUU]UZ,system,79
(bootloader) [RUU]UZ,system,80
(bootloader) [RUU]UZ,system,82
(bootloader) [RUU]UZ,system,84
(bootloader) [RUU]UZ,system,86
(bootloader) [RUU]UZ,system,88
(bootloader) [RUU]UZ,system,89
(bootloader) [RUU]UZ,system,91
(bootloader) [RUU]UZ,system,93
(bootloader) [RUU]UZ,system,95
(bootloader) [RUU]UZ,system,97
(bootloader) [RUU]UZ,system,99
(bootloader) [RUU]UZ,system,100
(bootloader) [RUU]WP,system,77
(bootloader) [RUU]WP,system,78
(bootloader) [RUU]WP,system,80
(bootloader) [RUU]WP,system,82
(bootloader) [RUU]WP,system,84
(bootloader) [RUU]WP,system,86
(bootloader) [RUU]WP,system,88
(bootloader) [RUU]WP,system,89
(bootloader) [RUU]WP,system,91
(bootloader) [RUU]WP,system,93
(bootloader) [RUU]WP,system,95
(bootloader) [RUU]WP,system,97
(bootloader) [RUU]WP,system,99
(bootloader) [RUU]WP,system,100
(bootloader) ...... Successful
(bootloader) start image[sp1] unzipping & flushing...
(bootloader) [RUU]UZ,sp1,0
(bootloader) [RUU]UZ,sp1,99
(bootloader) [RUU]UZ,sp1,100
(bootloader) [RUU]WP,sp1,0
(bootloader) [RUU]WP,sp1,100
(bootloader) ...... Successful
(bootloader) start image[radio] unzipping & flushing...
(bootloader) [RUU]UZ,radio,0
(bootloader) [RUU]UZ,radio,8
(bootloader) [RUU]UZ,radio,17
(bootloader) [RUU]UZ,radio,25
(bootloader) [RUU]UZ,radio,33
(bootloader) [RUU]UZ,radio,38
(bootloader) [RUU]UZ,radio,46
(bootloader) [RUU]UZ,radio,54
(bootloader) [RUU]UZ,radio,59
(bootloader) [RUU]UZ,radio,67
(bootloader) [RUU]UZ,radio,76
(bootloader) [RUU]UZ,radio,85
(bootloader) [RUU]UZ,radio,92
(bootloader) [RUU]UZ,radio,99
(bootloader) [RUU]UZ,radio,100
(bootloader) [RUU]WP,radio,0
(bootloader) [RUU]WP,radio,33
(bootloader) [RUU]WP,radio,67
(bootloader) [RUU]WP,radio,100
(bootloader) ...... Successful
(bootloader) start image[rcdata] unzipping & flushing...
(bootloader) [RUU]UZ,rcdata,0
(bootloader) [RUU]UZ,rcdata,100
(bootloader) [RUU]WP,rcdata,0
(bootloader) [RUU]WP,rcdata,100
(bootloader) ...... Successful
OKAY [294.154s]
finished. total time: 337.335s

C:\Usr\Android\HTC_site\C_HTL21\downgrad_tool>fastboot reboot

rebooting...

finished. total time: 0.031s

C:\Usr\Android\HTC_site\C_HTL21\downgrad_tool>

RPi_0010 microSDの作成

$
0
0
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スロットに挿す。



RPi_0011 win32diskimager

$
0
0
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を抜く。


RPi_0020 初期設定

$
0
0
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)

必要に応じて、
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#


RPi_0021 SSHクライアント

$
0
0
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 で表示フォントイメージの確認のため。


RPi_0022 USBシリアル接続

$
0
0
正常に立ち上がらないとか、期待したプロセスが起動していないとかの調査には、ブートメッセージが見たい。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



RPi_0023 win10_PL2303_teraterm

$
0
0
RPi_0022 USBシリアル接続
(6)シリアルポート接続(windows編)
  別記事 RPi_0011 win10_PL2303_teraterm

の記事にあたり、以下はWindows10で操作した内容。

(1)ドライバのインストール
以下の、PL2303_64bit_Installer.exeにてCOMポートが認識された。

Family Software Newsletter #37 - (Updated 4/25/16)
Prolific USB To Serial Driver Fix!
Windows 32 and 64-bit Operating Systems - Prolific PL-2303 Driver Fix (VID_067B&PID_2303)
http://www.ifamilysoftware.com/news37.htmlから、


http://www.ifamilysoftware.com/Drivers/PL2303_64bit_Installer.exe
を取ってきて、PL2303のドライバをインストールする。


(2)TeraTermのインストール
https://ja.osdn.net/projects/ttssh2/releases
から
teraterm-4.95.exe か teraterm-4.95.zip を取ってくる。

設定>シリアルポート を見て、ポートCOM3 ボーレート115200 を確認する。
設定>設定の保存をする。


Win10のTeraTermからもラズパイの起動時コンソールメッセージを確認でき、ログインも可能だ。


RPi_0024 exim4 Google設定

$
0
0
むかしの記事 obsA7-007 exim4でsmtp.google.comにとほぼ同じではあるが、
再度はじめからの設定をRaspberryPiで行う。

(1) まだインストールされていないことの確認

% dpkg -l exim4|grep exim4
un exim4 (no description available)

(2) exim4のインストール

# apt-get update
# apt-get install exim4

以下がインストールされた
Status Name Version Architecture Description
ii bsd-mailx 8.1.2-0.20141216cvs armhf simple mail user agent
2a104,107
ii exim4 4.84.2-2+deb8u4 all metapackage to ease Exim MTA (v4) installation
ii exim4-base 4.84.2-2+deb8u4 armhf support files for all Exim MTA (v4) packages
ii exim4-config 4.84.2-2+deb8u4 all configuration for the Exim MTA (v4)
ii exim4-daemon-light 4.84.2-2+deb8u4 armhf lightweight Exim MTA (v4) daemon

systemd 経由のexim4状態を確認
# systemctl status exim4
* exim4.service - LSB: exim Mail Transport Agent
Loaded: loaded (/etc/init.d/exim4)
Active: active (running) since Thu 2017-06-22 09:55:30 JST; 1h 3min ago
CGroup: /system.slice/exim4.service
`-26851 /usr/sbin/exim4 -bd -q30m

# /var/log/syslog もあわせて表示される
Jun 22 09:55:30 rapi3 exim4[26599]: Starting MTA: exim4.
Jun 22 09:55:30 rapi3 systemd[1]: Started LSB: exim Mail Transport Agent.

# tail /var/log/exim4/mainlog の表示
2017-06-22 09:55:30 exim 4.84_2 daemon started: pid=26851, -q30m, listening for SMTP on [127.0.0.1]:25 [::1]:25
2017-06-22 09:55:30 Start queue run: pid=26852
2017-06-22 09:55:30 End queue run: pid=26852

(3) exim4のGoogleサーバ設定

# cd /etc/exim4
初期状態の.orgとの差分。dc_other_hostnames=は変更せずとも、とりあえずそのままでも。
# diff update-exim4.conf.conf.org update-exim4.conf.conf
19,20c19,20
< dc_eximconfig_configtype='local'
< dc_other_hostnames='xxxx.yyy.zz'
---
> dc_eximconfig_configtype='smarthost'
> dc_other_hostnames='DC_OTHER_HOSTNAME'
26c26
< dc_smarthost=''
---
> dc_smarthost='smtp.gmail.com::587'

#ログインパスワード設定
# diff -u passwd.client.org passwd.client
--- passwd.client.org 2017-06-14 18:59:33.000000000 +0900
+++ passwd.client 2017-06-28 17:48:38.317534388 +0900
@@ -5,3 +5,4 @@
#
# Example:
### target.mail.server.example:login:password
+*.google.com:GMYNAME@gmail.com:GPASS

#設定の反映
# /usr/sbin/update-exim4.conf

#exim4の再起動
# /etc/init.d/exim4 restart
[ ok ] Restarting exim4 (via systemctl): exim4.service.
# パーミッションの確認
# ls -l /etc/exim4/passwd.client
-rw-r----- 1 root Debian-exim 658 Jun 22 16:24 /etc/exim4/passwd.client
# 読み書きはrootユーザと、読みはDebian-eximグループになっていることをチェック。
# もし違っていれば以下でパーミッションを設定する。
# chown root:Debian-exim /etc/exim4/passwd.client
# chmod 640 /etc/exim4/passwd.client

(4) 安全性の低いアプリ

以下の [安全性の低いアプリ] の設定をおこなう。

安全性の低いアプリからのアカウントへのアクセスを変更する
https://support.google.com/accounts/answer/6010255?hl=ja
・方法 2: 安全性の低いアプリからアカウントにアクセスできるように設定を変更します。この方法はアカウントのセキュリティを脆弱にするためおすすめしませんが、やむを得ない場合には次の手順で設定を変更できます。
 1.[アカウント情報] の [安全性の低いアプリ] に移動します。
 2.[安全性の低いアプリのアクセス] の横にある [有効にする] を選択します(G Suite ユーザー向け注意: この設定は、管理者が安全性の低いアプリからのアカウントへのアクセスをロックしている場合、表示されません)。


(5) 動作テストでメール送信をする。

% export DT="TEST_exim4 `date`"
% (echo "Subject: $DT"; echo "To: TO_TEST@TO_DOM_NAME"; echo "From: GMYNAME@gmail.com"; echo ""; echo "$DT" ; echo "from `hostname`") | /usr/sbin/exim4 -v -f GMYNAME@gmail.com TO_TEST@TO_DOM_NAME

LOG: MAIN
<= GMYNAME@gmail.com U=MYUSER P=local S=342
delivering 1dQAvV-0000wx-TU1008]
R: smarthost for TO_TEST@TO_DOM_NAME
T: remote_smtp_smarthost for TO_TEST@TO_DOM_NAME
Transport port=25 replaced by host-specific port=587
Connecting to gmail-smtp-msa.l.google.com [2404:6800:4008:c07::6c]:587 ... connected
SMTP<< 220 smtp.gmail.com ESMTP f87sm4356539pfe.35 - gsmtp
SMTP>> EHLO DC_OTHER_HOSTNAME
SMTP<< 250-smtp.gmail.com at your service, [2400:1111:2222:3333:4444:5555:6666:aaaa]
250-SIZE 35882577
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
SMTP>> STARTTLS
SMTP<< 220 2.0.0 Ready to start TLS
SMTP>> EHLO DC_OTHER_HOSTNAME
SMTP<< 250-smtp.gmail.com at your service, [2400:1111:2222:3333:4444:5555:6666:aaaa]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
SMTP>> AUTH PLAIN ****************************************
SMTP<< 235 2.7.0 Accepted
SMTP>> MAIL FROM: SIZE=1376 AUTH=MYUSER@DC_OTHER_HOSTNAME
SMTP>> RCPT TO:
SMTP>> DATA
SMTP<< 250 2.1.0 OK f87sm4356539pfe.35 - gsmtp
SMTP<< 250 2.1.5 OK f87sm4356539pfe.35 - gsmtp
SMTP<< 354 Go ahead f87sm4356539pfe.35 - gsmtp
SMTP>> writing message and terminating "."
SMTP<< 250 2.0.0 OK 1498648474 f87sm4356539pfe.35 - gsmtp
SMTP>> QUIT
LOG: MAIN
=> TO_TEST@TO_DOM_NAME R=smarthost T=remote_smtp_smarthost H=gmail-smtp-msa.l.google.com [2404:6800:4008:c07::6c] X=TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128 DN="C=US,ST=California,L=Mountain View,O=Google Inc,CN=smtp.gmail.com" A=plain C="250 2.0.0 OK 1498648474 f87sm4356539pfe.35 - gsmtp"
LOG: MAIN
Completed
上記のようなログが表示されればメール送信成功で、/var/log/exim4/mainlogには以下のようなログが記録される。
# tail -f /var/log/exim4/mainlog
2017-06-28 10:52:08 Start queue run: pid=3487
2017-06-28 10:52:08 End queue run: pid=3487
2017-06-28 11:14:29 1dQAvV-0000wx-TU <= GMYNAME@gmail.comm U=tsubota P=local S=342
2017-06-28 11:14:34 1dQAvV-0000wx-TU => TO_TEST@TO_DOM_NAME R=smarthost T=remote_smtp_smarthost H=gmail-smtp-msa.l.google.com [2404:6800:4008:c07::6c] X=TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128 DN="C=US,ST=California,L=Mountain View,O=Google Inc,CN=smtp.gmail.com" A=plain C="250 2.0.0 OK 1498648474 f87sm4356539pfe.35 - gsmtp"
もし、失敗しているようであれば、/var/spool/exim4/input に不成功なメッセージが残るので内容を見て削除する。

(6) 内部のメール転送のための設定


/etc/aliases
root: MYUSER
MYUSER: GMYNAME@gmail.com

/etc/email-addresses
MYUSER: GMYNAME@gmail.com
/usr/bin/newaliasesは、/etc/aliasesを変更したときに、変更を有効にする。


RPi_0025 logwatch

$
0
0
(1) logwatchのインストール

# apt-get install logwatch

(2) logwatchの設定

以下の1行の設定変更だけで、前日のログがレポートされるはずである。
# vi /etc/cron.daily/00logwatch
このファイルのこの行を、
/usr/sbin/logwatch --output mail

logwatchログを受け取るメールアドレスに変更する。
/usr/sbin/logwatch --mailto GMYNAME@gmail.com

(3) logwatchの手動動作テスト

通常は、以下のcrontabにあるように、毎朝の6:25に/etc/cron.daily/00logwatchが
起動する。
# grep daily /etc/crontab
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
もし、レポートが届かないときは、
# cp /usr/share/logwatch/default.conf/logwatch.conf /etc/logwatch/conf/
# vi /etc/logwatch/conf/logwatch.conf
にて、次の箇所を変えてみる。
# diff /usr/share/logwatch/default.conf/logwatch.conf /etc/logwatch/conf/logwatch.conf
70c70,71
< Range = yesterday
---
> #Range = yesterday
> Range = All
通常は、前日yesterdayのログでレポートされるのをAllとして、
/usr/sbin/logwatch --output stdout
にて、手動動作テストすると動作確認できる。



RPi_0026 TeraTerm自動ログイン

$
0
0
TeraTermのマクロ機能でttlマクロのアイコンをクリックすることで、一気にラズパイにsshログインする方法を示す。

(1) avahi-daemonのインストール

Avahi(アバヒ) は hostname.local という名前を使ってローカルでホスト名を解決する機能でありこれををラズパイ側にインストールする。
# apt-get install avahi-daemon
# apt-get install avahi-utils  #おまけ avahi-resolve使いたいとき
avahiが起動していることの確認
# ps ax|grep avahi|grep -v grep
368 ? Ss 2:01 avahi-daemon: running [rapiz.local]
380 ? S 0:00 avahi-daemon: chroot helper

(2) Bonjourのインストール

Bonjour印刷サービスをWindows10側にインストールする。
ダウンロード - Bonjour Print Services (Windows) - Apple Support
https://support.apple.com/kb/DL999?viewlocale=ja_JP
からダウンロードして、
Downloads/BonjourPSSetup.exe をクリックして、
「ようこそ Bonjour印刷サービス」の画面に従ってインストールを完了させる。
但しAppleのiTunesをすでにインストールしているならば、Bonjourはインストールされている可能性があり、先にpingしてみよう。
C:\Users>ping rapiz.local
ping 要求ではホスト rapiz.local が見つかりませんでした。ホスト名を確認してもう一度実行してください。
### pingが通らないか、
C:\Users>ping rapiz.local
rapiz.local [192.168.1.80]に ping を送信しています 32 バイトのデータ:
192.168.1.80 からの応答: バイト数 =32 時間 =12ms TTL=64
192.168.1.80 からの応答: バイト数 =32 時間 =11ms TTL=64
192.168.1.80 からの応答: バイト数 =32 時間 =10ms TTL=64
### pingが通ればBonjourはインストールされているだろう。

(3) ttlマクロファイルの編集

ttlマクロファイルの雛形が、
c:/Program Files (x86)/teraterm/ssh2login.ttlにあるので、これをデスクトップにコピーして、例えばssh2rapiz.ttl にリネームする。
c:/Users/Default/Desktop/ssh2rapiz.ttl を以下のように変更修正する。
*** c:/Program Files (x86)/teraterm/ssh2login.ttl
--- c:/Users/Default/Desktop/ssh2rapiz.ttl
@@ -6,19 +6,19 @@
; Update: 2004/12/4
; Author: Yutaka Hirata

-username = 'nike'
-hostname = '192.168.1.3'
+username = 'pi'
+hostname = 'rapiz.local'
+passwdfile = 'c:¥Program Files (x86)¥teraterm¥passwd_pi.dat'

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-msg = 'Enter password for user '
-strconcat msg username
-passwordbox msg 'Get password'
+getpassword passwdfile username userpasswd

msg = hostname
strconcat msg ':22 /ssh /auth=password /user='
strconcat msg username
strconcat msg ' /passwd='
+strconcat msg userpasswd
strconcat msg inputstr

connect msg
もし、ssh2rapiz.ttl が以下のような[M]マークアイコンになっていなければ、

teraterm-4.95.exeを再インストールして、

チェック項目の.ttlファイルをttermpro.exeに関連付ける

piユーザのパスワードは passwdfile = 'c:¥Program Files (x86)¥teraterm¥passwd_pi.dat'に保存される。このファイルが無ければパスワード入力されファイル作成され、ファイルがあればパスワードが読み出してデコードされて自動ログインのパスワードとして使用される。
bash-4.1$ cat "/cygdrive/c/Program Files (x86)/teraterm/passwd_pi.dat"
[Password]
pi=XXXXYYYYZZZZAAAABB #エンコードされた文字列
たぶんHackingすればデコードできるんだろう。平文よりはヨシとする。

(4) ttlマクロの実行

ssh2rapiz.ttlのクリックで、TeraTerm自動ログインできる。
ログイン後の画面で、rapiz.localでの、IPアドレスの正引きと逆引きをしているようす。
pi@rapiz:~ $ ifconfig wlan0|grep "inet addr:"
inet addr:192.168.1.80 Bcast:192.168.1.255 Mask:255.255.255.0
pi@rapiz:~ $
pi@rapiz:~ $ ping -c 2 rapiz.local|head -3
PING rapiz.local (192.168.1.80) 56(84) bytes of data.
64 bytes from rapiz.gjs.or.jp (192.168.1.80): icmp_seq=1 ttl=64 time=0.178 ms
64 bytes from rapiz.gjs.or.jp (192.168.1.80): icmp_seq=2 ttl=64 time=0.178 ms
pi@rapiz:~ $
pi@rapiz:~ $ avahi-resolve -n rapiz.local
rapiz.local 192.168.1.80
pi@rapiz:~ $
pi@rapiz:~ $ avahi-resolve -a 192.168.1.80
192.168.1.80 rapiz.local
pi@rapiz:~ $
これで、ネットワークの場所を移動するたびに、FingでラズパイのIPアドレスを調べて、TeraTerm起動しIPアドレスや、ユーザパスワードを入力していた手間が省ける。アイコンのクリック一発でログインできて、とても便利になるはずだ。

RPi_0027 exFATマウントdump

$
0
0
USBメモリに区画を作り、dumpバックアップについての説明する。

(1) exfatとdumpのインストール

WindowでもMacでも書き込めるexFATが使えるようにして、Raspbianのフルバックアップ用にdumpをインストールする。 FATについては、『FAT32、FAT16、NTFS、exFATとは何ですか。』 http://faq.buffalo.jp/app/answers/detail/a_id/1079を参照。
# apt-get install exfat-fuse
( apt-get install exfat-utils ) #exfat-fuseで同時にインストールされる
# apt-get install dump  #restoreコマンドもインストールされる

(2) USBメモリの区画作成

USBメモリなら何でもよいと思われるが、ここではSanDisk SDDD2-016Gをラズパイに挿す。
% lsusb | head -1
Bus 001 Device 004: ID 0781:5590 SanDisk Corp. #USBメモリ認識

# 区画の状態を調べる
# コマンドとしては fdisk,cfdisk,sfdisk,parted,gpartedなどがある
# fdisk -l /dev/sda
Disk /dev/sda: 14.3 GiB, 15376000000 bytes, 30031250 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device Boot Start End Sectors Size Id Type
/dev/sda1 32 30031249 30031218 14.3G c W95 FAT32 (LBA)
Idはcなので、W95 FAT32 (LBA) のフォーマットであるが、これを、
Idが7の、HPFS/NTFS/exFAT の フォーマットに切り直す。さらに
領域の半分は、Type Id 83 の Linuxフォーマットにする。
セクタ数30031218の半分は、
echo "(30031250-2048) / 2" | bc
の15014601 である。
# フォーマットの切り直し
# fdisk /dev/sda
Device Boot Start End Sectors Size Id Type
/dev/sda1 32 30031249 30031218 14.3G c W95 FAT32 (LBA)

Command (m for help): d 1
Selected partition 1
Partition 1 has been deleted.  # 区画1が削除された

Command (m for help): n  # 1つ目の新しい区画を作る
Partition type
Select (default p): p  #区画の種類はprimary
Partition number (1-4, default 1): 1
First sector (2048-30031249, default 2048):ENTERで2048
Last sector, +sectors or +size{K,M,G,T,P} (2048-30031249, default 30031249): +15014601
Created a new partition 1 of type 'Linux' and of size 7.2 GiB.
Command (m for help): n  # 2つ目の新しい区画を作る
Partition type
Select (default p): p  #区画の種類はprimary
Partition number (2-4, default 2):ENTERで2
First sector (15015936-30031249, default 15015936):ENTERで15015936
Last sector, +sectors or +size{K,M,G,T,P} (15015936-30031249, default 30031249):
ENTERで30031249になりお尻は (0-30031249)0オリジン開始。
Created a new partition 2 of type 'Linux' and of size 7.2 GiB.

Command (m for help): p  #できた区画をみる
Disk /dev/sda: 14.3 GiB, 15376000000 bytes, 30031250 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 15015935 15013888 7.2G 83 Linux
/dev/sda2 15015936 30031249 15015314 7.2G 83 Linux
#セクター数はheads/cylindersで丸められるので、ドンピシャな同じ区画サイズにならない
#セクター数15015314-15013888=1426のサイズ差となった

Command (m for help): t  #フォーマットタイプを変更
Partition number (1,2, default 2): 1  #対象の区画は1番目
Hex code (type L to list all codes): L  #Id番号のリスト

0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris
1 FAT12 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT-
2 XENIX root 39 Plan 9 83 Linux c4 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 84 OS/2 hidden C: c6 DRDOS/sec (FAT-
4 FAT16 <32M 40 Venix 80286 85 Linux extended c7 Syrinx
5 Extended 41 PPC PReP Boot 86 NTFS volume set da Non-FS data
6 FAT16 42 SFS 87 NTFS volume set db CP/M / CTOS / .
7 HPFS/NTFS/exFAT 4d QNX4.x 88 Linux plaintext de Dell Utility
8 AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt
9 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e1 DOS access
a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O
b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor
c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi eb BeOS fs
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD ee GPT
f W95 Ext’d (LBA) 54 OnTrackDM6 a6 OpenBSD ef EFI (FAT-12/16/
10 OPUS 55 EZ-Drive a7 NeXTSTEP f0 Linux/PA-RISC b
11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f1 SpeedStor
12 Compaq diagnost 5c Priam Edisk a9 NetBSD f4 SpeedStor
14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot f2 DOS secondary
16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ fb VMware VMFS
17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fc VMware VMKCORE
18 AST SmartSleep 65 Novell Netware b8 BSDI swap fd Linux raid auto
1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fe LANstep
1c Hidden W95 FAT3 75 PC/IX be Solaris boot ff BBT
1e Hidden W95 FAT1 80 Old Minix
Hex code (type L to list all codes): 7  #7 HPFS/NTFS/exFAT を選択
Changed type of partition 'Linux' to 'HPFS/NTFS/exFAT'.
#あるいは、
Hex code (type L to list all codes): c  #c W95 FAT32 (LBA) を選択
Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.

Command (m for help): p  #変更した区画をみる
Disk /dev/sda: 14.3 GiB, 15376000000 bytes, 30031250 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 15015935 15013888 7.2G 7 HPFS/NTFS/exFAT
/dev/sda2 15015936 30031249 15015314 7.2G 83 Linux

Command (m for help): w  #変更を書き込む
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

# リブートで反映されるとあるので
# reboot するか、USBメモリを抜いて、別なUSBポートに指し直す。
# partprobe がエラーにならなければOKだろう
# partprobe -s
/dev/sda: msdos partitions 1 2
/dev/mmcblk0: msdos partitions 1 2
区画ができたならば、つぎにフォーマットする
# mkfs.exfat -n exFAT_7G /dev/sda1
mkexfatfs 1.1.0
Creating... done.
Flushing... done.
File system created successfully.

もしくは、
# mkfs.vfat -v -F 32 -n FAT32_7G /dev/sda1
/dev/sda1 has 64 heads and 32 sectors per track,
(略)
Volume ID is 980b59c3, volume label FAT32_7G .
必要ならオプション追加 -c:不良ブロックの検査を行う

# mkfs.ext4 -j -L ext4_7G /dev/sda2
mke2fs 1.43.3 (04-Sep-2016)
Creating filesystem with 1876914 4k blocks and 469568 inodes
Filesystem UUID: fb6e48ef-b51c-44d1-b817-71677adac421
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
フォーマットのあとマウントする
# mkdir -p /dsk/sda1; mkdir /dsk/sda2  #マウントポイント
# mount -v /dev/sda1 /dsk/sda1
FUSE exfat 1.1.0
# mount -v /dev/sda2 /dsk/sda2
mount: /dev/sda2 mounted on /dsk/sda2.

Raspbianがデスクトップ版の場合は、オートマウントされるようだ。
/dev/sda1 7506944 3872 7503072 1% /media/pi/exFAT_7G
/dev/sda2 7324192 33004 6899424 1% /media/pi/ext4_7G
マウントポイントはラベル名が使用される。

# mount|grep dsk   #マウントの状態
/dev/sda2 on /dsk/sda2 type ext4 (rw,relatime,data=ordered)
/dev/sda1 on /dsk/sda1 type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,blksize=4096)

# df -H|egrep 'Used|dsk'  #マウントの使用状況
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 7.5G 34M 7.1G 1% /dsk/sda2
/dev/sda1 7.7G 1.3M 7.7G 1% /dsk/sda1

# 取り外す前にはアンマウントする
# umount /dsk/sda1
# umount /dsk/sda2

(3) ext4区画のバックアップ

Raspbianのroot区画をフルバックアップする方法を示す。
以下の b_mmcblk0_local.sh スクリプトを/usr/local/bin/に置く。
</usr/local/bin/b_mmcblk0_local.sh>
#! /bin/bash
# $Id: b_mmcblk0_local.sh,v 1.1 2017-08-01 10:19:56+09 tsubota $
#
SEND_ADDR="MY_GMAIL@gmail.com"
FROM_ADDR="MY_GMAIL@gmail.com"

LogMailSend() {
MDHM=`date '+%Y/%m/%d(%a) %H:%M:%S'`
SUBJECT=$1
MESS=$2
logline=`echo $MDHM; echo $MESS`
(echo "Mime-Version: 1.0"; echo "Content-Type: Text/Plain; charset=iso-2022-jp"; echo "Content-Transfer-Encoding: 7bit"; echo "Subject: $SUBJECT"; echo "To: ${SEND_ADDR}"; echo "From: ${FROM_ADDR}"; echo ""; echo "$DT" ; echo "from `hostname`"; echo "${MYCMD} Running LOG."; echo ${logline}|nkf -j) | /usr/sbin/exim4 -f ${FROM_ADDR} ${SEND_ADDR}
}
ExecMailSend() {
MDHM=`date '+%Y/%m/%d(%a) %H:%M:%S'`
SUBJECT=$1
LISTFILE=$2
LOGFILE="`pwd`/$LISTFILE"
(echo "Mime-Version: 1.0"; echo "Content-Type: Text/Plain; charset=iso-2022-jp"; echo "Content-Transfer-Encoding: 7bit"; echo "Subject: $SUBJECT"; echo "To: ${SEND_ADDR}"; echo "From: ${FROM_ADDR}"; echo ""; echo "$DT" ; echo "from `hostname`"; echo "${MYCMD} Running LOG."; echo "LISTFILE=$LOGFILE"; nkf -j $LISTFILE) | /usr/sbin/exim4 -f ${FROM_ADDR} ${SEND_ADDR}
}

HDEV=mmcblk0p2
if [ `whoami` != "root" ]; then
ERRMSG="User not root."
echo $ERRMSG
logger $ERRMSG
exit 1
fi
MYCMD=$0
MYNM=`basename $0`
BODY=${MYNM%.sh}

RDIR=/dsk/sda2/Backup/rapi4/RootBz
if [ ! -d ${RDIR} ]; then
ERRMSG="Not Mounted $RDIR."
echo $ERRMSG
LogMailSend "$MYNM FAIL1""$ERRMSG"
logger $ERRMSG
exit 1
fi
cd $RDIR
if [ $? != 0 ]; then
ERRMSG="CANNOT cd $RDIR."
echo $ERRMSG
logger $ERRMSG
LogMailSend "$MYNM FAIL2""$ERRMSG"
exit 1
fi

YMD=`date "+%Y_%m%d"`
BDIR=${BODY}_${YMD}
if [ ! -d ${BDIR} ]; then
mkdir -p ${BDIR}
if [ $? != 0 ]; then
ERRMSG="Cannot mkdir $BDIR."
echo $ERRMSG
logger $ERRMSG
exit 1
fi
fi

CLOG="${BDIR}/${HDEV}_${YMD}.log"
echo "START=`date`" | tee $CLOG
echo "----------------------------------------" | tee -a $CLOG
echo "% /sbin/fdisk -l /dev/mmcblk0" | tee -a $CLOG
/sbin/fdisk -l /dev/mmcblk0 | sed -n -e "/^Disk/,//p" | tee -a $CLOG
echo "----------------------------------------" | tee -a $CLOG
echo "% df" | tee -a $CLOG
df | tee -a $CLOG
echo "" | tee -a $CLOG
echo "" | tee -a $CLOG
echo "****************************************" | tee -a $CLOG
date | tee -a $CLOG
pwd | tee -a $CLOG
set -x
(/sbin/dump 0usf 99999 - /dev/${HDEV} | \
bzip2 -c > ${BDIR}/${HDEV}_${YMD}.dump.bz2 ) 2>&1 | tee -a $CLOG
date | tee -a $CLOG
ls -l ${BDIR} | tee -a $CLOG
ls -lh ${BDIR} | tee -a $CLOG
md5sum ${BDIR}/${HDEV}_${YMD}.dump.bz2 | tee -a $CLOG
set +x
echo "****************************************" | tee -a $CLOG
echo "END=`date`" | tee -a $CLOG
ExecMailSend "$MYNM FINISH.""$CLOG"
exit 0

# end of b_mmcblk0_local.sh
b_mmcblk0_local.shに実行許可を与える。
たとえば、月初めに実行したいのならば、crontabに設定するとよい。
# chmod 755 /usr/local/bin/b_mmcblk0_local.sh
# vi /etc/crontab
4 2 1 * * root /usr/local/bin/b_mmcblk0_local.sh
ついたちの2時4分に起動する例。
rootで実行するよりは、/etc/groupの"disk:x:6:"の行にユーザを加えて、 ユーザモードでバックアップするのが、よりよいだろう。
復元は、
展開するディレクトリにcdしたあと、
# bzip2 -dc ABC.bz2 | restore rf - #フルリストア
# bzip2 -dc ABC.bz2 | restore ivf - #会話部分リストア
でできるだろう。

RPi_0028 samba

$
0
0
(1) sambaのインストール

# apt-get install samba

(2) sambaの設定

設定ファイル smb.confを変更する。
# cp -p /etc/samba/smb.conf /etc/samba/smb.conf.org
# vi /etc/samba/smb.conf
にて、次の箇所をファイルの最後に追加する。

# diff -u /etc/samba/smb.conf.org /etc/samba/smb.conf
--- /etc/samba/smb.conf.org 2017-08-21 21:52:00.289168125 +0900
+++ /etc/samba/smb.conf 2017-08-21 21:57:37.187616391 +0900
@@ -252,3 +252,10 @@
# to the drivers directory for these users to have write rights in it
; write list = root, @lpadmin

+[mypiuser]
+path = /home/mypiuser
+read only = No
+browsable = yes
+guest ok = Yes
+force user = mypiuser

○ samba パスワードの変更
# smbpasswd -a mypiuser
New SMB password:
Retype new SMB password:
Added user mypiuser.

○ sambaを再起動させる
# /etc/init.d/samba restart
[ ok ] Restarting nmbd (via systemctl): nmbd.service.
[ ok ] Restarting smbd (via systemctl): smbd.service.
[ ok ] Restarting samba-ad-dc (via systemctl): samba-ad-dc.service.
macOSからは、Finderで、移動>サーバへ接続
サーバアドレス:smb://rapi3.local/mypiuser

windowsからは、エクスプローラから、ネットワーク
\\rapi3.local\mypiuser

とかでネットワーク越しにファイル操作できるようになる。


RPi_0029 PulseAudio

$
0
0
Raspberry Pi3からBluetoothスピーカにペアリングして音楽再生する。
なおPiZeroWで同じ設定をしたが非力で音飛びするようだった。

以下のWebページの内容をトレースして設定した。
《参照》
Raspberry PI 3 で Bluetooth(A2DP)
http://qiita.com/nattof/items/3db73a95e63100d7580a

(1) PulseAudioのインストール

# apt-get install pulseaudio-module-bluetooth

(2) PulseAudioの設定

3つのファイルを設定する。
○その1
# cat << EOF > /etc/systemd/system/pulseaudio.service
[Unit]
Description=Pulse Audio

[Service]
Type=simple
ExecStart=/usr/bin/pulseaudio --system --disallow-exit --disable-shm

[Install]
WantedBy=multi-user.target
EOF
○その2
# cat << EOF > /etc/dbus-1/system.d/pulseaudio-bluetooth.conf
<busconfig>

<policy user="pulse">
<allow send_destination="org.bluez"/>
</policy>

</busconfig>
EOF
○その3
# cat << EOF >> /etc/pulse/system.pa

### Automatically load driver modules for Bluetooth hardware
.ifexists module-bluetooth-policy.so
load-module module-bluetooth-policy
.endif

.ifexists module-bluetooth-discover.so
load-module module-bluetooth-discover
.endif
EOF

(3) 使用したbluetoothスピーカ


2年くらい前にSoftBankのキャンペーンでもらったOnyx Studioと、ことしの1月にauのキャンペーンでもらった座布団つきのGH-OTOMO。ともに再生は確認できたが、GH-OTOMOはボリュームがないので、AlsaMixerでの音量調整が必要。

(4) PulseAudioの起動

○pulseaudioサービスを起動
# systemctl start pulseaudio.service
○pulseaudioサービスを自動で起動
# systemctl enable pulseaudio.service
○bluetoothの再起動
# /etc/init.d/bluetooth restart
[ ok ] Restarting bluetooth (via systemctl): bluetooth.service.

(5) bluetoothスピーカへの接続

bluetoothスピーカとペアリングして接続する
# bluetoothctl #bluetoothコントロールツール
[NEW] Controller 43:43:A1:12:AA:AA rapi3 [default]

[bluetooth]# scan on #スキャン開始
Discovery started
[CHG] Controller 43:43:A1:12:AA:AA Discovering: yes
[NEW] Device 0C:A6:94:0D:ZZ:ZZ HK Onyx Studio

[bluetooth]# pair 0C:A6:94:0D:ZZ:ZZ  #Onyx Studioとペアリング
Attempting to pair with 0C:A6:94:0D:ZZ:ZZ
[CHG] Device 0C:A6:94:0D:ZZ:ZZ Connected: yes
[CHG] Device 0C:A6:94:0D:ZZ:ZZ Paired: yes
Pairing successful

[bluetooth]# connect 0C:A6:94:0D:ZZ:ZZ #Onyx Studioに接続
Attempting to connect to 0C:A6:94:0D:ZZ:ZZ
[CHG] Device 0C:A6:94:0D:ZZ:ZZ Connected: yes
Connection successful

[bluetooth]# trust 0C:A6:94:0D:ZZ:ZZ #Onyx Studioを信頼
[CHG] Device 0C:A6:94:0D:ZZ:ZZ Trusted: yes
Changing 0C:A6:94:0D:ZZ:ZZ trust succeeded

[bluetooth]# info 0C:A6:94:0D:ZZ:ZZ #Onyx Studioの接続情報
Device 0C:A6:94:0D:ZZ:ZZ
Name: HK Onyx Studio
Alias: HK Onyx Studio
Class: 0x240414
Icon: audio-card
Paired: yes
Trusted: yes
Blocked: no
Connected: yes
LegacyPairing: no
UUID: Audio Sink (XXX..XXX)
UUID: A/V Remote Control Target (XXX..XXX)
UUID: A/V Remote Control (XXX..XXX)
[bluetooth]# scan off #スキャン終了
Discovery stopped
[CHG] Controller 43:43:A1:12:AA:AA Discovering: no
[bluetooth]# devices #検出したデバイス
Device 08:62:66:17:XX:XX 2F_NPlayer_2nd
Device 08:62:66:17:YY:YY 1F_NPlayer_1st
Device FC:58:FA:00:ZZ:ZZ GH-OTOMO
Device 0C:A6:94:0D:ZZ:ZZ HK Onyx Studio
[bluetooth]#

[bluetooth]# quit #終了
[DEL] Controller 43:43:A1:12:AA:AA rapi3 [default]

音を出すユーザーを「pulse-access」グループに追加
# gpasswd -a root pulse-access
# gpasswd -a user pulse-access
# grep pulse-access /etc/group
pulse-access:x:117:root,user #追加されたユーザを見る

(6) mplayerでの再生例

●1 bluetoothスピーカ再生
# mplayer --ao=pulse /usr/local/etc/mdetect/Mp3/01_Beautiful_World.mp3
# mplayer --ao=pulse 01_FIGHT_WITH_LOVE.m4a
●2 ミニプラグジャック再生
# mplayer --ao=alsa /usr/local/etc/mdetect/Mp3/01_Beautiful_World.mp3
●3 MUSIC BIRDデジタル音楽放送 岡山県 コミュニティFM レディオ モモ
# mplayer --ao=pulse --cache=900 --quiet 'http://musicbird-hls.leanstream.co/musicbird/JCB079.stream/playlist.m3u8?args=web_03'


RPi_0030 partedとrestore

$
0
0
Raspbian のブートプロセスでrootマウントは、/boot/cmdline.txt と /etc/fstab で、"root=PARTUUID=12345678-02"と"PARTUUID=12345678-02 / ext4"などと、PARTUUIDを一致させて、ルートパーティションをマウントしている。

microSDの区画切りで、fdiskではPARTUUIDはフォーマット後に出現しない。
gdiskでは、Partition Table: gpt で区画するとPARTUUIDが現れるが、RaspberryPiは Partition Table: msdos でないと起動してくれない。

これが、partedだと、Partition Table: msdos にて、PARTUUIDは区画切り後に出現した。

partedで区画を作り、dumpバックアップからのrestoreしてmicroSDでの起動についての説明する。

(1) partedで区画を作成

(1-1)まず、8GBのmicroSDをfdiskで区画切りしてフォーマットでは、以下のようにblkidではPARTUUIDが出現しない。Disk identifier: 0x0になっている。
# fdisk -l /dev/sda

Disk /dev/sda: 7.4 GiB, 7985954816 bytes, 15597568 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000 #ここ値がセットできれば良いのだが

Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 104447 102400 50M c W95 FAT32 (LBA)
/dev/sda2 104448 15597567 15493120 7.4G 83 Linux

# blkid | grep sda
/dev/sda1: SEC_TYPE="msdos" UUID="B7B2-351F" TYPE="vfat"
/dev/sda2: UUID="958651f6-3615-4ac6-afeb-bae165a936d9" TYPE="ext4"

(1-2)そのままmicroSDをpartedで、区画の削除をする。
# parted /dev/sda
GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p #区画の確認
Model: Mass Storage Device (scsi)
Disk /dev/sda: 7986MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags
1 1049kB 53.5MB 52.4MB primary fat32 lba
2 53.5MB 7986MB 7932MB primary ext4

(parted) rm 2 #区画2削除
Warning: Partition /dev/sda2 is being used. Are you sure you want to continue?
Yes/No? Yes
Error: Partition(s) 2 on /dev/sda have been written, but we have been unable to
inform the kernel of the change, probably because it/they are in use. As a
result, the old partition(s) will remain in use. You should reboot now before
making further changes.
Ignore/Cancel? I
(parted) rm 1 #区画1削除
Warning: Partition /dev/sda1 is being used. Are you sure you want to continue?
Yes/No? Y
Error: Partition(s) 1, 2 on /dev/sda have been written, but we have been unable
to inform the kernel of the change, probably because it/they are in use. As a
result, the old partition(s) will remain in use. You should reboot now before
making further changes.
Ignore/Cancel? I
(parted) p #区画削除されたことの確認
Model: Mass Storage Device (scsi)
Disk /dev/sda: 7986MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags

(parted)

(1-3)次に、mkpartで区画の作成をする。
(parted) mkpart #区画作成コマンド
Partition type? primary/extended? p
File system type? [ext2]? fat32 #fat32で区画の作成
Start? 0
End? 50M
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? I
Error: Partition(s) 1, 2 on /dev/sda have been written, but we have been unable
to inform the kernel of the change, probably because it/they are in use. As a
result, the old partition(s) will remain in use. You should reboot now before
making further changes.
Ignore/Cancel? I
(parted) mkpart
Partition type? primary/extended? p
File system type? [ext2]? ext4 #ext4で区画の作成
Start? 50M
End? 8G
Error: Partition(s) 1, 2 on /dev/sda have been written, but we have been unable
to inform the kernel of the change, probably because it/they are in use. As a
result, the old partition(s) will remain in use. You should reboot now before
making further changes.
Ignore/Cancel? I
# # # インタラクティブ(interactive)な対話モードでなく、
# (parted) mkpart p fat32 0% 50M
# (parted) mkpart p ext4 50M 100%
# とか、引数を指定して、start end は100%のように%も使えるようだ。
(parted) p #区画の確認
Model: Mass Storage Device (scsi)
Disk /dev/sda: 7986MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags
1 512B 50.0MB 50.0MB primary fat32 lba
2 50.3MB 7986MB 7936MB primary ext4 lba

(parted) quit #writeしなくてもquitで書き込んでくれるようだ。
Information: You may need to update /etc/fstab.

# 一旦このmicroSD8GBを取外して挿し直すか、再起動で区画の正常認識を確認する。
# partprobe -s
/dev/sda: msdos partitions 1 2
/dev/mmcblk0: msdos partitions 1 2

(1-4)フォーマットする
# fdisk -l /dev/sda

Disk /dev/sda: 7.4 GiB, 7985954816 bytes, 15597568 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x88584BBB  ###これがPARTUUIDのもとになるようだ。

Device Boot Start End Sectors Size Id Type
/dev/sda1 1 98303 98303 48M c W95 FAT32 (LBA)
/dev/sda2 98304 15597567 15499264 7.4G 83 Linux

# mkfs.vfat /dev/sda1 #vfatでフォーマット
mkfs.fat 3.0.27 (2014-11-12)
# mkfs.ext4 -j /dev/sda2 #ext4ジャーナル付きでフォーマット
mke2fs 1.43.3 (04-Sep-2016)
Creating filesystem with 1937408 4k blocks and 484800 inodes
Filesystem UUID: 1de1421d-55c1-4fd1-94d4-e5b1d266dAAA
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done

# blkid | grep sda #こんどは以下のようにblkidでPARTUUIDが出現している。
/dev/sda1: SEC_TYPE="msdos" UUID="1A96-82FB" TYPE="vfat" PARTUUID="88584BBB-01"
/dev/sda2: UUID="1de1421d-55c1-4fd1-94d4-e5b1d266dAAA" TYPE="ext4" PARTUUID="88584BBB-02"
#

(2) dumpバックアップからのrestore

restore対象のmountポイントにcdしてrestoreする。
# mount /dev/sdb1 /dsk/sdb1 #/boot区画マウント
# mount /dev/sdb2 /dsk/sdb2 #ルート区画マウント
# cd /dsk/sdb1
# rsync -a /dsk/sda4/Backup/rapia/RootBz/boot/. . #/boot領域のコピー
# cd ../sdb2
# ls
lost+found
 #以下でrestoreの実行
# time bzip2 -dc /dsk/sda4/Backup/rapia/RootBz/b_mmcblk0_rapia_2017_0902/mmcblk0p2_2017_0902.dump.bz2| restore rf -

restore: ./lost+found: File exists

bzip2 -dc 953.43s user 33.54s system 85% cpu 19:19.90 total
restore rf - 15.04s user 67.21s system 7% cpu 19:21.66 total
#

1.5GBのリストアに953秒の約16分かかった。
結構まつので、進捗ぐあいの確認には、
while [ true ]; do echo -n "`date "+%H:%M:%S"` "; df -H |grep /dev/sdb2|awk '{print $1,$2,$3,$4}'; sleep 30; done
...とかで、
22:31:44 /dev/sdb2 7.8G 946M 6.4G
22:32:14 /dev/sdb2 7.8G 985M 6.4G
22:32:44 /dev/sdb2 7.8G 1.1G 6.4G
...などと見張る。

(3) cmdline.txtとfstabの修正

PARTUUIDの部分をblkidのものと、それぞれ一致させる。
# cat /dsk/sdb1/cmdline.txt
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=88584BBB-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
# cat /dsk/sdb2/etc/fstab
proc /proc proc defaults 0 0
PARTUUID=88584BBB-01 /boot vfat defaults 0 2
PARTUUID=88584BBB-02 / ext4 defaults,noatime 0 1
# a swapfile is not a swap partition, no line here
# use dphys-swapfile swap[on|off] for that

◎ /dsk/sdb1と/dsk/sdb2をアンマウントして再起動する。
◎ restore後のmicroSD8GBの起動では、以下のようなPARTUUIDの状態になっている。
# ls -l /dev/disk/by-partuuid
total 0
lrwxrwxrwx 1 root root 15 Sep 2 14:17 88584BBB-01 -> ../../mmcblk0p1
lrwxrwxrwx 1 root root 15 Sep 2 14:17 88584BBB-02 -> ../../mmcblk0p2
# blkid
/dev/mmcblk0p1: SEC_TYPE="msdos" UUID="1A96-82FB" TYPE="vfat" PARTUUID="88584BBB-01"
/dev/mmcblk0p2: UUID="1de1421d-55c1-4fd1-94d4-e5b1d266dAAA" TYPE="ext4" PARTUUID="88584BBB-02"
/dev/mmcblk0: PTUUID="88584BBB" PTTYPE="dos"
# grep PARTUUID /etc/fstab
PARTUUID=88584BBB-01 /boot vfat defaults 0 2
PARTUUID=88584BBB-02 / ext4 defaults,noatime 0 1
# grep PARTUUID /boot/cmdline.txt
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=88584BBB-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
#


Viewing all 42 articles
Browse latest View live