{% set PROJECT = PROJECT|default("") %}
{% extends PROJECT+"fastboot.jinja2" %}

{% set DEPLOY_OS = DEPLOY_OS|default("oe") %}
{% set ROOTFS_URL_COMP = ROOTFS_URL_COMP|default("gz") %}

{% set boot_method = boot_method|default("u-boot") %}
{# libhugetlbfs_word_size variable is required for libhugetlbfs.yaml test template #}
{% set libhuggetlbfs_word_size = 32 %}
{% set pre_boot_command = false %}
{% set pre_os_command = false %}
{% set pre_power_command = false %}
{% set reboot_to_fastboot = reboot_to_fastboot|default("true") %}
{% set rootfs_label = "super" %}

{% block device_type %}x15{% endblock %}

{% block boot_commands %}
    commands:
    - setenv fdtfile am57xx-beagle-x15.dtb
    - setenv console ttyS2,115200n8
    - setenv mmcdev 1
    - part number mmc 1 {{ rootfs_label }} part_num
    - "setenv bootpart 1:${part_num}"
    - run mmcboot
{% endblock boot_commands %}

{% block test_target %}
{% if enable_tests is defined and enable_tests %}
- test:
    timeout:
      minutes: 5
    definitions:
    - from: inline
      repository:
        metadata:
          format: Lava-Test Test Definition 1.0
          name: prep-tmp-disk
          description: "Mount local disk for tmp space"
        run:
          steps:
{% if SKIPGEN_KERNEL_VERSION != '4.4' or SKIPGEN_KERNEL_VERSION != 'linux-4.4.y' %}
          - export STORAGE_DEV=$(lava-target-storage SATA || lava-target-storage USB)
          - test -n "${STORAGE_DEV}" || lava-test-raise "STORAGE_DEV not found; job exit"
          - echo "y" | mkfs.ext4 ${STORAGE_DEV} || lava-test-raise "mkfs.ext4 ${STORAGE_DEV} failed; job exit"
          - mkdir -p /scratch
          - mount ${STORAGE_DEV} /scratch && echo "mounted" || lava-test-raise "mount ${STORAGE_DEV} failed; job exit"
{% endif %}
          - df -h
          - mount
      name: prep-tmp-disk
      path: inline/prep.yaml
  {{ super() }}
{% endif %}
{% endblock test_target %}
