Custom ARTIK 710 Images

Aaron Heise
Hi-Z Labs
Published in
4 min readMar 2, 2018

In this second article in a series of unknown breadth or depth about building devices based on Samsung ARTIK, I’m going to give an overview of the things I learned, especially some things I wish would have been easier to find, while building custom boards around Samsung ARTIK. I have only used the 710 module, so I’m not going to be able to speak to those directly, but there is surely a fair amount of crossover.

This is a living brain dump article. As I learn more, I’ll fill in more detail. And hopefully organize it a bit. In other articles I cover the kernel, boot loader, OS, and circuit board design aspects of custom ARTIK 710 boards.

The image building process is shell scripts, and assumes you want Ubuntu. If you were hoping to use Yocto or buildroot to cook a distribution, plan to do some work. I had assumed that there would be a Yocto BSP for ARTIK, and I was wrong.

The shell scripts have a surprising amount of options. It looks like the build-artik kit is the tool that Samsung uses to produce the official releases. With the stock release.sh script you can select from different OS versions (to some extent), select different boot modes (SD boot vs. SD fuse)

To use the build-artik kit, you need to clone several repos. To use the build-artik kit, clone build-artik, linux-artik, u-boot-artik, and boot-firmwares-artik710 repositories into the same folder. Be sure to checkout the appropriate branch (A710_os_3.0.0 when I wrote this). Then you can run release.sh.

The boot process has several stages even before U-Boot. Because of the secure boot features, there’s some stuff that has to happen before ARTIK is willing to boot your code. That’s what the boot-firmwares-artik710 biz is all about. The source code for some of those images is available in the bl1-artik710 repository.

SD Fuse is an ARTIK-specific process. When I first read it, I thought it was some sort of open process used by other systems, but no. It’s just what Samsung calls the process they use to transfer new images (specifically the RootFS) into eMMC.

SD Fuse is a two-step process. This is probably splitting hairs, but it has important implications for deeper customizations. Samsung has a custom U-Boot command called sd_recovery in their branches of U-Boot. This command reads a text file (such as partmap_emmc.txt) with partitioning and imaging instructions and sets up the partition table and writes the images to eMMC.

However, it does not write the RootFS. This is for two reasons: the Samsung version of sd_recovery reads the entire image into SDRAM, then writes it — which means that it is limited to images that fit in memory. Also, sd_recovery only supports either raw image writes, or writing a compressed EXT4 image. I don’t know the details of the “compressed EXT4 image”, but Samsung apparently found it a better fit to write the RootFS from Linux. After sd_recovery completes, the kernel is booted using the uInitrd, which has scripts to image the RootFS from a tar.gz archive, and also applies any ZigBee firmware updates.

While working on porting Mender to ARTIK 710, I modified the sd_recovery command to support writing images in chunks, but it doesn’t support compression. This means that the image files are over 2 GB. That’s not a deal breaker when most devices will be updated by Mender and SD images will only be used for emergency recovery.

ARTIK is picky about partitioning. As mentioned above, the boot-firmwares-artik710 repository, there are some partmap_emmc*.txt files that inform the sd_recovery process of the partitions and image files needed to format the eMMC. This is a pretty cool process and works great to set up the very specific offsets needed for the bootloaders and U-Boot environment.

BUT…the SD Fuse scripts in uInitrd don’t use the partition map for imaging. Instead, the partition numbers are hardcoded. This has big implications for partitioning customizations. Essentially, either you do it Samsung’s way, or you’re on your own.

SD Fuse process (From ARTIK Linux Architecture Guide, v1.05)

OTA is mostly package based and not part of the release process. I expected the OTA to send down images, and I guess I have no good reason for thinking that — must be hopeful thinking. The Samsung process for OTA on ARTIK is to make a json file that describes the packages to be installed. You can also send images for new Boot and Modules partitions, for which there are two slots.

More to come!

I’ll keep updating this as stuff comes to mind and/or I have time to add on. Let me know if you have any questions you’d like to see answered here.

--

--

Aaron Heise
Hi-Z Labs

An average Midwest nerd who can’t stop making things.