Skip to content

peak3d/jooan-updater

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jooan-Updater, a custom flash and command utility

❗❗ 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.

Purpose and Upgrade Logic

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.sh script creates a squashfs filesystem image containing the contents of the commands folder.
  • build-squashfs.sh takes 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 the squashfs directory.
  • You copy the generated squashfs file (e.g. jooan-A12.upgrade) and a matching thingino image named autoupdate-full.bin to 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.sh script, passing the upgrade file name as its sole parameter.
  • upgrade.sh checks the file extension of its parameter to determine the required action and calls the corresponding _cmd script (see the commands folder).
  • The upgrade_cmd.sh script searches for the thingino file autoupdate-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.bin on the SD card, and performs a complete operating system replacement.

Goform Commands

Command to determine the camera model

wget http://10.68.68.22/goform/getOtherSetttings?singleCMD=GetJsonConf\&userid=admin\&userkey=0192023a7bbd73250516f069df18b500\&json_string='{"SystemInfo":{"ProductName":""}}' -O model.log

Open 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.

Command to trigger the upgrade

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.log

Open 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.

About

Upgrade file generator to allow flashing custom OS on JOOAN camera

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages