I still tinker with my C.H.I.P devices but not all that frequently. Certainly not frequently enough to keep an environment on my daily laptop updated and ready to flash firmware. So I created a container to house all those dependencies!
If you do not care to read (or about) all the words and explanations, feel free to skip to the SHORT VERSION
BACKGROUND
As you may know from a previous post, I really struggled with the C.H.I.P. documentation simply because I wasn’t using Ubuntu. So I fumbled around and ended up getting something working. But now, I created a container to interface with my C.H.I.P. This allows me to not have to worry about the web flasher, spinning up a VM, or resolving all sorts of dependencies on my laptop.
While what I’ve done may not align with all the best practices of containers (and it is much larger than I’d like it to be), it is certainly helpful for me:
00 Prerequisites
Obviously this is reliant on Docker. There is tons of documentation online to help get Docker installed if it is not already. I’m going to leave that up to your internet skillz.
01 Pull down the image
I’ve put the image on Docker hub, so using it is as easy as “pulling” the image:
docker pull dswhitley/chipinteractive
NOTE: if you prefer to build it yourself, feel free, I’ve included some instructions both in my github repo and on the hub page
02 Run the container
Now in order to access the C.H.I.P. you need to allow the docker image privilege to your USB devices:
docker run -it --rm --name chip --privileged \ -v /dev/bus/usb:/dev/bus/usb chip-interactive
NOTE: I didn’t do a consistent job with the naming, but feel free to modify if you wish
03 Enjoy the menu
For whatever reason I wanted this to provide an interactive menu. It will look like this and could use some explanation:
# # # ######### ### ### # {#} # ### '%###### # # ### ### ######## # # # ======================================= Menu... ======================================= Enter 0 to revert back to default Enter 1 to customize buildroot XXXEnter 2 to customize LinuxXXX Enter 3 to flash with customizations Enter 4 to stop this container ======================================= Enter option Number:
And here is what the options mean:
0: this is simply using the default, currently available image
1: this just runs the make and make nconfig to customize
2: I did not get around to this yet…
3: this actually flashes the C.H.I.P. with whatever was built (in #1)
4: this just exits, stopping the container
NEXT STEPS
I don’t think I’ll be able to do what I wanted with this container, but I hope that someone else can benefit from it. Next I will probably make a non-interactive container that I may call from an Ansible playbook that also includes configuring the networking of the C.H.I.P. over the USB port with expect scripting. Pipedreams.
WHAT I LEARNED
- I learned a lot about the C.H.I.P. build process, but I’m still not sure I understand buildroot, etc.
- I learned about constructing a Docker image
- I learned that I am not able to do what I wanted by configuring the firmware (at least from what I can tell). I had hoped to create an “image” that already contained my wireless SSID and password and potentially a bridged configuration so that I could just slap it on there and when it booted, the new C.H.I.P. would make itself part of my mesh…
REFERENCES:
- My docker hub pre-built image: dswhitley/chipinteractive
- My github repository for this work: dswhitley/CHIPinteractive
- I’m still learning about git, so free to do git “stuff” there like review my commits or submit an issue or a pull request
- Also, note my references in github, I couldn’t have done this without them
- Official C.H.I.P. documentation: Flash CHIP Firmware
SHORT VERSION:
To avoid tl;dr enjoy this instead:
## 00 Prerequisites # ensure that Docker is installed on your system ## 01 Pull down the image docker pull dswhitley/chipinteractive ## 02 Run the container docker run -it --rm --name chip --privileged \ -v /dev/bus/usb:/dev/bus/usb chip-interactive ## 03 Enjoy the menu