DRY

Web関連の技術の事、食事/お酒の事、旅行の事など

Intel Edisonが文鎮になりかけたので、初期化して修復した方法

Intel Edisonをいろいろいじっていたら突然下記のようなログが出て、一向にOSが起動しなくなってしまいました。

Target:blank
Partitioning already done...
Flashing already done...
GADGET DRIVER: usb_dnl_dfu
reading vmlinuz
5383904 bytes read in 133 ms (38.6 MiB/s)
Valid Boot Flag
Setup Size = 0x00003c00
Magic signature found
Using boot protocol version 2.0c
Linux kernel version 3.10.17-poky-edison+ (sys_dswci@tlsndgbuild004) #1 SMP PREEMPT Wed Apr 29 03:54:01 CEST 2015
Building boot_params at 0x00090000
Loading bzImage at address 00100000 (5368544 bytes)
Magic signature found
Kernel command line: "root=PARTUUID=012b3303-34ac-284d-99b4-34e03a2335f4 rootfstype=ext4 console=ttyMFD2 earlyprintk=ttyMFD2,keep loglevel=4 systemd.unit=multi-user.target hardware_id=00 g_multi.iSerialNumber=b5ce965017e521b5417f35bcd5d6fdc6"

Starting kernel ...

[    0.760313] pca953x 1-0020: failed reading register
[    0.765535] pca953x 1-0021: failed reading register
[    0.770634] pca953x 1-0022: failed reading register
[    0.775754] pca953x 1-0023: failed reading register
[    1.614292] snd_soc_sst_platform: Enter:sst_soc_probe
[    2.018089] pmic_ccsm pmic_ccsm: Error reading battery profile from battid frmwrk
[    2.036300] pmic_ccsm pmic_ccsm: Battery Over heat exception
[    2.036370] pmic_ccsm pmic_ccsm: Battery0 temperature inside boundary

何かBattery Over heatと言われても、そもそも電源に繋いでいるしなと思いながらちょっと時間を開けて冷やしてしてみましたが同じエラーが出続けるのでこれは根本的な問題があると思い、いろいろ調べた結果初期化するしかないらしいという結論に辿り着きました。

なかなか文鎮化しかけたハードにさらに手を入れるのは素人では恐いのですが、やらざるを得なかったのとこれ関係のWebでの記事があまり見つからなかったので、備忘録の意味も含めて手順とログを残しておきます。

最新版の公式イメージをダウンロードする

公式サイトから最新版のYoctoをダウンロードします
執筆時(2017/02/09)はiot-devkit-prof-dev-image-edison-20160606-patch

解凍して、flashall.shがあることを確認する

Macの環境を整える

この後flashall.shを実行するのだが、その際にMacに入ってなさそうで必要なコマンドをインストールしておく
$ brew install gnu-getopt
$ brew install coreutils
(必要なのはgreadlinkだが、greadlinkはcoreutils内に入っている)
$ brew install dfu-util

  • 私の場合はこれで足りたが、他にインストールする必要がある人もいるかも知れないのでそれは適時実行してください

Edisonの準備

まずはシリアル経由でMacからEdisonに接続

$ screen /dev/cu.usbserial-XXXX 115200 -L
* usbserial-XXXXのXXXXはご自身の環境に合わせてください

Edisonをフラッシュモードにする

Edisonを起動して、「Hit any key to stop autoboot: 0」が出たタイミングで何かキーを押してautobotを止める。
そうすると「boot >」プロンプトになる

U-Boot 2014.04 (Apr 29 2015 - 03:53:19)

       Watchdog enabled
DRAM:  980.6 MiB
MMC:   tangier_sdhci: 0
In:    serial
Out:   serial
Err:   serial
Hit any key to stop autoboot:  0
boot >

この状態で「run do_flash」を叩いて、Edisonをフラッシュモードにする

boot > run do_flash
Saving Environment to MMC...
Writing to redundant MMC(0)... done
GADGET DRIVER: usb_dnl_dfu

このように待ち状態になったらEdison側の準備はOK

Mac側からフラッシュの開始

Mac側からflashall.shを起動する

$ cd ~/Downloads/iot-devkit-prof-dev-image-edison-20160606-patch  
$ chmod +x flashall.sh  
$ ./flashall.sh  

うまく行くとEdisonと繋いでいるシリアルの画面にてDFUのログが出始める

Hit any key to stop autoboot:  0
boot > run do_flash
Saving Environment to MMC...
Writing to MMC(0)... done
GADGET DRIVER: usb_dnl_dfu
#
DFU complete CRC32: 0x3756edb6
DOWNLOAD ... OK
Ctrl+C to exit ...
#

同様にMac側では以下のように順にログが流れる(最後まで記載しています)

$ ./flashall.sh
Using U-Boot target: edison-blankcdc
Now waiting for dfu device 8087:0a99
Please plug and reboot the board
Flashing IFWI
Download     [=========================] 100%      4194304 bytes
Download     [=========================] 100%      4194304 bytes
Flashing U-Boot
Download     [=========================] 100%       237568 bytes
Flashing U-Boot Environment
Download     [=========================] 100%        65536 bytes
Flashing U-Boot Environment Backup
Download     [=========================] 100%        65536 bytes
Rebooting to apply partition changes
Now waiting for dfu device 8087:0a99
Flashing boot partition (kernel)
Download     [=========================] 100%      6144000 bytes
Flashing rootfs, (it can take up to 5 minutes... Please be patient)
Download     [=========================] 100%   1373149184 bytes
Rebooting
U-boot & Kernel System Flash Success...
Your board needs to reboot to complete the flashing procedure, please do not unplug it for 2 minutes.
flashall中に記載の通り途中で5分ほど確かに待つところがあって心配したが最後無事起動
Poky (Yocto Project Reference Distro) 1.7.3 edison ttyMFD2

edison login: root
root@edison:~#

文鎮になりかけた時はだいぶ焦りましたが、とりあえず戻せて良かったです。
ただ何がそうなってしまった原因なのか不明なのでそこを追求しないと。と

最後に一応今後のVerifyのためにMac側、Edison側それぞれの全ログを記載しておきます

Mac側の全ログ

$ pwd
/Users/Myname/Downloads/iot-devkit-prof-dev-image-edison-20160606-patch
$ ls
FlashEdison.json          edison_ifwi-dbg-01-dfu.bin     edison_ifwi-dbg-04.bin          flashall.sh*
edison-image-edison.ext4     edison_ifwi-dbg-01.bin          edison_ifwi-dbg-05-dfu.bin     helper/
edison-image-edison.hddimg     edison_ifwi-dbg-02-dfu.bin     edison_ifwi-dbg-05.bin          ota_update.scr
edison_dnx_fwr.bin          edison_ifwi-dbg-02.bin          edison_ifwi-dbg-06-dfu.bin     package-list.txt
edison_dnx_osr.bin          edison_ifwi-dbg-03-dfu.bin     edison_ifwi-dbg-06.bin          u-boot-edison.bin*
edison_ifwi-dbg-00-dfu.bin     edison_ifwi-dbg-03.bin          filter-dfu-out.js          u-boot-edison.img*
edison_ifwi-dbg-00.bin          edison_ifwi-dbg-04-dfu.bin     flashall.bat               u-boot-envs/
$./flashall.sh
Error: No such keg: /usr/local/Cellar/gnu-getopt
flashall.sh: line 16: gr: command not found
usage: dirname path
flashall.sh: line 49: `print-usage': not a valid identifier
exit 2
$ brew install gnu-getopt
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 3 taps (homebrew/core, homebrew/dupes, homebrew/php).
==> New Formulae
abuse                             fs-uae                            naga                              rogue

==> Downloading https://homebrew.bintray.com/bottles/gnu-getopt-1.1.6.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring gnu-getopt-1.1.6.el_capitan.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"' >> ~/.bash_profile

==> Summary
🍺  /usr/local/Cellar/gnu-getopt/1.1.6: 33 files, 110.4K
$ ./flashall.sh
./flashall.sh: line 16: greadlink: command not found
usage: dirname path
Using U-Boot target: edison-blankcdc
U-boot target edison-blankcdc: /u-boot-envs/edison-blankcdc.bin not found aborting
exit 251
$ brew install greadlink
Error: No available formula with the name "greadlink"
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
Error: No formulae found in taps.
$ brew install coreutils
==> Downloading https://homebrew.bintray.com/bottles/coreutils-8.26.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring coreutils-8.26.el_capitan.bottle.tar.gz
==> Caveats
All commands have been installed with the prefix 'g'.

If you really need to use these commands with their normal names, you
can add a "gnubin" directory to your PATH from your bashrc like:

    PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"

Additionally, you can access their man pages with normal names if you add
the "gnuman" directory to your MANPATH from your bashrc as well:

    MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"

==> Summary
🍺  /usr/local/Cellar/coreutils/8.26: 430 files, 8.5M

$ ./flashall.sh
Using U-Boot target: edison-blankcdc
Now waiting for dfu device 8087:0a99
Please plug and reboot the board
./flashall.sh: line 108: dfu-util: command not found
./flashall.sh: line 108: dfu-util: command not found
./flashall.sh: line 108: dfu-util: command not found
./flashall.sh: line 108: dfu-util: command not found
./flashall.sh: line 108: dfu-util: command not found
./flashall.sh: line 108: dfu-util: command not found
./flashall.sh: line 108: dfu-util: command not found
^C
exit 130
$ brew install dfu-util
==> Installing dependencies for dfu-util: libusb
==> Installing dfu-util dependency: libusb
==> Downloading https://homebrew.bintray.com/bottles/libusb-1.0.21.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libusb-1.0.21.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/libusb/1.0.21: 29 files, 510.5K
==> Installing dfu-util
==> Downloading https://homebrew.bintray.com/bottles/dfu-util-0.9.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring dfu-util-0.9.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/dfu-util/0.9: 10 files, 122.7K
$ ./flashall.sh
Using U-Boot target: edison-blankcdc
Now waiting for dfu device 8087:0a99
Please plug and reboot the board
Flashing IFWI
Download     [=========================] 100%      4194304 bytes
Download     [=========================] 100%      4194304 bytes
Flashing U-Boot
Download     [=========================] 100%       237568 bytes
Flashing U-Boot Environment
Download     [=========================] 100%        65536 bytes
Flashing U-Boot Environment Backup
Download     [=========================] 100%        65536 bytes
Rebooting to apply partition changes
Now waiting for dfu device 8087:0a99
Flashing boot partition (kernel)
Download     [=========================] 100%      6144000 bytes
Flashing rootfs, (it can take up to 5 minutes... Please be patient)
Download     [=========================] 100%   1373149184 bytes
Rebooting
U-boot & Kernel System Flash Success...
Your board needs to reboot to complete the flashing procedure, please do not unplug it for 2 minutes.

Edison側の全ログ

******************************
PSH KERNEL VERSION: b0182b2b
                WR: 20104000
******************************

SCU IPC: 0x800000d0  0xfffce92c

PSH miaHOB version: TNG.B0.VVBD.0000000c

microkernel built 11:24:08 Feb  5 2015

******* PSH loader *******
PCM page cache size = 192 KB
Cache Constraint = 0 Pages
Arming IPC driver ..
Adding page store pool ..
PagestoreAddr(IMR Start Address) = 0x04899000
pageStoreSize(IMR Size)          = 0x00080000

*** Ready to receive application ***


U-Boot 2014.04 (Apr 29 2015 - 03:53:19)

       Watchdog enabled
DRAM:  980.6 MiB
MMC:   tangier_sdhci: 0
In:    serial
Out:   serial
Err:   serial
Hit any key to stop autoboot:  0
boot > run do_flash
Saving Environment to MMC...
Writing to MMC(0)... done
GADGET DRIVER: usb_dnl_dfu
#
DFU complete CRC32: 0x3756edb6
DOWNLOAD ... OK
Ctrl+C to exit ...
#
DFU complete CRC32: 0x3756edb6
DOWNLOAD ... OK
Ctrl+C to exit ...
#
DFU complete CRC32: 0xfe334eda
DOWNLOAD ... OK
Ctrl+C to exit ...
#
DFU complete CRC32: 0xe511e42b
DOWNLOAD ... OK
Ctrl+C to exit ...
#
DFU complete CRC32: 0xe511e42b
DOWNLOAD ... OK
Ctrl+C to exit ...
resetting ...


******************************
PSH KERNEL VERSION: b0182b2b
                WR: 20104000
******************************

SCU IPC: 0x800000d0  0xfffce92c

PSH miaHOB version: TNG.B0.VVBD.0000000c

microkernel built 11:24:08 Feb  5 2015

******* PSH loader *******
PCM page cache size = 192 KB
Cache Constraint = 0 Pages
Arming IPC driver ..
Adding page store pool ..
PagestoreAddr(IMR Start Address) = 0x04899000
pageStoreSize(IMR Size)          = 0x00080000

*** Ready to receive application ***


U-Boot 2014.04 (Jun 06 2016 - 14:40:07)

       Watchdog enabled
DRAM:  980.6 MiB
MMC:   tangier_sdhci: 0
In:    serial
Out:   serial
Err:   serial
Writing to redundant MMC(0)... done
Writing to MMC(0)... done
Hit any key to stop autoboot:  0
Target:blank
Partitioning using GPT
Writing GPT: success!
Saving Environment to MMC...
Writing to redundant MMC(0)... done
Flashing already done...
GADGET DRIVER: usb_dnl_dfu
#
DFU complete CRC32: 0xf8037f87
DOWNLOAD ... OK
Ctrl+C to exit ...
####################################################################################################################################################################
DFU complete CRC32: 0xbc3df0ed
DOWNLOAD ... OK
Ctrl+C to exit ...
resetting ...


******************************
PSH KERNEL VERSION: b0182b2b
                WR: 20104000
******************************

SCU IPC: 0x800000d0  0xfffce92c

PSH miaHOB version: TNG.B0.VVBD.0000000c

microkernel built 11:24:08 Feb  5 2015

******* PSH loader *******
PCM page cache size = 192 KB
Cache Constraint = 0 Pages
Arming IPC driver ..
Adding page store pool ..
PagestoreAddr(IMR Start Address) = 0x04899000
pageStoreSize(IMR Size)          = 0x00080000

*** Ready to receive application ***


U-Boot 2014.04 (Jun 06 2016 - 14:40:07)

       Watchdog enabled
DRAM:  980.6 MiB
MMC:   tangier_sdhci: 0
In:    serial
Out:   serial
Err:   serial
Hit any key to stop autoboot:  0
Target:blank
Partitioning already done...
Flashing already done...
GADGET DRIVER: usb_dnl_dfu
reading vmlinuz
5461344 bytes read in 134 ms (38.9 MiB/s)
Valid Boot Flag
Setup Size = 0x00003c00
Magic signature found
Using boot protocol version 2.0c
Linux kernel version 3.10.98-poky-edison+ (neck@flax) #1 SMP PREEMPT Mon Jun 6 14:32:08 PDT 2016
Building boot_params at 0x00090000
Loading bzImage at address 00100000 (5445984 bytes)
Magic signature found
Kernel command line: "rootwait root=PARTUUID=012b3303-34ac-284d-99b4-34e03a2335f4 rootfstype=ext4 console=ttyMFD2 earlyprintk=ttyMFD2,keep loglevel=4 g_multi.ethernet_config=cdc systemd.unit=multi-user.target hardware_id=00 g_multi.iSerialNumber=b5ce965017e521b5417f35bcd5d6fdc6 g_multi.dev_addr=02:00:86:d6:fd:c6 platform_mrfld_audio.audio_codec=dummy"

Starting kernel ...

[    0.735717] pca953x 1-0020: failed reading register
[    0.740837] pca953x 1-0021: failed reading register
[    0.745968] pca953x 1-0022: failed reading register
[    0.751012] pca953x 1-0023: failed reading register
[    1.617386] snd_soc_sst_platform: Enter:sst_soc_probe
[    2.111910] pmic_ccsm pmic_ccsm: Error reading battery profile from battid frmwrk
[    2.120944] pmic_ccsm pmic_ccsm: Battery Over heat exception
[    2.121028] pmic_ccsm pmic_ccsm: Battery0 temperature inside boundary

Welcome to Linux!

以下省略

Poky (Yocto Project Reference Distro) 1.7.3 edison ttyMFD2

edison login: