Development guide - showmewebcam/showmewebcam GitHub Wiki

Understanding the structure of the build system is key to be able to develop for it.

First step: Build the image.

Following the building guide is the first good step. You can follow the build instructions in the README. If you have a Ubuntu Linux system, it's probably just going to "just work." If you use Mac you can probably still build the system on your host computer, but the people working on this project don't have Macs so you're on your own. If you own Windows, then you can use Linux subsystem for Windows to get by.

You will probably want to know how to build a specific module, how to add one, or how to patch a module to work to your taste. Again, don't skip building the system at least once, because the next steps won't work if you can't build it in the first place!

Building the system and modules

Create a new branch for your changes. Let's say you choose to use my-special-branch for your work:

git fetch -p
git checkout origin/master # check out the latest branch on showmewebcam
git checkout -b my-special-branch

Tear down the build script build-showmewebcam.sh, you'll soon realize that to rebuild a specific module, all you have to tell Make is where the Makefile is, in this case it's output/$BOARDNAME (BOARDNAME is either raspberrypi0 or raspberrypi0 now).

To rebuild the image, all you need to do is to call this manually:

BOARDNAME=raspberrypi0w make -C "output/$BOARDNAME" all

Sample scenario: Uprevving uvc-gadget

Let's say you see a uprev in the uvcgadget package and want to uprev it.

Buildroot has a comprehensive manual here that is worth taking a read. You don't have to read it all now, just know that the buildroot system consists of packages, they are stored in the package folder in the showmewebcam repo.

There are two important files in each package: The Config.in file dictates whether it should be selected to build, and the $PACKAGE.mk tells buildroot how to build it and put it on the target system.

We call the upstream package for uvc-gadget as piwebcam in the repository. So let's open package/piwebcam/piwebcam.mk and take a look:

PIWEBCAM_VERSION = 28605a4f79fe6bb9de9a3e2babfa0ce22c668e5f
PIWEBCAM_SITE = git://github.com/peterbay/uvc-gadget.git

All you need to do now is to change the hash of the package to the newer git hash you want to uprev it to. Then you can rebuild it:

BOARDNAME=raspberrypi0w make -C "output/$BOARDNAME" piwebcam-rebuild

THe -rebuild suffix will tell buildroot to get rid of the cached files and rebuild the package. Most of the times it will work fine.

(... to be continued... )

Notes

  • The system needs to be ready quickly as a webcam so if you want to add your own systemd units, please don't have it start at startup. You should wait for piwebcam.service first, like this.