I have a lot to say about a outdoor wireless project I’m working on which dovetails into a lot of commentary about C.H.I.P. boards but I haven’t written all that yet. This post, instead, will focus on how I finally successfully flashed the firmware on a C.H.I.P. board from my Fedora laptop.
I bought two C.H.I.P. boards to tinker with. Almost immediately, and without real reason, I made them both inoperable by attempting to flash the firmware on them. Again, I had no reason for this, I hadn’t even gotten to see what they were all about yet. But, for seemingly months, the boards would just sit there, powered but not booted. I thought I had tried everything to get them running again and became very frustrated.
This is a good time for a disclosure: I have no idea what I’m doing. This is very related to protocols and processes that I am not familiar with and what I’ve done thus far is basically wandered around in the dark and I have finally gotten back to where I began. To be completely honest, I’m not even sure what I’ve done; maybe I flashed the firmware, maybe I didn’t. But I can at least get this thing to a “booted” state with an OS on it. So please feel free to point out any idiotic moves I’ve made and help me learn about the errors in my ways.
To make things complicated, I’m not attacking this in the prescribed method, see, all the (great) documentation is focused on using Ubuntu for flashing/accessing it. But I don’t use Ubuntu (although I attempted using a live Ubuntu USB, a vagrant VM, a Raspberry Pi with Ubuntu, using the Chrome extension on various computers, etc etc). So in addition to not knowing what I was doing, I also had to try to translate all the great posts to Fedora.
Unfortunately, through all of the iterations I can’t say for certain if I’ve actually installed more that what I’ve captured below or not. A lot of my flailing, while it didn’t get me to the point I’m at now, may have included installing something else that I don’t recognize as relevant.
For this post, I am working with the following, please modify for your own use as appropriate:
I have attempted to recreate these steps on a Fedora 25 VM but I still don’t have 100% confidence. All that to say, good luck:
01 Install some prerequisites
I’m not really sure what is necessary or what you’ve already got installed, but here are some packages that will be used:
sudo dnf install -y android-tools gcc git screen sunxi-tools uboot-tools
02 Grab hadess repository and make
For a reason that I do not understand, I got this to work by :
git clone https://github.com/hadess/CHIP-tools.git cd CHIP-tools make sudo cp -v spl-image-builder.o /usr/bin/sunxi-nand-image-builder sudo chmod +x /usr/bin/sunxi-nand-image-builder cd ~ rm -vfr CHIP-tools
NOTE: using the prescribed online method was specific to Ubuntu and led me down a rabbit hole of git repositories in order to get/create the
sunxi-nand-image-builder binary. So instead, I’m making it from whatever work hadess did…
03 Grab the official CHIP-tools repository
Now use the official repository to do the flashing with all the current versions (the step above allows us to use the magic hadess binary):
git clone https://github.com/NextThingCo/CHIP-tools.git cd CHIP-tools
04 Prepare C.H.I.P. for flashing
Prior to running the flash command, ensure that your C.H.I.P. board is jumpered for “fel” as noted in the documentation and seen here in a picture hosted by NextThingCo:
05 Flash the firmware
I wasn’t sure how important timing was here but, without the C.H.I.P. plugged in, start the command of your choice (I’m going to flash it with a GUI-less OS):
sudo ./chip-update-firmware.sh -s
Use your USB cable to plug in the C.H.I.P. when the script outputs the following message:
waiting for fel...
NOTE: if you have not run this before or are flashing a new version, there will be a few downloads prior to the
waiting for fel message. It will print that message a few times, so you will panic, but just let it go. Also, use
sudo ./chip-update-firmware.sh -h to see all the options.
06 Reboot and log in over USB
It is very likely that this will take a while. But once the script finishes unplug your USB cable from the C.H.I.P., remove the fel jumper, plug the cable back in to power it on. If all went as expected, you should now be able to access your C.H.I.P. board over the USB cable using
screen /dev/ttyACM0 115200
NOTE: the default user/password is
chip. You will want to change this.
Now I am back to the starting line. I will need to:
- figure out how to configure the wireless through a screen session
- perhaps bundle the wifi configuration into a custom image for flashing?
- recompile kernel in order to use C.H.I.P. as a wifi repeater
- use Ansible to prepare my system for flashing
WHAT I LEARNED
- I don’t know what I’m doing/I have a lot to learn
- Somewhat outdated article, but very helpful: C.H.I.P. flashing on Fedora
- Official repository: NextThingCo/CHIP-tools
- I thought this was going to solve it for me, but ran into space limitations on the live USB key: Flash CHIP using ubuntu on usb
- Hints on using it as a wifi repeater: CHIP as wifi repeater
To avoid tl;dr enjoy this instead:
## 01 Install some prerequisites sudo dnf install -y android-tools gcc git screen sunxi-tools uboot-tools ## 02 Grab hadess repository and make git clone https://github.com/hadess/CHIP-tools.git cd CHIP-tools make sudo cp -v spl-image-builder.o /usr/bin/sunxi-nand-image-builder sudo chmod +x /usr/bin/sunxi-nand-image-builder cd ~ rm -vfr CHIP-tools ## 03 Grab the official CHIP-tools repository git clone https://github.com/NextThingCo/CHIP-tools.git cd CHIP-tools ## 04 Prepare C.H.I.P. for flashing # insert jumper in fel and gnd terminals ## 05 Flash the firmware sudo ./chip-update-firmware.sh -s # wait for "waiting for fel" message and plug in C.H.I.P. ## 06 Reboot and log in over USB # once the script finishes unplug your USB cable from the C.H.I.P. # remove the fel jumper # plug the cable back in to power it on screen /dev/ttyACM0 115200 # username/password: chip