A photo of Max Glenister Max Glenister

C.H.I.P. stuff

This page is a changing document. I’ll probably add more notes to it in the future.

These are just some notes that I’ve put together in the past about flashing and upgrading the C.H.I.P. (and Pocket C.H.I.P.) computer.

This device doesn’t have any first party support any more, and it’s not as powerful as Raspberry Pi, but it’s quite fun and the Pocket C.H.I.P form-factor is great. If you can get hold of one, you should!

Erasing and re-flashing the C.H.I.P.

You can erase and factory flash a C.H.I.P. from your computer using this repo. It will completely erase the C.H.I.P., so make sure you have anything important backed up.

First you need to jumper the CHIP in FEL mode. You can do this by connecting the FEL pin to any GND pin:

Next you can clone the repo and run the Flash.sh:

git clone https://github.com/Thore-Krug/Flash-CHIP.git
cd Flash-CHIP
sudo chmod +x Flash.sh
./Flash.sh

Making APT work with a mirror of the NTC APT repository

This will replace the now defunct nextthing.co APT repositories with a mirror provided by chip.jfpossibilities.com

  1. Open /etc/apt/sources.list in your editor
     sudo nano /etc/apt/sources.list
    
  2. replace all instances of opensource.nextthing.co with chip.jfpossibilities.com
  3. remove jessie-updates repositories
  4. change jessie-backports to:
     deb http://archive.debian.org/debian jessie-backports main contrib non-free
     deb-src http://archive.debian.org/debian jessie-backports main contrib non-free
    
  5. Disable apt valid check:
     echo 'Acquire::Check-Valid-Until "0";' | sudo tee /etc/apt/apt.conf.d/10-no-check-valid
    
  6. In /etc/apt/preferences replace opensource.nextthing.co with chip.jfpossibilities.com
  7. Lastly, make sure everything is up to date
     sudo apt update
     sudo apt upgrade
    

Making APT work with a mainline Debian APT repository

This will replace all of the APT repositories with mainline Debian mirrors. This is best done on a fresh install.

  1. Open /etc/apt/sources.list in your editor
     sudo nano /etc/apt/sources.list
    
  2. Replace all lines of sources.list with the following (you can use a more local mirror rather than the ftp.uk.debian.org if you prefer):
     deb http://ftp.uk.debian.org/debian/ jessie main contrib non-free
     deb-src http://ftp.uk.debian.org/debian/ jessie main contrib non-free
    
     deb http://ftp.uk.debian.org/debian/ jessie-updates main contrib non-free
     deb-src http://ftp.uk.debian.org/debian/ jessie-updates main contrib non-free
    
     deb http://security.debian.org/ jessie/updates main contrib non-free
     deb-src http://security.debian.org/ jessie/updates main contrib non-free
    
  3. Make sure everything is up to date and install apt-transport-https as it will likely be missing
     sudo apt update
     sudo apt upgrade
     sudo apt install apt-transport-https
    
  4. Generate missing locales:
     sudo apt install locales
     sudo locale-gen en_US en_US.UTF-8 
     sudo dpkg-reconfigure locales          
     sudo dpkg-reconfigure tzdata    
    

Don’t bother trying to dist-upgrade to a newer Debian version as it tends to break stuff. 🤷

Installing a newer (> 3.7) version of Cmake on the C.H.I.P

  1. Remove any version of cmake installed from apt
     sudo apt remove --purge --auto-remove cmake
    
  2. Download the “Unix/Linux Source” tar.gz from https://cmake.org/download/ (I’ve used the 3.15.0-rc1 — so long as it’s newer than 3.7 you should be fine)
  3. Decompress the tar.gz somewhere and cd to it.
  4. Start the initial bootstrap
     ./bootstrap
    
  5. Set up a swapfile so that we can run make with our limited resources on the C.H.I.P
     sudo su -
     dd if=/dev/zero of=/tmp/swapfile bs=1024 count=1048576 # 1gb swap file
     mkswap /tmp/swapfile
     chmod 600 /tmp/swapfile
     losetup /dev/loop0 /tmp/swapfile # create a loopback so we can use it
     swapon /dev/loop0
    
     #double check that it is mounted
     cat /proc/swaps
    
  6. Start the build
     make -j2 # j4 caused the CHIP to hang
     # will take a couple of hours...
     sudo make install
    
  7. After that, check that the new version of cmake is installed and working
     cmake --version
    

About the author

A photo of Max Glenister

Max Glenister

Max Glenister is a Front-end Developer based in Oxfordshire. For work he spends his time designing, validating and implementing user interfaces. For fun he tinkers with Virtual Reality, 3D printing, embedded systems, game development and many other things.

You can keep up with Max on Github, Twitter and Reddit

Comments

    There are no comments yet! You can add a comment using Github issues.