openlens-fw · Use
Updating firmware
Once a camera runs this firmware, you update it with a signed .camfw package. No programmer or
cable is needed.
First build a release image with a newer version than the camera runs, and sign it.
What is kept#
An update rewrites only the rootfs partition. The DATA partition is never touched, so
these stay:
- settings (
cam.conf); - users and passwords, and the recovery code;
- SSH keys and the SSH host key;
- the camera’s CA and certificate, so your browser keeps trusting it.
The camera reboots at the end. Video stops for about 1 to 2 minutes.
From the web UI#
You need an admin account.
- Open System (
https://<camera-ip>/ui/system). - Under Firmware update, choose the
.camfwfile and click Upload and check. - The camera checks the package and shows the result: the installed version beside the new version, the device, the signer and the size. Nothing is installed yet.
- Tick Yes, install this firmware and reboot the camera, then Install. Only the admin who uploaded it can install it. Discard throws it away.
- Reload the page after about 2 minutes.
Limits:
- The page needs its script (
/ui.js). Without scripts, use SSH. - Packages up to 5 MiB. Larger ones go over SSH.
- The web UI refuses packages signed with
--allow-downgrade. - An upload not installed within 15 minutes is discarded.
Over SSH#
You need an SSH key on the camera.
Check first. This changes nothing:
ssh root@<camera-ip> camupdate --check < build/update/<version>.camfwA good package prints a line like:
camupdate: OK: version <version> for MCA40E-IFADO, <bytes> bytes, signed by <key>Then install:
ssh root@<camera-ip> camupdate < build/update/<version>.camfwThe SSH session shows the progress while the camera writes. Then the camera reboots and the connection drops.
What camupdate checks#
Before it writes anything, camupdate refuses a package unless:
- the header’s signature is from a key in the image’s
/etc/cam/update-keys(security-key signatures must carry the touch and PIN flags); - the device is
MCA40E-IFADOand the partition isrootfs; - the image’s SHA-256 matches the signed header, and it is a squashfs that fits the partition;
- it is not a bench image;
- the version is newer than
/etc/cam/version.
Downgrades#
An older version is refused unless the package was signed with --allow-downgrade (see
Signing and update keys). Install those over SSH only.
If an install fails#
- Any failure before the write starts changes nothing. The camera keeps running.
- During the write camupdate stops every other program and feeds the hardware watchdog
itself. If the write or the read-back fails, it tries again, up to 3 times. If none succeeds it
logs
INSTALL FAILEDand reboots. A power cut during the write has the same result. - In that case the camera won’t boot our firmware. Write the
rootfspartition back from your flash backup with the CH341A programmer (see Installing), then install again.
Check the result#
After the reboot, the web UI’s Status or System page shows the new version. Over SSH:
ssh root@<camera-ip> cat /etc/cam/versionA camera that reboots gets a new SSH session but keeps its host key, so ssh doesn’t warn.