Commit 8eb37524 authored by Lukasz Majewski's avatar Lukasz Majewski Committed by Marek Vasut

tests: py: dfu: Add functionality to set different u-boot's dfu env variable

By default (on almost all systems) the dfu env variable, which defines
available alt settings, is named as "dfu_alt_info".

However on some platforms (i.e. Odroid XU3), the 'dfu_alt_info' is concatenated
from other variables - namely 'dfu_alt_boot' and 'dfu_alt_system' at run time
(when one types 'dfu 0 mmc 0' for first time).

'dfu_alt_boot' describes alt settings which depend on boot medium - for example
boot loader's LBA sectors which are different on eMMC and SD card because of e.g.
MBR/GPT.

'dfu_alt_system' describes board agnostic alt settings - like rootfs, kernel.
On such system we can only append/modify this env variable.

Because of the above, we must have way to modify other than "dfu_ale_info"
variable to perform tests.
Signed-off-by: 's avatarLukasz Majewski <l.majewski@samsung.com>
Acked-by: 's avatarStephen Warren <swarren@nvidia.com>
---
Changes for v3:
- None

Changes for v2:
- Rewrite of "alt_info_env_name" variable description
- Use of get() method on python's dictionary to easily obtain default
  value
parent c6eb899c
......@@ -44,6 +44,14 @@ env__dfu_configs = (
# configurations, but don't want to test every single transfer size
# on each, to avoid bloating the overall time taken by testing.
"test_sizes": (63, 64, 65),
# This value is optional.
# The name of the environment variable that the the dfu command reads
# alt info from. If unspecified, this defaults to dfu_alt_info, which is
# valid for most systems. Some systems use a different variable name.
# One example is the Odroid XU3, which automatically generates
# $dfu_alt_info, each time the dfu command is run, by concatenating
# $dfu_alt_boot and $dfu_alt_system.
"alt_info_env_name": "dfu_alt_system",
},
)
......@@ -124,7 +132,11 @@ def test_dfu(u_boot_console, env__usb_dev_port, env__dfu_config):
u_boot_console.log.action(
'Starting long-running U-Boot dfu shell command')
cmd = 'setenv dfu_alt_info "%s"' % env__dfu_config['alt_info']
dfu_alt_info_env = env__dfu_config.get('alt_info_env_name', \
'dfu_alt_info')
cmd = 'setenv "%s" "%s"' % (dfu_alt_info_env,
env__dfu_config['alt_info'])
u_boot_console.run_command(cmd)
cmd = 'dfu 0 ' + env__dfu_config['cmd_params']
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment