NP at all, will help as much as I can. The vendor (OEM) script did help, shows how they separate the script and binary, and the checksum calculation (with the functions that are available in OEM).
The stock update system has a pretty interesting way of handling things. I have the dev environment for the WD009, which includes a builder for these update files.
Basically the CRC is checked by both the script and the updater on the device. It includes not just the image, but parts of the script too - I think the calculation is done on the whole firmware file sans the first 4 lines, but I have to verify this.
The script itself extracts a rootFS ext2 image, mounts it, unmounts all MTD partitions, and chroots into the new environment. Then it proceeds to run a script in it, which does the flashing of the bootloader, kernel, and new rootFS, then reboots.
This environment contains a much more feature rich busybox, with dd and mtd_write included. I think you should be able to cobble together a build system within OpenWrt for it, which would then build the conversion image for every nightly and release.
OKLI Loader doesn't work, as it's reads garbage "from the flash" every time. The only way to avoid the 1536 k kernel size limit is to port U-Boot, IMHO.
Back to the topic: I'm stucked.
Vendor firmware upgrade script extracts a rootfs to the flash drive and chroots into and deploys the new firmware.
The (HT-TM05) GPL drop contains that rootfs, and of course, all OEM firmware upgrade files contain that.
Of course I don't want to include that "unkown" blob into OpenWrt tree, but generate it.
As this device is supported, a valid rootfs is generated already.
But I need to modify that rootfs to include the upgrade script and the kernel and rootfs files.
So I don't know how to add a unpack-rootfs-include-kernel-rootfs-and-a-few-files-into-it-repack-it-and-tar-it-to-an-OEM-compatible-payload magic to the recipe below:
That TARGET_DIR variable points to a directory (e.g. build_dir/target-mipsel_24kc_musl/root-ramips) which contains the ready-to-pack-to-rootfs files in "extracted" form e.g.:
$ ls build_dir/target-mipsel_24kc_musl/root-ramips
bin dev etc lib mnt overlay proc rom root sbin sys tmp usr var www
One should copy that TARGET_DIR and put kernel and rootfs (IMAGE_KERNEL and IMAGE_ROOTFS variables) and other helper scripts into that new copy. Of course one should manually pack that into squashfs (or something which is known by the OEM firwmare).