❗❗ Warning: This script has only been tested on Jooan A12 so far. There are many situations where chip flashing may fail, such as power outages during upgrades, incompatibilities due to software updates, and more. Use at your own risk. ❗❗
A Jooan camera upgrade is performed using a file that contains the MTD partitions to be replaced. This file also includes a header and a footer, which record information such as the model, versions, and md5 checksums. The footer additionally contains its own filesystem (squashfs), where the upgrade logic is implemented via a shell script called "upgrade.sh".
When the Jooan camera receives an upgrade file, it first checks its integrity (header/footer/model/md5). If the file is valid, the last filesystem in the file is written to /tmp, mounted, and the "upgrade.sh" script is executed as root. Afterwards, the Jooan software deletes the file if the upgrade was performed via SD card.
The Jooan-Updater tool is designed to upgrade the camera's existing operating system to thingino. This may be necessary in scenarios such as installations without internet access, where it is undesirable for the open WAN hotspot to be enabled.
The upgrade process works as follows:
- The
build-squashfs.shscript creates a squashfs filesystem image containing the contents of thecommandsfolder. build-squashfs.shtakes the JOOAN camera model (e.g., "A12", not "JA-A12") as its only parameter, generates the required header and footer for camera compatibility, and writes the result to thesquashfsdirectory.- You copy the generated squashfs file (e.g. jooan-A12.upgrade) and a matching thingino image named
autoupdate-full.binto an SD card. - The Jooan camera is triggered to perform the update via a goform API call.
- The camera validates the file, mounts the last (and only) filesystem in the file, and executes the
upgrade.shscript, passing the upgrade file name as its sole parameter. upgrade.shchecks the file extension of its parameter to determine the required action and calls the corresponding_cmdscript (see thecommandsfolder).- The
upgrade_cmd.shscript searches for the thingino fileautoupdate-full.bin. If found, it creates a backup of the existing operating system on the SD card (backup.bin) and writes the thingino boot and boot-env partitions. - The camera automatically reboots, starts with thingino boot, detects
autoupdate-full.binon the SD card, and performs a complete operating system replacement.
wget http://10.68.68.22/goform/getOtherSetttings?singleCMD=GetJsonConf\&userid=admin\&userkey=0192023a7bbd73250516f069df18b500\&json_string='{"SystemInfo":{"ProductName":""}}' -O model.logOpen the file model.log and your camera model is the characters after the hyphen.
Example: If ProductName is "JA-A12", then the camera model is "A12".
If there is no file for your camera model in the "squashfs" folder, you need to install the entire repo and run build-squashfs.sh [your camera model].
Afterwards, a corresponding file should be present in the "squashfs" folder.
After copying the appropriate .upgrade file to "squashfs" and a matching thingino image to the SD card (root folder), run the following command to start the upgrade on the camera:
wget 'http://10.68.68.22/goform/upgradeFW?userid=admin\&userkey=0192023a7bbd73250516f069df18b500\&filename=/mnt/sd_card/jooan-A12.upgrade' -O upgrade.logOpen the file upgrade.log and check if the upgrade was successful.
Important: There will now be a new file "backup.bin" on the SD card. Save this to your computer to restore the original operating system if needed.
To restore, copy "backup.bin" back to the SD card as "autoupdate-full.bin" and reboot the camera. Thingino will handle the rest.