define(NERVES_FW_PRODUCT, "Nerves Firmware")
define(NERVES_FW_DESCRIPTION, "")
define(NERVES_FW_VERSION, "${NERVES_SDK_VERSION}")
define(NERVES_FW_PLATFORM, "stm32mp135d")
define(NERVES_FW_ARCHITECTURE, "arm")
define(NERVES_FW_AUTHOR, "The Nerves Team")

define(EFI_TYPE, "c12a7328-f81f-11d2-ba4b-00a0c93ec93b")
define(LINUX_FILESYSTEM_DATA_TYPE, "0fc63daf-8483-4772-8e79-3d69d8477de4")

define(NERVES_SYSTEM_DISK_UUID, "D55BB8C7-1A91-4FA4-BF38-1F735090DF28")
define(NERVES_SYSTEM_SPL_PART_UUID, "5278721d-0089-4768-85df-b8f1b97e6684")
define(NERVES_SYSETM_UBOOT_PART_UUID, "130e0a2d-b49a-4e1e-a8f9-6af7d5bcfdd6")
define(NERVES_SYSTEM_EFI_PART_UUID, "130e0a2d-b49a-4e1e-a8f9-6af7d5bcfdd7")
define(NERVES_SYSTEM_ROOTFS_PART_UUID, "b1209c26-3b03-4097-adc6-c383fa4e4d2f")
define(NERVES_SYSTEM_APP_PART_UUID, "03c62a5e-bc2e-439a-910d-c41a591a8e98")

define(NERVES_FW_DEVPATH, "/dev/mmcblk0")
define(NERVES_FW_APPLICATION_PART0_DEVPATH, "/dev/mmcblk0p6")
define(NERVES_FW_APPLICATION_PART0_FSTYPE, "f2fs")
define(NERVES_FW_APPLICATION_PART0_TARGET, "/root")
define(NERVES_PROVISIONING, "${NERVES_SYSTEM}/images/fwup_include/provisioning.conf")

# Default paths if not specified via the commandline
define(ROOTFS, "${NERVES_SYSTEM}/images/rootfs.squashfs")

# This configuration file will create an image that
# has GPT and the following layout:
# +----------------------------+
# | Firmware configuration data|
# | (formatted as uboot env)   |
# +----------------------------+
# | p0: SPL1                   |
# +----------------------------+
# | p1: SPL2                   |
# +----------------------------+
# | p2: UBOOT                  |
# +----------------------------+
# | p3: Boot partition (FAT32) |
# | zImage                     |
# | stm32mp135f-coremp135.dtb  |
# | extlinux.conf              |
# +----------------------------+
# | p4: Rootfs A (squashfs)    |
# +----------------------------+
# | p5: Rootfs B (squashfs)    |
# +----------------------------+
# | p6: Application (f2fs)     |
# +----------------------------+

define-eval(UBOOT_ENV_OFFSET, 2048)
define(UBOOT_ENV_COUNT, 256)  # 128 KB

define(SPL1_PART_OFFSET, 4096)
define(SPL1_PART_COUNT, 170)

define-eval(SPL2_PART_OFFSET, "${SPL1_PART_OFFSET} + ${SPL1_PART_COUNT}")
define-eval(SPL2_PART_COUNT, "${SPL1_PART_COUNT}")

define-eval(UBOOT_PART_OFFSET, "${SPL2_PART_OFFSET} + ${SPL2_PART_COUNT}")
define(UBOOT_PART_COUNT, 3030)

define-eval(EFI_A_PART_OFFSET, "${UBOOT_PART_OFFSET} + ${UBOOT_PART_COUNT}")
define(EFI_A_PART_COUNT, 204800)

define-eval(EFI_B_PART_OFFSET, "${EFI_A_PART_OFFSET} + ${EFI_A_PART_COUNT}")
define(EFI_B_PART_COUNT, ${EFI_A_PART_COUNT})

# Let the rootfs have room to grow up to 512 MiB
define-eval(ROOTFS_A_PART_OFFSET, "${EFI_B_PART_OFFSET} + ${EFI_B_PART_COUNT}")
define(ROOTFS_A_PART_COUNT, 1048576)

define-eval(ROOTFS_B_PART_OFFSET, "${ROOTFS_A_PART_OFFSET} + ${ROOTFS_A_PART_COUNT}")
define(ROOTFS_B_PART_COUNT, ${ROOTFS_A_PART_COUNT})

# Application data partition. This can be enlarged
# to fill the entire volume.
define-eval(APP_PART_OFFSET, "${ROOTFS_B_PART_OFFSET} + ${ROOTFS_B_PART_COUNT}")
define(APP_PART_COUNT, 8388608)

# Firmware archive metadata
meta-product = ${NERVES_FW_PRODUCT}
meta-description = ${NERVES_FW_DESCRIPTION}
meta-version = ${NERVES_FW_VERSION}
meta-platform = ${NERVES_FW_PLATFORM}
meta-architecture = ${NERVES_FW_ARCHITECTURE}
meta-author = ${NERVES_FW_AUTHOR}
meta-vcs-identifier = ${NERVES_FW_VCS_IDENTIFIER}
meta-misc = ${NERVES_FW_MISC}
