Skip to content

Instantly share code, notes, and snippets.

@prashantkamdar
Last active November 24, 2025 19:49
Show Gist options
  • Select an option

  • Save prashantkamdar/81532f9f0cb7852c24429d8fa5aff84c to your computer and use it in GitHub Desktop.

Select an option

Save prashantkamdar/81532f9f0cb7852c24429d8fa5aff84c to your computer and use it in GitHub Desktop.

Update your CHIP / PocketCHIP to the latest Debian 11 (bullseye)

Why should you?

Well, CHIP & PocketCHIP shipped with the now ancient Debian 8 (jessie) and really old kernel 4.4. There's a big security risk if you take your device online in any meaningful way.

Not just that, the software support from various app developers stopped a long time ago.

Refer to this release schedules and this page for LTS support information

How to flash?

Thanks to @macromorgan, updating your CHIP / PocketCHIP is extremely easy.

  1. Backup any important data you might have on your CHIP computer since we are going to completely erase the NAND (storage).

  2. Download this ISO (courtsey of discord user A13).

  3. Create a bootable USB drive using the above ISO using your favorite program (rufus, etc).

  4. Download flashing tools & flash image (courtsey of macroalpha).

  5. untar for the tar'ed files above (tar -xvf filename.tar.bz2).

  6. Take another USB drive and copy the "nand.ubi", "boot.scr", and "erase_my_nand" file from the flash_image_v2 folder to the root of a FAT32 formatted USB flash drive.

  7. Take yet another USB drive and copy the contents of flash_tool_v2 into it.

  8. pendrives

  9. Boot your computer using the bootable USB drive (step #2) and connect the pen drive with flashing tools (step #6) to it.

  10. While the CHIP/PocketCHIP is off, put it in FEL mode (connect the FEL and ground pins).

  11. If you're using a PocketCHIP then no need to remove it from the case. pocketchipfel

  12. Connect the CHIP/PocketCHIP to the computer using a micro USB cable and then power it on.

  13. On the computer, navigate to the USB drive with flashing tools in it and run the "flash_device.sh" script (you may need to run as root). This will update the bootloader on your device and automatically install the correct SPL stage. bootloader

  14. The CHIP/PocketCHIP will shut down automatically after flashing the bootloader (should take no more than 1 minute).

  15. Now, remove the FEL jumper & plug in the USB drive with the boot.scr, nand.ubi, and erase_my_nand files (step #5). Then turn on the device. The device will take several minutes to write the new image to the NAND. You can see the progress by monitoring the white LED; if it's off it means the device is writing the image to the NAND, if it's on it means the device is reading the image from USB or performing other steps. When flashing completes, it will shut itself down.

  16. Remove the USB drive and switch on the CHIP/PocketCHIP.

  17. On the login prompt, type user & password as "chip" (without the double quotes). OPTIONAL: Verify the flash was success with the uname -a command.

uname

Making it usable

  1. First let's connect to the internet. $ sudo nmcli dev wifi connect "network-ssid" password "network-password" Replace the network-ssid and "network-password" with your own wifi's credentials.

  2. Update & upgrade sudo apt update && sudo apt upgrade

  3. If you're using a PocketCHIP, some keys will not work. To make them work install kbd. sudo apt install kbd

  4. OPTIONAL: Install whatever other packages you need.

Miscellaneous info

Following information is gathered based on the conversations on the discord channel mainly between macroalpha and others

  • To check the battery percentage on the PocketCHIP upower --enumerate, then upower -i /path/to/display/device/enumerated or cat /sys/class/power_supply/some_battery_device/capacity

  • How many bad eraseblocks are too many? 51 or more for the Toshiba 123 or more for the Hynix

  • Can you do anything after you've flashed it all to ensure more longetivity of the NAND? Just about everything you can do is already done. UBIFS disables access timestamps, there is no (physical) swap, logging to disk was disabled, etc. The only other things you might do/consider are adding some entries to fstab to set some folders to tmpfs.

  • When the device boots it basically goes like this:

    1. BROM starts. It checks if it should boot into FEL mode immediately because a GPIO is pulled down (when you short that FEL pin this is what you're doing). It then checks all the different ways it can boot for a special signature and if it finds one it attempts to boot from it. If it can't find anything it starts FEL mode.
    2. BROM jumps over to U-Boot. U-Boot is divided into 2 programs, the "secondary program loader" also known as the SPL; and U-Boot proper (also known as just "U-Boot"). The SPL starts by doing things like setting all the hardware up the way it should be, and then looks for the main U-Boot image. If it finds it, then it jumps over to the main U-Boot image. SPL is required because when the device starts up it doesn't have its RAM configured yet, so you need a very tiny program that can use very little memory (the system cache is really all you have at this stage, and we're talking kilobytes).
    3. U-Boot then does its thing by initializing the remainder of the hardware. It checks each boot device to see if it finds valid boot files, and if it does then it jumps over to boot those files. U-Boot can also run special programs like fastboot (which is the program Android and other embedded devices use to flash their firmware) instead of booting Linux.
    4. U-Boot grabs the Linux kernel image, the devicetree (which is a special file that describes all the hardware), and if present the RAM disk image, then hands control over to Linux, at which point Linux is now in charge.
    5. The BROM sets up a very tiny bit of hardware and hands things over to SPL, which sets up more hardware and hands things over to U-Boot, which sets up the rest of the hardware and hands things over to Linux. BROM is read only memory, it's programmed at the factory and cannot be undone/erased/modified. SPL, U-Boot, and Linux all reside on the device's NAND and can be modified The BROM is able to start a special mode called FEL which allows you to copy arbitrary programs (like U-Boot) to memory and run them. So instead of BROM reading SPL/U-Boot from the device it gets fed those files via USB.
@Slade1972
Copy link

Slade1972 commented Oct 17, 2025

@paulolc - Technically you can do it with just 2. You'll always need 2, given that 1 of the USB drives is used to boot into the Linux / Ubuntu image. The other one can house both sets of files, it'll just mean removing the drive from the computer to put into the CHIP for the last part.

For what it's worth, this does not work on my CHIP/Pocket CHIP. The steps will work (although with some issues), but when I reboot after the final step, the Pocket CHIP screen backlight comes on and nothing is displayed on the screen.

I couldn't get the Linux image to read the flash script directly from the USB drive, and had to copy the files to the Ubuntu desktop. It'll flash the CHIP after that. The last step seems to work, with the USB drive in the CHIP itself, and takes a few minutes to flash. Turning it back on again, unfortunately doesn't boot the CHIP correctly. Looks like I'm going back to the original OS. Thanks for the write up though.

Edit: If you have the Hynix flash memory on your CHIP, this doesn't appear to work as indicated in the macromorgan link.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment