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

{% set BOOT_OS_PROMPT = BOOT_OS_PROMPT|default("hikey:~") %}
{% set DEPLOY_OS = DEPLOY_OS|default("oe") %}
{% set PTABLE_LABEL = "ptable" %}
{% set PTABLE_URL = "http://images.validation.linaro.org/snapshots.linaro.org/96boards/reference-platform/components/uefi-staging/69/hikey/release/ptable-linux-8g.img" %}
{% set ROOTFS_URL_COMP = ROOTFS_URL_COMP|default("gz") %}

{% set boot_method = "grub" %}
{% set pre_power_command = true %}
{% set post_boot_command = true %}
{% set ptable = true %}
{% set reboot_reset = true %}
{% set rootfs = true %}
{% set rootfs_label = rootfs_label|default("system") %}

{% block device_type %}hi6220-hikey-r2{% endblock %}

{% block auto_login_commands %}
      login_commands:
        # Become super user to run tests
        - su
{% endblock auto_login_commands %}

{% block boot_commands %}
    commands: installed
{% 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-tests
          description: "Device preparation"
        run:
          steps:
          # the image does not raise the interface itself
          # force a DHCP request to avoid avahi using a zero conf address.
          # - udhcpc
          # - netstat
          # - ip a
          # - ifconfig
          - df
          - cat /sys/class/thermal/thermal_zone0/policy || true
          - echo "power_allocator" > /sys/class/thermal/thermal_zone0/policy || true
          - cat /sys/class/thermal/thermal_zone0/policy || true
          - cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies  | awk '{ print $(NF-1) }'  > /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq
          - cat /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq || true
      name: prep-inline
      path: inline/prep.yaml
  {{ super() }}
{% endif %}
{% endblock test_target %}
