SDK - Update implementation technical details
- SDK Fundamentals
- SDK Deep dive
- Extended features
- CAMAPI usage
- Tools and Software support
- Software release and Update
- Contact Us
The following information is intended for software developers using the edgertronic camera's Software Developers Kit.
At the end of Linux boot process, the init script executes the entries in /etc/rc.d in priority order, starting at S00 and going though S90.
The device update procedure, which causes the contents of the micro SD card to be completely overwritten, is independent from the FPGA update procedure, which causes the contents of the SPI EEPROM to be overwritten.
S12 device-update script
The contents of the entire micro SD card are updated using the following steps:
- Mounts the big SD card.
- Checks the big SD card for a file named sanstreak_update*.tar in the root directory of the big SD card, which gets mounted at /mnt/sdcard. Update stops if no update file is found.
- The tarball is checked for an update-script.sh script. If found, the file is validated via an md5sum, then run. Typically the script causes a reboot. The normal update tarball does not contain a update-script.sh script.
- The tarball is checked for an sdcard.img.xz file. If found, the file is validated via an md5sum, then used to completely overwrite the micro SD card. The helper script /usr/local/bin/do-update is used to write to the micro SD card from a chroot environment.
- The update tarball is deleted from the SD card.
- The camera is rebooted.
If at any time a problem is found with the update tarball, the update tarball is renamed by adding .bad to the end of the filename and the camera is rebooted. This is done so that the camera doesn't endlessly try to use the corrupt update tarball.
A side effect of completely overwriting the micro SD card is the FPGA bits file that matches the updated software is now located in the updated file system on the micro SD card.
S13 fpga-update script
Normally, the FPGA is updated right after a software update occurs. The normal sequence is a user stores the software update file on the big SD card and powers on the camera. The device-update script runs, updating all the entire contents of the micro SD card as described above. Since the device-update script deletes the update tarball and reboots the camera, the next time the device-update script runs there will be no update file; nothing happens and normal boot continues with the execution of the fpga-update script.
The fpga-update script performs the following steps:
- Reads the current FPGA version from SPI registers supported in the FPGA.
- Identifies the newest FPGA bits file located in the /home/root/latest directory. Normally there is only one file in that directory.
- Extracts the FPGA version ID file from the newest FPGA bits filename.
- If the current FPGA version doesn't match the FPGA version in the newest FPGA bits file, then fpga-update runs the /usr/local/bin/fpga-eeprom-update script to update the SPI EEPROM which holds the FPGA bits. The fpga-eeprom-update script will reboot the camera when the SPI EEPROM has been updated.
After the reboot that follows the FPGA update the latest FPGA bit version in the file system will match the version running in the FPGA; the camera will continue on with the normal boot sequence.