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
opensource.nextthing.co file server.
NTC has published some scripts, known as CHIP-tools, to work with CHIP computers.
chip-update-firmware.sh 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
chip-update-firmware.sh has the following workflow:
- Verify all necessary programs are available.
- Select a flavor according to command line arguments. It is one of
- Download a
latestfile that contains the latest firmware version number.
- Download SPL, sunxi, and U-Boot images.
- Connect to CHIP in FEL mode, and determine whether the CHIP has a Hynix or Toshiba NAND chip.
- Download CHIP operating system image that suitable for the NAND chip.
- 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.
server flavor, the files are:
# lastest version http://opensource.nextthing.co/chip/images/stable/server/latest # SPL, sunxi, U-Boot http://opensource.nextthing.co/chip/images/stable/server/149/spl-40000-1000-100.bin http://opensource.nextthing.co/chip/images/stable/server/149/spl-400000-4000-500.bin http://opensource.nextthing.co/chip/images/stable/server/149/spl-400000-4000-680.bin http://opensource.nextthing.co/chip/images/stable/server/149/sunxi-spl.bin http://opensource.nextthing.co/chip/images/stable/server/149/u-boot-dtb.bin http://opensource.nextthing.co/chip/images/stable/server/149/uboot-40000.bin http://opensource.nextthing.co/chip/images/stable/server/149/uboot-400000.bin # CHIP operating system for Hynix NAND http://opensource.nextthing.co/chip/images/stable/server/149/chip-400000-4000-680.ubi.sparse # CHIP operating system for Toshiba NAND http://opensource.nextthing.co/chip/images/stable/server/149/chip-400000-4000-500.ubi.sparse
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:
- Clone CHIP-tools repository to
- Install Ubuntu packages:
sudo apt install android-tools-fastboot sunxi-tools u-boot-tools.
- 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.
- Install a LiPo battery on the CHIP, because Raspberry Pi 3's USB port cannot supply enough current for CHIP to operate smoothly.
- Ensure CHIP is powered off and not connected to the host computer. Put a jumper wire between FEL and GND pins.
sudo whoamiso that the next command won't ask for my password again.
FEL='sudo sunxi-fel' FASTBOOT='sudo fastboot' SNIB=false ./chip-update-firmware.sh -L ../stable-server-b149.
waiting for fel......prompt appears, connect CHIP to the host computer with a microUSB cable.
FLASH VERIFICATION COMPLETE.message appears, flashing is successful.
NTC file server
opensource.nextthing.co 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