
SWUPDATE_IMAGES += "tiboot3-am64x-gemini-b"
SWUPDATE_IMAGES += "tispl"
SWUPDATE_IMAGES += "u-boot-${MACHINE}"
SWUPDATE_IMAGES_FSTYPES[tiboot3-am64x-gemini-b] = ".bin"
SWUPDATE_IMAGES_FSTYPES[tispl] = ".bin"

python () {
    machine = d.getVar('MACHINE')
    d.setVarFlag("SWUPDATE_IMAGES_FSTYPES", "u-boot-" + machine, ".img")
}
COREOS_SWUPDATE_EXTENDS_FOR:append = "am64xx"

def coreos_swupdate_extends_images_for_am64xx(d,s):
    machine = d.getVar('MACHINE')
    uboot_filename = "u-boot-" + machine + ".img"

    SECTOR_SIZE = 512
    OFFSET = [0x0*SECTOR_SIZE, 0x600*SECTOR_SIZE, 0x1600*SECTOR_SIZE]

    return [
        {
            "filename" : "tiboot3-am64x-gemini-b.bin",
            "installed-directly" : "true",
            "device" : "/dev/mmcblk0boot0",
            "offset": str(OFFSET[0]),
            "type" : "raw",
            "sha256" : swupdate_get_sha256(d, s, "tiboot3-am64x-gemini-b.bin"),
        },
        {
            "filename" : "tispl.bin",
            "installed-directly" : "true",
            "device" : "/dev/mmcblk0boot0",
            "offset": str(OFFSET[1]),
            "type" : "raw",
            "sha256" : swupdate_get_sha256(d, s, "tispl.bin"),
        },
        {
            "filename" : uboot_filename,
            "installed-directly" : "true",
            "device" : "/dev/mmcblk0boot0",
            "offset": str(OFFSET[2]),
            "type" : "raw",
            "sha256" : swupdate_get_sha256(d, s, uboot_filename),
        }
    ]
