openlens-fw · Get started
Installing
Installing replaces only the camera’s rootfs flash partition. The bootloader, the kernel and
the data partition stay as they are.
Before anything: a full flash backup#
Do not skip this. A failed install, or a lost update key, can leave a camera that only a flash programmer can bring back.
You need:
- a CH341A USB programmer and a SOIC-8 clip;
flashromon your computer;- the camera opened so you can reach the flash chip (PUYA P25Q128). It runs at 3.3 V. Check your programmer’s voltage before you clip on.
Then:
- Read the whole chip twice and compare.
scripts/flash-backup.shdoes both reads and the compare. Two identical reads give you a trustworthy “golden” image. - Keep copies offline. The backup holds your camera’s own data (its MAC address and calibration) and the stock firmware.
- Test a restore before you write anything else.
scripts/flash-restore.shwrites a full golden image back; flashrom verifies it after writing.
Rules that keep a camera recoverable:
- Never write the
BOOTpartition (the bootloader). Onlyrootfsis ever written. - Keep the
DATApartition. It holds the camera’s own files, and our settings live there too.
The partition layout is in
scripts/flash-layout.txt.
Before you install#
- Build a release image with your own keys in
rootfs/update-keys.local. - Sign it into a
.camfwpackage. - Put the camera on a network only you use: a separate VLAN or a direct cable. After the install the camera is unclaimed, and anyone who reaches it first can claim it.
- Give it a DHCP reservation. The camera only uses DHCP. For HTTPS, the address must be in the subnet the image was built for, CAM_NET (see HTTPS and the camera CA).
First install from stock firmware#
scripts/cam-first-install.py
installs over the network, without the programmer. It needs a root shell on the stock firmware.
These docs don’t describe how to get one; read the script and the repository’s docs/ folder.
What the script does, at a high level:
- Checks the camera’s flash layout (read-only).
- Uploads the release build’s tools and your signed package into RAM, and checks their SHA-256.
- Stops the stock software and runs
camupdate --checkon the package: your signature, the device, the image and its size. - Asks you to type
FLASH <camera-ip>to confirm. - Writes the
rootfspartition only, reads it back, compares, and reboots. - Waits for the camera to come back with our firmware, unclaimed.
python3 scripts/cam-first-install.py --host <camera-ip> --package build/update/<version>.camfwAdd --check-only for a dry run: everything up to the check, then the camera reboots back to
stock.
After the install#
- The camera comes up unclaimed. Claim it within 30 minutes of that boot. See Claiming the camera.
- DATA is kept. The stock firmware’s files on the data partition stay. Our settings,
accounts, keys and certificates go in their own folder there (
/mnt/nand/cam). - Later updates don’t need the script or the programmer. See Updating firmware.
If it doesn’t come back#
Write the rootfs partition back from your golden image with the programmer:
scripts/flash-write-region.sh rootfs <golden-image>That brings the stock firmware back. The script writes only the region you name.
There is no “go back to stock” update package. The flash backup is the way back.