Hello Stephen,

On 06/16/2014 09:52 PM, Stephen Warren wrote:
On 06/12/2014 03:46 AM, Przemyslaw Marczak wrote:
This patch introduces new feature: initialization of the dfu
bootloader entity from a separate environmental variable which
can be set on a boot time.

By default, DFU always check environmental variable: $dfu_alt_info.

Changes:
- DFU will also look for environmental variable: $dfu_alt_bootloader
- if any of dfu_alt_* variable is properly defined, then function
   dfu_init_env_entities() will return success.

Use case:
Some devices can boot from various media type (SD, eMMC, NAND, etc.)
or some board configs are common for more than one board type.
In a such case, bootloader is probably placed on a different
devices or even offsets. So such DFU feature is welcome.

Why should the "dfu" command look at different environment variables?
Whatever code dynamically sets the value of $dfu_alt_bootloader should
simply set $dfu_alt_info instead.


Dynamically setting of any entity cold be done at boot time, like this:

# int buf_len = strlen(alt_bootloader) + strlen(CONFIG_DFU_ALT) + 4;
# char *buf = memalign(1, buf_len);
#
# sprintf(buf, "%s; %s", alt_bootloader, CONFIG_DFU_ALT);
# setenv("dfu_alt_info", buf);

But overwriting the $dfu_alt_info on each boot is not a good idea.
If user modify the dfu entities - then it will be overwritten at next boot.

In the other side I can store entities as $dfu_alt_default
and change the above code to:

# char *alt_default = getenv("dfu_alt_default");
# if (!alt_default)
#       alt_default = "";
#
# int buf_len = strlen(alt_bootloader) + strlen(alt_default) + 4;
# char *buf = memalign(1, buf_len);
#
# sprintf(buf, "%s; %s", alt_bootloader, alt_default);
# setenv("dfu_alt_info", buf);

But then, there is some mess in the environment because of duplicated default alt_info.

Those both, above solutions takes more time than just one simple line:

# setenv("dfu_alt_bootlaoder", CONFIG_SOME_ALT_INFO);

like in this patch set.

Maybe better could be modification of the function dfu_init_env_entities() to support parsing variables
in the $dfu_alt_info instead of hard coded env variables
names, e.g:

dfu_alt_info="${alt_info_boot}, ${alt_info_system},..."

dfu_alt_info could be set with default variables names in each board config file in the CONFIG_EXTRA_ENV_SETTINGS and then just one proper variable could be set at boot, and others from env - simple and fast.

And then in the dfu init code - entities are initialized from env variables - if they exists, like in the loop code from this patch.

I need some solution to automatically set proper bootloader entities, since one binary can be stored on SD and eMMC cards.

Thank you,
--
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marc...@samsung.com
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to