How to Flash C.H.I.P Offline

Next Thing Co (NTC), the company that made the $9 C.H.I.P computer, is not doing well: orders are not shipping on time, and support is not answering emails. While the little CHIPs would still work even if NTC no longer exists, same cannot be said for firmware flashing: the recommended method for flashing firmware is through Chrome App developed by NTC, which in turn downloads from NTC's file servers. If Next Thing Co evaporates and their file servers go offline, the Chrome App would not be able to download the firmware, and therefore I cannot re-flash my CHIPs if I ever mess up their operating system.

To keep my C.H.I.Ps working for as long as possible, I have to plan for the inevitable and find out how to flash a CHIP without relying on the Internet, or at least, without relying on the file server. NTC has published some scripts, known as CHIP-tools, to work with CHIP computers. The script is a command line tool to flash the device. While the content of this script is complicated, to make it work offline, I just need to figure out what it needs from NTC file servers, and download these files in advance.

A brief read and tests indicate that has the following workflow:

  1. Verify all necessary programs are available.
  2. Select a flavor according to command line arguments. It is one of server, gui, pocketchip, and buildroot.
  3. Download a latest file that contains the latest firmware version number.
  4. Download SPL, sunxi, and U-Boot images.
  5. Connect to CHIP in FEL mode, and determine whether the CHIP has a Hynix or Toshiba NAND chip.
  6. Download CHIP operating system image that suitable for the NAND chip.
  7. Connect to CHIP in Fastboot mode, and send the operating system image to CHIP.

Files for each flavor is hosted in a different directory on the file server. For server flavor, the files are:

# lastest version

# SPL, sunxi, U-Boot

# CHIP operating system for Hynix NAND

# CHIP operating system for Toshiba NAND

I successfully flashed all four flavors onto a Hynix CHIP, using a Raspberry Pi 3 running Ubuntu Mate 16.04 as the host computer. My steps were:

  1. Clone CHIP-tools repository to $HOME/CHIP/CHIP-tools.
  2. Install Ubuntu packages: sudo apt install android-tools-fastboot sunxi-tools u-boot-tools.
  3. Download SPL, sunxi, U-Boot, and CHIP operating systems images into $HOME/CHIP/stable-server-b149. Internet connection is no longer needed after this step.
  4. Install a LiPo battery on the CHIP, because Raspberry Pi 3's USB port cannot supply enough current for CHIP to operate smoothly.
  5. Ensure CHIP is powered off and not connected to the host computer. Put a jumper wire between FEL and GND pins.
  6. Execute sudo whoami so that the next command won't ask for my password again.
  7. In $HOME/CHIP/CHIP-tools directory, execute FEL='sudo sunxi-fel' FASTBOOT='sudo fastboot' SNIB=false ./ -L ../stable-server-b149.
  8. When waiting for fel...... prompt appears, connect CHIP to the host computer with a microUSB cable.
  9. When FLASH VERIFICATION COMPLETE. message appears, flashing is successful.

NTC file server is still online today, so I can download from them in step 3. As it is going to disappear, I have copied the files to Bintray repository to keep them available. Note that CHIP operating system images in my Bintray mirror are compressed by 7-Zip, and they must be manually decompressed before running script.

Tags: CHIP