[U-Boot] [PATCH 04/10] samsung: misc: set the dfu bootloader setting at boot time.

Inha Song ideal.song at samsung.com
Wed Jun 11 04:03:01 CEST 2014


Hi Przemyslaw,

I have a question.

"dfu_alt_bootloader" env is settings successfully
> dfu_alt_bootloader=u-boot raw 0x3e 0x800 mmcpart 1

But,
In order to replace bootloader binary in thor mode,
How can I use the "dfu_alt_bootloader" env?

DFU gadget use "dfu_alt_info" env for DFU entities configuration.

Is there any patch to support multiple "dfu_alt" environment, or
"dfu_alt_info" environment settings to use "dfu_alt_bootloader" env?

best regards,
Inha Song.


On Tue, 10 Jun 2014 13:32:58 +0200
Przemyslaw Marczak <p.marczak at samsung.com> wrote:

> This change adds new function:
> - set_dfu_boot_alt(bootmode) - where bootmode is the value of Exynos ompin[5:1]
>                                masked with BOOT_MODE(x) macro.
> 
> This change is useful for devices with more than one boot device,
> e.g. with a separated SD and eMMC slots. Different dfu entities are
> required for SD and eMMC cards. The board config should define:
> - CONFIG_MISC_COMMON
> - CONFIG_SET_DFU_BOOT_ALT
> and at least one of below alt setting:
> - CONFIG_DFU_BOOT_ALT_SD, e.g: "u-boot raw 1 2048"
> - CONFIG_DFU_BOOT_ALT_eMMC, e.g: "u-boot raw 0 2048 mmcpart 1"
> 
> Signed-off-by: Przemyslaw Marczak <p.marczak at samsung.com>
> Cc: Piotr Wilczek <p.wilczek at samsung.com>
> Cc: Minkyu Kang <mk7.kang at samsung.com>
> ---
>  board/samsung/common/board.c |  3 +++
>  board/samsung/common/misc.c  | 23 +++++++++++++++++++++++
>  include/samsung/misc.h       |  4 ++++
>  3 files changed, 30 insertions(+)
> 
> diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c
> index 2970340..9a745d9 100644
> --- a/board/samsung/common/board.c
> +++ b/board/samsung/common/board.c
> @@ -323,6 +323,9 @@ int arch_early_init_r(void)
>  #ifdef CONFIG_MISC_INIT_R
>  int misc_init_r(void)
>  {
> +#ifdef CONFIG_SET_DFU_BOOT_ALT
> +	set_dfu_boot_alt(bootmode);
> +#endif
>  #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
>  	set_board_info();
>  #endif
> diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
> index a453a82..d31583b 100644
> --- a/board/samsung/common/misc.c
> +++ b/board/samsung/common/misc.c
> @@ -21,6 +21,29 @@
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> +#ifdef CONFIG_SET_DFU_BOOT_ALT
> +void set_dfu_boot_alt(int bootmode)
> +{
> +	char *alt_bootloader = NULL;
> +
> +	switch (bootmode) {
> +	case BOOT_SDMMC:
> +#ifdef CONFIG_DFU_BOOT_ALT_SD
> +		alt_bootloader = CONFIG_DFU_BOOT_ALT_SD;
> +#endif
> +		break;
> +	default:
> +#ifdef CONFIG_DFU_BOOT_ALT_EMMC
> +		alt_bootloader = CONFIG_DFU_BOOT_ALT_EMMC;
> +#endif
> +		break;
> +	}
> +
> +	if (alt_bootloader)
> +		setenv("dfu_alt_bootloader", alt_bootloader);
> +}
> +#endif
> +
>  #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
>  void set_board_info(void)
>  {
> diff --git a/include/samsung/misc.h b/include/samsung/misc.h
> index 87b53ec..dfc0946 100644
> --- a/include/samsung/misc.h
> +++ b/include/samsung/misc.h
> @@ -33,4 +33,8 @@ void draw_logo(void);
>  #define BOOT_MODE_SHIFT	(0x1)
>  #define BOOT_MODE(x)	((x >> BOOT_MODE_SHIFT) & BOOT_MODE_MASK)
>  
> +#ifdef CONFIG_SET_DFU_BOOT_ALT
> +void set_dfu_boot_alt(int bootmode);
> +#endif
> +
>  #endif /* __SAMSUNG_MISC_COMMON_H__ */
> -- 
> 1.9.1
> 


More information about the U-Boot mailing list