第6章 ソフトウェアの更新と初期化

Armadillo-IoT G3L は工場出荷状態で、動作確認に必要な全てのソフトウェアが書き込まれています。 しかし、ソフトウェアはセキュリティアップデートや新機能の追加によって随時アップデートを実施しているため、 開発、評価を行う際は最新バージョンのソフトウェアを利用いただくことを推奨します。

本章では Armadillo のソフトウェアを最新の状態に更新する方法と、ソフトウェアを初期化する方法を説明します。

本章で使用する最新版のブートローダーイメージやLinuxカーネルイメージなどは、"Armadillo サイト"からダウンロードすることができます。

6.1. ソフトウェアを最新の状態に更新する

工場出荷状態のArmadilloに書き込まれているイメージファイルは、最新版ではない可能性があります。本章では Armadillo のソフトウェアを最新の状態に更新する方法を説明します。

ソフトウェアと書き込み先の対応を次に示します。ソフトウェアは、予めArmadillo上にダウンロードしてください。

表6.1 ソフトウェアと書き込み先の対応

名称

ファイル名

ストレージ

デバイスファイル

ブートローダーイメージ

u-boot-x1-[version].bin

eMMC(ブートパーティション), SPIフラッシュメモリ

/dev/mmcblk2boot0, /dev/mtdblock0

Linuxカーネルイメージ

uImage-x1-[version]

eMMC

/dev/mmcblk2p1

Device Tree Blob

armadillo_iotg_g3l-[version].dtb

/dev/mmcblk2p1

Debian GNU/Linuxルートファイルシステム

debian-stretch-armhf_aiotg3l_[version].tar.gz

/dev/mmcblk2p2


6.1.1. ブートローダーイメージの更新

ブートローダーイメージの更新方法を次に示します。

[armadillo ~]$ x1-bootloader-install u-boot-x1-[version].bin
Erasing /dev/mmcblk2boot0....done
Writing u-boot-x1.bin to /dev/mmcblk2boot0....done

6.1.2. Linuxカーネルイメージの更新

Linuxカーネルイメージの更新方法を次に示します。

[armadillo ~]# mount -t vfat /dev/mmcblk2p1 /mnt  1
[armadillo ~]# cp uImage-x1-[version] /mnt/uImage  2
[armadillo ~]# umount /mnt  3

1

eMMCの第1パーティションを/mnt/ディレクトリにマウントします。

2

Linuxカーネルイメージを/mnt/ディレクトリにコピーします。

3

/mnt/ディレクトリにマウントしたeMMCの第1パーティションをアンマウントします。

6.1.3. DTBの更新

DTBの更新方法を次に示します。

[armadillo ~]# mount -t vfat /dev/mmcblk2p1 /mnt  1
[armadillo ~]# cp armadillo_iotg_g3l-[version].dtb /mnt/armadillo_iotg_g3l.dtb  2
[armadillo ~]# umount /mnt  3

1

eMMCの第1パーティションを/mnt/ディレクトリにマウントします。

2

DTBを/mnt/ディレクトリにコピーします。

3

/mnt/ディレクトリにマウントしたeMMCの第1パーティションをアンマウントします。

6.1.4. Debian GNU/Linux ルートファイルシステムの更新

Debian GNU/Linux ルートファイルシステムを更新する方法は2つあります。Debian パッケージをアップデートする方法と、ルートファイルシステムをすべて書き換える方法です。

Debian パッケージのセキュリティアップデートやバグフィックスをArmadilloに適用したい場合は 「Debian パッケージのアップデート」を行ってください。 Armadillo上のルートファイルシステムを工場出荷時相当に書き換えたい場合は 「ルートファイルシステムの書き換え」 を行ってください。

6.1.4.1. Debian パッケージのアップデート

apt-get コマンドを使用して Debian パッケージのアップデートを行います。apt-get update でローカルに持っているパッケージのリストを最新のものに更新し、apt-get upgrade で更新可能なパッケージをすべてインストールします。

apt-get コマンドを使用するには、ネットワーク(インターネット)に接続されている必要があります。ネットワークの設定方法については「ネットワーク」を参照してください。

[armadillo ~]# apt-get update
[armadillo ~]# apt-get upgrade

図6.1 Debian パッケージのアップデート


6.1.4.2. ルートファイルシステムの書き換え

eMMC上のルートファイルシステムを書き換える手順を次に示します。

手順6.1 eMMC上のルートファイルシステムを書き換える

  1. eMMCをルートファイルシステムとしている場合、マウントしているルートファイルシステム自体の書き換えはできません。このため、今回は例としてSD ブートディスクから起動し書き換えを行います。ブートディスクの作成方法やSDブートの実行方法ついては15章SDブートの活用を参照してください。

  2. Debian GNU/Linuxルートファイルシステムアーカイブを準備しておきます。

    [armadillo ~]# ls
    debian-stretch-armhf_aiotg3l_[version].tar.gz
  3. ルートファイルシステムをeMMCの第2パーティションに再構築します。

    [armadillo ~]# mkfs.ext4 /dev/mmcblk2p2  1
    mke2fs 1.42.12 (29-Aug-2014)
    /dev/mmcblk2p2 contains a ext4 file system
    	last mounted on /root on Thu Jan  1 09:00:07 1970
    Proceed anyway? (y,n) y  2
    ...[省略]...
    
    [armadillo ~]# mount -t ext4 /dev/mmcblk2p2 /mnt  3
    [armadillo ~]# tar zxf debian-stretch-armhf_aiotg3l_[version].tar.gz -C /mnt  4
    [armadillo ~]# umount /mnt  5

    1

    eMMCの第2パーティションのファイルシステムを再構築します。

    2

    y に続きENTERを入力します。

    3

    eMMCの第2パーティションを/mnt/ディレクトリにマウントします。

    4

    ルートファイルシステムアーカイブを/mnt/ディレクトリに展開します。

    5

    /mnt/ディレクトリにマウントしたeMMCの第2パーティションをアンマウントします。

  4. Armadillo-IoT G3Lの内蔵ストレージ(eMMC及びQSPIフラッシュメモリ)から起動するために、次のようにコマンドを実行しArmadilloを終了させます。「System halted.」と表示されたのを確認してから電源を切断します。

    [armadillo ~]# halt
  5. JP1をオープンにしてから、電源を投入してください。

  6. 次のように"boot"コマンドを実行すると、書き換えたルートファイルシステムで起動します。必要に応じて「Debian パッケージのアップデート」を行ってください。

    => boot

6.2. ソフトウェアを初期化する

インストールディスクを使用すると、内蔵ストレージ上のすべてのソフトウェアをまとめて書き換えることができます。 すべてのソフトウェアを初期化したい場合や、ソフトウェアの問題や作業の誤りによって Armadillo が起動しなくなった場合の復旧方法などにご使用頂けます。

[警告]

内蔵ストレージに保存されている、すべてのイメージファイルが上書きされるため、既に保存されているデータやアプリケーションなどは削除されます。

特定のイメージのみ書き換えたい場合には 「ソフトウェアを最新の状態に更新する」 を参照してください。

インストールディスクの作成には、SDカードに書き込むためのインストールディスクイメージが必要です。

表6.2 インストールディスク作成に使用するイメージファイル

ファイルファイル名
インストールディスクイメージ(EC25-J搭載品用)install_disk_sd_[version]_iotg3l.img

6.2.1. インストールディスクイメージの作成

ここでは、インストールディスクイメージ作成ツールを使用し、インストールディスクイメージを作成する方法を示します。

インストールディスクイメージはATDEで作成します。インストールディスクイメージ作成ツールを、以下の手順に従い実行してください

  1. 必要なパッケージのインストール及び展開を行います。

    [PC ~]$ sudo apt-get update && sudo apt-get install u-boot-tools
    [PC ~]$ tar xf make_install_disk_image-[version].tar.gz
    [PC ~]$ cd make_install_disk_image
    [PC ~/make_install_disk_image]$ 
  2. ツールの使用方法を確認します。

    [PC ~/make_install_disk_image]$ sudo ./build.sh
    Usage: sudo ./build.sh BOARD UBOOT KERNEL DTB USERLAND
    
    BOARD: x1/iotg3/iotg3_m1/iotg3l
    UBOOT: u-boot image
    KERNEL: uImage
    DTB: Device Tree Blob image
    USERLAND: Debian userland archive

    ツールで指定する引数と、インストールディスクイメージの作成に必要なファイルの対応を次に示します。

    表6.3 イメージファイルと引数の対応

    引数

    説明

    ファイル名称

    BOARD

    iotg3l を指定

    -

    UBOOT

    ブートローダーイメージ

    u-boot-x1-[version].bin

    KERNEL

    Linuxカーネルイメージ

    uImage-x1-[version]

    DTB

    Device Tree Blob

    armadillo_iotg_g3l-[version].dtb

    USERLAND

    Debian GNU/Linuxルートファイルシステム

    debian-stretch-armhf_aiotg3l_[version].tar.gz


    これらのファイルは、Armadillo サイトでダウンロードすることができるほか、11章ビルド手順でビルドしたファイルを使用することも可能です。

  3. 使用するイメージを指定し、インストールディスクイメージを作成します。

    [PC ~/make_install_disk_image]$ sudo ./build.sh iotg3l u-boot-x1-[version].bin uImage-x1-[version] armadillo_iotg_g3l-[version].dtb debian-stretch-armhf_aiotg3l_[version].tar.gz
    Image Name:
    Created:      Thu Nov 15 15:54:00 2018
    Image Type:   ARM Linux Script (uncompressed)
    Data Size:    167 Bytes = 0.16 kB = 0.00 MB
    Load Address: 00000000
    Entry Point:  00000000
    Contents:
       Image 0: 159 Bytes = 0.16 kB = 0.00 MB
    0+0 レコード入力
    0+0 レコード出力
    0 bytes copied, 6.6523e-05 s, 0.0 kB/s
    
    Welcome to fdisk (util-linux 2.29.2).
    Changes will remain in memory only, until you decide to write them.
    Be careful before using the write command.
    
    Device does not contain a recognized partition table.
    Created a new DOS disklabel with disk identifier 0xf7a08a85.
    
    Command (m for help): Partition type
       p   primary (0 primary, 0 extended, 4 free)
       e   extended (container for logical partitions)
    Select (default p): Partition number (1-4, default 1): First sector (2048-854015, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-854015, default 854015):
    Created a new partition 1 of type 'Linux' and of size 13 MiB.
    
    Command (m for help): Partition type
       p   primary (1 primary, 0 extended, 3 free)
       e   extended (container for logical partitions)
    Select (default p): Partition number (2-4, default 2): First sector (28672-854015, default 28672): Last sector, +sectors or +size{K,M,G,T,P} (28672-854015, default 854015):
    Created a new partition 2 of type 'Linux' and of size 403 MiB.
    
    Command (m for help): Partition number (1,2, default 2): Partition type (type L to list all types):
    Changed type of partition 'Linux' to 'W95 FAT32'.
    
    Command (m for help): The partition table has been altered.
    Calling ioctl() to re-read partition table.
    Syncing disks.
    
    mkfs.fat 4.1 (2017-01-24)
    mke2fs 1.43.4 (31-Jan-2017)
    Discarding device blocks: done
    Creating filesystem with 412672 1k blocks and 103224 inodes
    Filesystem UUID: 098c113e-ba13-4d98-bd23-e23360f0cf7c
    Superblock backups stored on blocks:
        8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
    
    Allocating group tables: done
    Writing inode tables: done
    Creating journal (8192 blocks): done
    Writing superblocks and filesystem accounting information: done
    
    368+1 レコード入力
    368+1 レコード出力
    376936 bytes (377 kB, 368 KiB) copied, 0.0378821 s, 10.0 MB/s
    [PC ~/make_install_disk_image]$ 
  4. ツールの実行が終了すると、インストールディスクイメージが作成されていることを確認できます。

    [PC ~/make_install_disk_image]$ ls install_disk_sd_*.img
    install_disk_sd_[version]_[model].img

6.2.2. インストールディスクの作成

  1. 512 MB以上のmicroSDカードを用意してください。

  2. ATDE に microSD カードを接続します。詳しくは「取り外し可能デバイスの使用」を参照してください。

  3. microSD カードがマウントされている場合、アンマウントします。

    [PC ~]$ mount
    (省略)
    /dev/sdb1 on /media/atmark/B18A-3218 type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0077,codepage=437,iocharset=utf8,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)
    [PC ~]$ sudo umount /dev/sdb1
  4. microSD カードにインストールディスクイメージを書き込みます。

    [PC ~]$ sudo dd if=install_disk_sd_[version].img of=/dev/sdb bs=4M
    94+1 レコード入力
    94+1 レコード出力
    397410304 バイト (397 MB) コピーされました、 45.8441 秒、 8.7 MB/秒
    [PC ~]$ sync

6.2.3. インストールの実行

  1. 電源が切断されていることを確認します。接続されていた場合は、電源を切断してください。

  2. USBシリアル変換アダプタをArmadillo-IoTから切断します。USBシリアル変換アダプタを接続した状態でインストールを実行したい場合は、スライドスイッチを図4.17「スライドスイッチの設定」の 2 側(オートブートモード)に設定してください。

  3. インストールディスクを使用してSDブートを行います。microSDスロット(メインユニットCON12)にインストールディスクを接続し、JP1をショートに設定してください。

  4. Armadillo に電源を投入します。Armadilloが起動するとインストールが始まり、自動的にeMMCとQSPIが書き換えられます。インストールの実行中は電源を切断しないでください。

  5. インストールの進捗状況はユーザーLEDで確認することができます。インストールの進捗状況とユーザーLEDの状態を次に示します。ユーザーLEDの位置については図7.44「ユーザーLEDの位置」を参照してください。

    表6.4 インストールの進捗状況とユーザーLEDの状態

    インストールの進捗ユーザーLED4ユーザーLED3ユーザーLED5
    起動中点灯消灯消灯
    実行中点灯間欠点灯消灯
    正常終了点灯点灯点灯
    異常終了間欠点灯間欠点灯間欠点灯

  6. インストールが終了したら、電源を切断し、JP1をオープンに設定してください。