Image Update over USB
This procedure makes use of the integrated USB interface (alongside the debug USB port) to update any chosen partition of the ARTIK image.
To use this feature, you must have previously set up a build environment that allows you to create the partitions, or you must have obtained a pre-built partition (such as a custom dtb
block) from a third party.
You have two options on your Linux development system to update firmware:
Board Preparation
-
Connect your board USB debug port to your development system as always.
- Attach a USB cable to the integrated USB device port (Dev or OTG) of the ARTIK board using the appropriate cable.
- standard type A for ARTIK 10 USB Host/Dev
- mini type B for ARTIK 520 USB Dev
- micro USB for ARTIK 530/710 USB OTG
Attach the other end (usually standard type A) to your host PC.
ARTIK 520 ARTIK 530
ARTIK 710ARTIK 1020 - Reset the ARTIK board, and while it is counting down for the restart, hit any key to go to U-Boot mode.
Driver Installation
You may have to set up drivers twice – once under Windows and again for Linux running in VirtualBox under Windows.
Windows
If you are using a Windows PC, follow this procedure to install the base USB driver.
-
On the ARTIK board, to cause the OTG port to switch to Android Debug Bridge (adb) mode, you'll need to give U-Boot either the Fastboot command
fast 0
or the Device Firmware Update command
dfu 0 mmc 0
as explained in the following sections. Windows will not detect a device or install a driver until you do so. -
Wait for the USB driver installation to complete successfully.
Note: During operation, if it gets stuck at "waiting for device", there may be a driver issue – check Device Manager and upgrade the driver if necessary.
Linux
This procedure applies both to a native Linux host, and to a Linux installation running under Windows/VirtualBox.
-
Open or create this
udev
rules file:
sudo vi /etc/udev/rules.d/51-android.rules
-
Insert this line, save, and exit.
SUBSYSTEM=="usb",ATTR{idVendor}=="18d1",MODE="0666"
-
Restart your terminal instance to recognize the change.
Using 'fastboot' to Update Partitions
Install 'fastboot' Tools on Host
Install on Linux host.
- Install the Android
fastboot
tools on your development system.
sudo apt install android-tools-fastboot
Install on Windows host. You don't need to do this if you are running Linux under VirtualBox on a Windows PC.
-
Download
fastboot
tools from here or search for "ADB fastboot" if the link is broken. -
Follow the instructions to install the tools to your Windows host PC.
Procedure
This procedure works from both Windows and Linux command windows.
-
From the U-Boot prompt, run
fast 0
on the ARTIK board to let your PC see the board as a 'fastboot' device.
(On ARTIK 520 or 1020 boards you just usefast
.)
-
Open a terminal window to send 'fastboot' commands.
-
Linux (native or in VirtualBox): Open a terminal window.
-
Windows only (not using VirtualBox): Open a command prompt window
(hit Start, type "cmd" [Enter]).
-
-
Change to the image transfer directory.
-
Linux: Usually your build output directory; see flash_all section.
-
Windows:
cd \adb
Copy here any images that you plan to transfer.
-
-
Check to make sure fastboot can see the ARTIK board as a connected device over USB.
fastboot devices
You should see something like:
710MWC2H10000815 fastboot -
For each partition to update, on the host system:
Enterfastboot flash
, choose a partition, and point to the file to load. Refer to the Partition Details section below for required partition file names.
-
Run
fastboot reboot
on the PC when finished.
Below is an example of the kernel, dtb, and modules being updated.
Using 'flash_all…' to Update Full Image
When you follow the normal build process in your Linux development environment, you will find that all necessary partition maps and partition images are generated automatically in the output directory of your build. For example:
build-artik/output/images/artik530s/1.0/20171115.19/partmap_emmc.txt
Moreover, the flash_all… script is generated in that directory as well. To update a module over USB with your newly generated image:
-
On your development PC, change to the build output directory.
-
Enter:
./flash_all_by_fastboot.sh
-
On your ARTIK board terminal, from the U-Boot prompt, enter:
fast 0
Your image update is underway! Don't forget to take action on the "resize" message displayed when the script finishes.
Partition Details
The steps here are taken care of by the ./flash_all_by_fastboot.sh
script. Refer to the text of that script while reviewing the details provided here.
The partitions listed below comprise the complete image. To restore all, as you would for USB recovery, you start by loading the partition map:
fastboot flash partmap partmap_emmc.txt
and then flash the rest of the partitions.
fastboot flash 2ndboot bl1-emmcboot.img
...
Large partitions are handled as a special case when the file is larger than module RAM. For example, if you get to the rootfs
partition and find it is too large to fit into the available RAM, use this approach.
-
Create a file
partition.txt
on the host system containing the line
partition = "rootfs";
-
Run the following commands.
fastboot flash setenv partition.txt
fastboot flash -S 0 rootfs rootfs.img
ARTIK 530 Partition Information
Partition Name | File Name |
---|---|
2ndboot | bl1-emmcboot.img |
blmon | bl_mon.img |
boot | boot.img |
bootloader | bootloader.img |
env | params.bin |
loader | loader-emmcboot.img |
modules | modules.img |
rootfs | rootfs.img |
secure | secureos.img |
ARTIK 710 Partition Information
Partition Name | File Name |
---|---|
2ndboot | bl1-emmcboot.img |
fip-loader | fip-loader-emmc.img |
fip-secure | fip-secure.img |
fip-nonsecure | fip-nonsecure.img |
env | params_mmcboot.bin |
boot | boot.img |
modules | modules.img |
rootfs | rootfs.img |
Using 'dfu-util' to Update Modules
The ARTIK board firmware supports device update with the dfu command. We'll describe the process in terms of a VirtualBox environment running under Windows.
Refer to the article here for adding modules to or removing them from the image.
Install Device Firmware Update tool on host
You'll need to install and enable dfu-util on your Linux host development system. To do so:
- Install the command
sudo apt install dfu-util
- Follow the instructions in the Installation section to add a Linux udev rule.
Procedure
You'll be able to follow this procedure every time you need to do a firmware update.
-
Connect a USB cable between the USB OTG port of your board and your development PC.
-
Reboot your ARTIK board, but hit a key to stop autoboot to arrive at the U-Boot prompt.
-
On the ARTIK board terminal emulator, enable transfer mode by entering:
dfu 0 mmc 0
You should see something like:
crq->brequest:0x0
Your OTG port is now acting as an Android ADB port (and will show up in Windows Device Manager as Alcatel ADB). -
Capture the USB port (in this case the USB device to capture is "Samsung Electronics USB download gadget")
-
On your Linux development PC, go to your images folder and issue the dfu-util command to list available images. For example:
cd output/images/artik530s/UNRELEASED/20180710.112525/
sudo dfu-util -l
-
Review the list and identify the images you want to transfer. For example:
Found DFU: [18d1:0002] ver=9999, devnum=15, cfg=1, intf=0, alt=13, name="modules", serial="UNKNOWN"
Found DFU: [18d1:0002] ver=9999, devnum=15, cfg=1, intf=0, alt=8, name="/zImage", serial="UNKNOWN"
Found DFU: [18d1:0002] ver=9999, devnum=15, cfg=1, intf=0, alt=6, name="bootloader.img", serial="UNKNOWN"
Found DFU: [18d1:0002] ver=9999, devnum=15, cfg=1, intf=0, alt=5, name="secureos.img", serial="UNKNOWN" -
Transfer the images you need by specifying -a alt and -D name. For example:
sudo dfu-util -a 13 -D modules.img
sudo dfu-util -a 8 -D zImage
-
When finished, reboot your board and use
modprobe <module>
to enable each new module.