Including sysupgrade metadata in image?

I'm looking to use the existing sysupgrade system on an device I'm trying to bring up.

I've altered /lib/upgrade/platform.sh to do what needs to be done (exploding the tar.gz file, moving the kernel, dd'ing the root. But I cannot find where the metadata is included.

Upgrade File:
openwrt-octeon-itusrouter-ext4-sysupgrade.tar.gz

In my Makefile for the device:

  KERNEL_NAME := vmlinux.elf
  KERNEL_INITRAMFS_NAME := vmlinux-initramfs.elf
  KERNEL := kernel-bin | strip-kernel | patch-cmdline
  IMAGES := sysupgrade.tar.gz
  IMAGE/sysupgrade.tar := append-rootfs | sysupgrade-tar rootfs=$$$$@ | append-metadata

Now, I'm not even sure those are all the flags I need, or should have. I'm lost in the weeds when it comes to these things, but I know it works.

Any advice?

To the top.