第8章 Rewriting Image Files

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

The bootloader image files used in this chapter are included on the development set DVD. The latest versions of the files can be downloaded from the "Armadillo site". As over time new functionality is added and defects are fixed, we recommend checking if versions newer than that on the DVD have been released or not and then using the latest version.

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].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].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 2014.04-at2 (Jun 12 2016 - 17:47:04)
    
    CPU:   Freescale i.MX7D rev1.1 at 792 MHz
    CPU:   Temperature: can't get valid data!
    Reset cause: POR
    I2C:   ready
    DRAM:  512 MiB
    MMC:   FSL_SDHC: 0, FSL_SDHC: 1
    In:    serial
    Out:   serial
    Err:   serial
    Found PFUZE300! deviceid 0x30, revid 0x11
    Board Type: Armadillo-IoT G3(0a000000)
    Revison: 0002
    S/N: 2000
    DRAM: 00001d05
    XTAL: 00
    Net:   FEC0
    Normal Boot
    =>
  5. When the "boot" command is executed as follows, the installation starts and the eMMC and QSPI are rewritten automatically.

    => boot
    mmc0 is current device
    mmc0 is current device
    reading boot.scr
    ** Unable to read file boot.scr **
    reading uImage
    9301216 bytes read in 501 ms (17.7 MiB/s)
    Booting from mmc ...
    reading armadillo_iotg_g3.dtb
    52708 bytes read in 20 ms (2.5 MiB/s)
    ## Booting kernel from Legacy Image at 80800000 ...
       Image Name:   Linux-3.14.38-at2
       Image Type:   ARM Linux Kernel Image (uncompressed)
       Data Size:    9301152 Bytes = 8.9 MiB
       Load Address: 80008000
       Entry Point:  80008000
       Verifying Checksum ... OK
    ## Flattened Device Tree blob at 83000000
       Booting using the fdt blob at 0x83000000
       Loading Kernel Image ... OK
       Using Device Tree in place at 83000000, end 8300fde3
    
    Starting kernel ...
    : (abbreviated)
    *+*+* Recovery Start!! *+*+*
  6. The following message will be displayed and installation is complete once automatically halted.

    *+*+* Recovery Completed!! *+*+*
    
    System is going down for system reboot now.
    
    Starting local stop scripts.
    Syncing all filesystems: done
    Unmounting all filesystems: done
    The system is going down NOW!
    Sent SIGTERM to all processes
    Sent SIGKILL to all processes
    Requesting system halt
    reboot: System halted
    

    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

QSPI Flash memory

/dev/mtdblock0

Linux Kernel Image

uImage-x1-[version]

eMMC

/dev/mmcblk2p1

Device Tree Blob

armadillo_iotg_g3-[version].dtb

/dev/mmcblk2p1

Debian GNU/Linux Root File System

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

/dev/mmcblk2p2


8.2.1. Rewriting the BootLoader Image

The method of rewriting the bootloader image is shown below. It is done by writing the image file directly to the MTD block device.

[armadillo ~]#dd if=u-boot-x1-[version].bin of=/dev/mtdblock0 1
282+1 records in
282+1 records out
288816 bytes (289 kB) copied, 5.4582 s, 52.9 kB/s
[armadillo ~]$sync

1

Write the bootloader image at the beginning of the MTD block device.

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-[version].dtb /mnt/armadillo_iotg_g3.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-jessie-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
    ...(abbreviated)...
    
    [armadillo ~]# mount -t ext4 /dev/mmcblk2p2 /mnt  3
    [armadillo ~]# tar zxf debian-jessie-armhf_aiotg-g3l_[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.