第8章 Rewriting Image Files

This chapter explains the procedure for rewriting the image file written to Armadillo-IoT G3's internal storage (eMMC).

Download the lastest version of Imagine file at the following Armadillo site.In case of troubleshoot or function additon, updating of lastest version is recommend.

8.1. Using the Installation Disc

Using the installation disc, all of the images on the internal storage can be rewritten at once. They can be used as a recovery method if Armadillo stops booting due to a software issue.

[警告]

As all image files saved in the internal storage are overwritten, any data or applications already saved there will be deleted.

When rewriting only a specific image, please refer to 「Rewriting Only Specific Image Files」.

The installation disk is created with ATDE. The file used to create the installation disk is shown below.

表8.1 File Used for Creating Installation Disk

FileFile Name
Install disk imageinstall_disk_sd_[version]_iotg3_m1.img

8.1.1. Creating an Installation Disk

  1. Please prepare an SD card with a 512MB or larger capacity.

  2. Connect the SD card to ATDE. For details, refer to「Using Removable Devices」.

  3. Unmount the SD card if it is currently mounted.

    [PC ~]$mount
    (abbreviated)
    /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. Write the installation disk image to the SD card.

    [PC ~]$sudo dd if=install_disk_sd_[version]_[model].img of=/dev/sdb bs=4M
    94+1 records input
    94+1 records output
    397410304 bytes (397 MB) copied, 45.8441 seconds、 8.7 MB/sec
    [PC ~]$sync

8.1.2. Running the Installation

  1. Make sure the Armadillo is powered off. If the power is on, turn it off. Also, be sure to remove the battery if one is connected to 「CON13 RTC Backup Interface 1」.

  2. Check the slide switch of the USB serial converter. Make sure that the slide switch is set to side "1" of 図3.8「Slide Switch Configuration」.

  3. Use the installation disk to perform an SD boot. Insert the installation disk into the SD slot (CON4) and set JP1 to short.

  4. When the Armadillo is powered on while holding User Switch 1 down, the bootloader will start up from the SD card and the following log will be displayed. When the log is displayed, release User Switch 1. For the location of User Switch 1, see 「Armadillo-IoT Gateway Exterior」.

    U-Boot SPL 2016.07-at16 (Jun 18 2018 - 12:04:02)
    Trying to boot from MMC1
    
    
    U-Boot 2016.07-at16 (Jun 18 2018 - 12:04:02 +0900)
    
    CPU:   Freescale i.MX7D rev1.3 at 996MHz
    CPU:   Extended Commercial temperature grade (-20C to 105C) at 31C
    Reset cause: POR
           Watchdog enabled
    I2C:   ready
    DRAM:  1 GiB
    Boot Source: SD
    Board Type: Armadillo-IoT G3 M1(0a000003)
    Revision: 0000
    S/N: 4
    DRAM: 00001e05
    XTAL: 00
    MMC:   FSL_SDHC: 0, FSL_SDHC: 1
    Loading Environment from MMC... *** Warning - bad CRC, using default environment
    
    Failed (-5)
    Loading Environment from MMC... *** Warning - bad CRC, using default environment
    
    Failed (-5)
    In:    serial
    Out:   serial
    Err:   serial
    Found PFUZE300! deviceid 0x30, revid 0x11
    Net:   FEC0
    =>
  5. When the "boot" command is executed as follows, the installation starts and the eMMC are rewritten automatically.

    => boot
    switch to partitions #0, OK
    mmc0 is current device
    switch to partitions #0, OK
    mmc0 is current device
    reading boot.scr
    231 bytes read in 10 ms (22.5 KiB/s)
    Running bootscript from mmc ...
    ## Executing script at 82000000
    switch to partitions #0, OK
    mmc0 is current device
    reading uImage
    10157824 bytes read in 455 ms (21.3 MiB/s)
    Booting from mmc ...
    reading x1-minimal.dtb
    45687 bytes read in 18 ms (2.4 MiB/s)
    ## Booting kernel from Legacy Image at 82000000 ...
       Image Name:   Linux-3.14.79-at21
       Image Type:   ARM Linux Kernel Image (uncompressed)
       Data Size:    10157760 Bytes = 9.7 MiB
       Load Address: 80008000
       Entry Point:  80008000
       Verifying Checksum ... OK
    ## Flattened Device Tree blob at 84800000
       Booting using the fdt blob at 0x84800000
       Loading Kernel Image ... OK
       Using Device Tree in place at 84800000, end 8480e276
    
    Starting kernel ...
    : (省略)
    *+*+* Recovery Start!! *+*+*
    [警告]

    Do not turn off the power supply while running the installation. Board data can be corrupted and unable to recover.

  6. The following message usually shows up after finishing install process. Please power off the device.

    *+*+* Recovery Completed!! *+*+*
    

    After installation is complete, please set JP1 to open.

8.2. Rewriting Only Specific Image Files

Only certain image files can be rewritten when Armadillo-IoT G3 is running.

The image files and their corresponding destinations are shown below.

表8.2 Image Files and their Destinations

Name

File Name

Storage

Device File

Bootloader Image

u-boot-x1-[version].bin

eMMC(Boot partition)

/dev/mmcblk2boot0

Linux Kernel Image

uImage-x1-[version]

eMMC

/dev/mmcblk2p1

Device Tree Blob

armadillo_iotg_g3_m1-[version].dtb

/dev/mmcblk2p1

Debian GNU/Linux Root File System

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

/dev/mmcblk2p2


8.2.1. Rewriting the BootLoader Image

The method of rewriting the bootloader image is shown below.

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

8.2.2. Rewriting the Linux Kernel Image

The method for rewriting the Linux kernel image is shown below.

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

1

Mount the eMMC's first partition to the /mnt/ directory.

2

Copy the Linux kernel image to the /mnt/ directory.

3

Unmount the first partition of the eMMC mounted to the /mnt/ directory.

8.2.3. Rewriting the DTB

The method of rewriting the DTB is shown below.

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

1

Mount the eMMC's first partition to the /mnt/ directory.

2

Copy the DTB to the /mnt/ directory.

3

Unmount the first partition of the eMMC mounted to the /mnt/ directory.

8.2.4. Rewriting the Root File System

The procedure for rewriting the root file system on the eMMC is shown below.

手順8.1 Rewriting the Root File System on eMMC

  1. An SD boot must be performed in order to rewrite the root file system on eMMC. For details on how to create a boot disk and execute an SD boot, see 9章Utilizing SD Booting.

  2. Prepare the Debian GNU/Linux root file system archive.

    [armadillo ~]#ls
    debian-stretch-armhf_aiotg-g3_[version].tar.gz
  3. Recreate the root file system within the second partition of the eMMC.

    [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_aiotg-g3_[version].tar.gz -C /mnt  4
    [armadillo ~]# umount /mnt  5

    1

    Recreate the file system on the second partition of eMMC.

    2

    Enter y and then ENTER.

    3

    Mount the second partition of the eMMC to the /mnt/ directory.

    4

    Extract the root file system archive to the /mnt/ directory.

    5

    Unmount the second partition of the eMMC mounted ot the /mnt/ directory.