aboutsummaryrefslogtreecommitdiff
path: root/lava_scheduler_app/tests/device-types/base-uboot.jinja2
blob: 19a72b3ac5ae74e4f97718cdad3001e446967ee7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
{% extends 'base.jinja2' %}

{% set base_high_limits = base_high_limits|default(true) %}
{% set base_uboot_commands = (
"          - setenv autoload no") -%}
{% set base_uboot_high_limits =(
"          - setenv initrd_high " + uboot_initrd_high|default('0xffffffff') + "
          - setenv fdt_high " + uboot_fdt_high|default('0xffffffff') ) -%}

{% if append_dtb %}
    {% set run_load_fdt = "" %}
    {% set load_fdt = "" %}
{% else %}
    {% set run_load_fdt = "run loadfdt; " %}
    {% set load_fdt = uboot_load_ftd|default("          - tftp {DTB_ADDR} {DTB}") %}
{% endif %}

{% set base_uboot_dhcp_command = (
"          - " + uboot_ipaddr_cmd|default('dhcp') + "
          - setenv serverip {SERVER_IP}" ) -%}

{% set base_uboot_tftp_commands = uboot_tftp_commands|default(
"          - tftp {KERNEL_ADDR} {KERNEL}
          - tftp {RAMDISK_ADDR} {RAMDISK}
          - setenv initrd_size ${filesize}
" + load_fdt) -%}

{% set base_uboot_bootcmd = uboot_bootcmd|default(
"          - '" + uboot_bootx_cmd|default('{BOOTX}')) + "'" -%}

{% set base_uboot_nbd_bootcmd = (
"          - setenv loadnbd 'setenv serverip {SERVER_IP}; run loadkernel; run loadfdt; run loadinitrd';
          - setenv verify no
          - setenv bootcmd 'dhcp; run loadnbd; printenv; {BOOTX}'
          - run bootcmd
") -%}

{% set base_uboot_usb_commands = uboot_usb_commands|default(
"          - usb start") -%}

{% set uboot_needs_usb = uboot_needs_usb|default(false) %}

{% set usb_uuid = usb_uuid|default('') %}
{% set usb_device_id = usb_device_id|default(0) %}

{% set uboot_mac_addr = uboot_mac_addr|default('') %}
{% set base_uboot_set_mac = (
"          - setenv ethaddr " + uboot_mac_addr) -%}

{% set uboot_set_mac = uboot_set_mac|default(false) %}

{# adds the parameters: top level block #}
{% block vland %}
{{ super() }}
{% if text_offset %}
  text_offset: '{{text_offset}}'
{% endif %}
{% if booti_kernel_addr %}
  image:
    kernel: '{{ booti_kernel_addr|default('0x80000000') }}'
    ramdisk: '{{ booti_ramdisk_addr|default('0x82000000') }}'
    dtb: '{{ booti_dtb_addr|default('0x81000000') }}'
  booti:
    kernel: '{{ booti_kernel_addr|default('0x80000000') }}'
    ramdisk: '{{ booti_ramdisk_addr|default('0x82000000') }}'
    dtb: '{{ booti_dtb_addr|default('0x81000000') }}'
{% endif %}
{% if bootm_kernel_addr %}
  uimage:
    kernel: '{{ bootm_kernel_addr|default('0x80000000') }}'
    ramdisk: '{{ bootm_ramdisk_addr|default('0x82000000') }}'
    dtb: '{{ bootm_dtb_addr|default('0x81000000') }}'
  bootm:
    kernel: '{{ bootm_kernel_addr|default('0x80000000') }}'
    ramdisk: '{{ bootm_ramdisk_addr|default('0x82000000') }}'
    dtb: '{{ bootm_dtb_addr|default('0x81000000') }}'
{% endif %}
{% if bootz_kernel_addr %}
  zimage:
    kernel: '{{ bootz_kernel_addr|default('0x80000000') }}'
    ramdisk: '{{ bootz_ramdisk_addr|default('0x82000000') }}'
    dtb: '{{ bootz_dtb_addr|default('0x81000000') }}'
  bootz:
    kernel: '{{ bootz_kernel_addr|default('0x80000000') }}'
    ramdisk: '{{ bootz_ramdisk_addr|default('0x82000000') }}'
    dtb: '{{ bootz_dtb_addr|default('0x81000000') }}'
{% endif %}
{% endblock vland %}

{% block body %}
device_type: {{ device_type|default('uboot') }}
{% if console_device %}
{% set console_device = "console=" + console_device + "," %}
{% set parity = console_parity|default('n') %}
{% set databits = console_databits|default('8') %}
{% set baud_rate = baud_rate | default(115200)|string + parity + databits %}
{% endif %}
{% set base_kernel_args = extra_kernel_args | default(base_kernel_args) %}
{% set action_timeout_bootloader_commands = action_timeout_bootloader_commands | default(3) %}
{% set connection_timeout_bootloader_commands = connection_timeout_bootloader_commands | default(30) %}

{% if fastboot_deploy_uboot %}
adb_serial_number: {{ adb_serial_number|default("'0000000000'") }}
fastboot_serial_number: {{ fastboot_serial_number|default("'0000000000'") }}
fastboot_options: {{ fastboot_options|default([]) }}
# This attribute identifies whether a device should get into fastboot mode by
# interrupting uboot and issuing commands at the bootloader prompt.
fastboot_via_uboot: True
{% endif %}

actions:
  deploy:
    parameters:
      add_header: u-boot
      mkimage_arch: {{ uboot_mkimage_arch|default('arm64') }} # string to pass to mkimage -A when adding UBoot headers
      append_dtb: {{ append_dtb|default(false) }}
      use_xip: {{ use_xip|default(false) }}
    connections:
      lxc:
      serial:
    methods:
{% if uboot_ums_flash %}
      u-boot-ums:
{% endif %}
{% if flasher_deploy_commands %}
      flasher:
        commands: {{ flasher_deploy_commands }}
{% endif %}
      lxc:
      overlay:
      tftp:
      nbd:
      ssh:
        options:
{{ ssh_options }}
        host: '{{ ssh_host|default('') }}'
        port: {{ ssh_port|default(22) }}
        user: {{ ssh_user|default('root') }}
        identity_file: {{ ssh_identity_file }}
{% if fastboot_deploy_uboot %}
      fastboot:
{{- fastboot_deploy_uboot }}
{{- fastboot_interrupt_params }}
{% endif %}

  boot:
    connections:
      lxc:
      serial:
    methods:
      minimal:
      ssh:
{% if fastboot_boot_uboot %}
      fastboot: {{ fastboot_sequence }}
{% endif %}
      u-boot:
        parameters:
          mkimage_arch: {{ uboot_mkimage_arch|default('arm') }}
          bootloader_prompt: {{ bootloader_prompt|default('=>') }}
          interrupt_prompt: {{ interrupt_prompt|default('Hit any key to stop autoboot') }}
          # character needed to interrupt u-boot, single whitespace by default
          interrupt_char: "{{ interrupt_char|default('') }}"
          needs_interrupt: {{ uboot_needs_interrupt|default(True) }}
{% if uboot_ums_flash %}
          uboot_ums_flash: {{ uboot_ums_flash }}
          uboot_mass_storage_device: {{ uboot_mass_storage_device|default(None) }}
{% endif %}
{% if fastboot_boot_uboot %}
{{- fastboot_boot_uboot }}
{{- fastboot_boot_grub }}
{% endif %}
          # method specific stanza
        ums:
          commands:
          - {{ ums_command|default('ums 0 mmc 0')}}
        nfs:
          commands:
{% if uboot_needs_usb %}
{{ base_uboot_usb_commands }}
{% endif -%}
{{ base_uboot_commands }}
{% if base_high_limits %}
{{ base_uboot_high_limits }}
{% endif %}
{% if uboot_set_mac %}
{{ base_uboot_set_mac }}
{% endif -%}
{{ base_uboot_dhcp_command }}
{{ base_uboot_tftp_commands }}
          # Always quote the entire string if the command includes a colon to support correct YAML.
          - "setenv bootargs '{{ console_device }}{{ baud_rate }} root=/dev/nfs rw {{ base_nfsroot_args }} {{ base_kernel_args }} {{ base_ip_args }}'"
{{ base_uboot_bootcmd }}
        nbd:
          commands:
{% if uboot_needs_usb %}
{{ base_uboot_usb_commands }}
{% endif -%}
{{ base_uboot_commands }}
{% if base_high_limits %}
{{ base_uboot_high_limits }}
{% endif %}
{{ base_uboot_dhcp_command }}
{{ base_uboot_tftp_commands }}
          # Always quote the entire string if the command includes a colon to support correct YAML.
          - "setenv bootargs '{{ console_device }}{{ baud_rate }} rw {{ base_nbdroot_args }} {{ base_kernel_args }} {{ base_ip_args }} verbose earlyprintk systemd.log_color=false ${extraargs} rw'"
{{ base_uboot_bootcmd }}
        ramdisk:
          commands:
{% if uboot_needs_usb %}
{{ base_uboot_usb_commands }}
{% endif -%}
{{ base_uboot_commands }}
{% if base_high_limits %}
{{ base_uboot_high_limits }}
{% endif %}
{% if uboot_set_mac %}
{{ base_uboot_set_mac }}
{% endif -%}
{{ base_uboot_dhcp_command }}
{{ base_uboot_tftp_commands }}
          - "setenv bootargs '{{ console_device }}{{ baud_rate }} root=/dev/ram0 {{ base_kernel_args }} {{ base_ip_args }}'"
{{ base_uboot_bootcmd }}
        usb:
          commands:
{{ base_uboot_usb_commands }}
{{ base_uboot_commands }}
          - "load usb {{ usb_device_id }}:{ROOT_PART} {KERNEL_ADDR} {KERNEL}"
          - "load usb {{ usb_device_id }}:{ROOT_PART} {RAMDISK_ADDR} {RAMDISK}"
          - "setenv initrd_size ${filesize}"
          - "load usb {{ usb_device_id }}:{ROOT_PART} {DTB_ADDR} {DTB}"
          - "{{ console_device }}{{ baud_rate }} root={ROOT} {{ base_kernel_args }} {{ base_ip_args }}"
{{ base_uboot_bootcmd }}
        sata:
          commands:
          - scsi scan
{{ base_uboot_commands }}
          - "load scsi {ROOT_PART} {KERNEL_ADDR} {KERNEL}"
          - "load scsi {ROOT_PART} {RAMDISK_ADDR} {RAMDISK}; setenv initrd_size ${filesize}"
          - "load scsi {ROOT_PART} {DTB_ADDR} {DTB}"
          - "setenv bootargs '{{ console_device }}{{ baud_rate }} root={ROOT} {{ base_kernel_args }} {{ base_ip_args }}'"
{{ base_uboot_bootcmd }}
{% endblock body %}