After some digging in the code and some tests, here is what I found regarding the update process of the HDG:
- The name of the update file that the HDG is looking for when you want to update from the utility menu has to start with afg and has to have the .upk extension: "afgxxxxx.upk"
- The update actions have to be described in a xml file named "Manifest.xml" which has to be in a "package" directory.
- Hereafter an example of what the Manifest.xml file can include:
<manifest factory="yes">
<Vendor name="hantek"></Vendor>
<Product name="FGen"></Product>
<Model name="HDG2002B"></Model>
<SoftwareVersion version="0.00.0"></SoftwareVersion>
<date value="000000.0"></date>
<cmd>touch /update.ok</cmd>
<cmd>cp /tmp/package/afg_update /</cmd>
</manifest>
If factory <> "yes" then Vendor, Product name, Model name have to match those on your HDG, SoftwareVersion has also to be greater and date newer than the firmware on your HDG.
If factory="yes", all this informations are just taken from the update file and not tested with the one on your HDG.
You can also just ommit those tags.
The most interesting part is the "cmd" tags which allow you to run commands directly from your update package. The 2 cmd commands above are of course just examples and you can insert as many commands as you like.
Your "package" directory should than be tared 2 times in "afg.upk.tar" and then in "afg.upk.tar.bz" , then encrypted with gpg using "afg369" as passphrase and finally renamed in something like afgxxx.upk.
In the following example, my "package" directory is in /mnt/sd/tmp:
tar cvf afg.upk.tar ./package
tar cvzf afg.upk.tar.bz ./afg.upk.tar
cd /
gpg --passphrase afg369 -c /mnt/sd/tmp/afg.upk.tar.bz
cd /mnt/sd/tmp
cp afg.upk.tar.bz.gpg afg_test.upk
You just have after that to go to the update menu in utility and select you afgxxxx.upk file as input for the update.
Your file will be copied by the HDG to /tmp, decrypted with gpg and untared 2 times and then Manifest.xml will be parsed.
After the update the HDG will reboot.
When booting, the HDG checks if there is an "afg_update" file in /. If it founds it, il will run it and then remove it. It is mainly intended to replace afg_bin after an update (commands during updates are launched from afg_bin so it can't be removed a that time) but you can use it to do whatever you like.
As an example, I have attach afg_HDG2002B_to_HDG2102C.upk (zipped) which replaces HDG2002B with HDG2102C in /config/root/system.inf... Guess why