[U-Boot] [PATCH 1/2] board: engicam: Handle mmc recovery partition, root

Stefano Babic sbabic at denx.de
Mon Jun 10 09:44:22 UTC 2019


Hi Shyam, Jagan,

On 26/04/19 11:01, Shyam Saini wrote:
> From: Jagan Teki <jagan at amarulasolutions.com>
> 
> Since i.CoreM6 support recovery boot via bootcount, update
> the mmcpart and mmcroot dynamically based on used mmc partition
> layout instead statically defined in include/configs.
> 
> Tested-by: Shyam Saini <shyam.saini at amarulasolutions.com>
> Signed-off-by: Jagan Teki <jagan at amarulasolutions.com>
> ---
>  board/engicam/common/board.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/board/engicam/common/board.c b/board/engicam/common/board.c
> index 7486f0ac2d..571d36fc63 100644
> --- a/board/engicam/common/board.c
> +++ b/board/engicam/common/board.c
> @@ -19,12 +19,20 @@ static void mmc_late_init(void)
>  {
>  	char cmd[32];
>  	char mmcblk[32];
> +	unsigned long bootcount = bootcount_load() + 1;

Does it work ? I cannot build with this set because bootcount_load is
not defined.

> +	unsigned long bootlimit = env_get_ulong("bootlimit", 10, 0);
>  	u32 dev_no = mmc_get_env_dev();
> +	u32 mmcpart = 1;
>  
>  	env_set_ulong("mmcdev", dev_no);
>  
> +	if (bootlimit && bootcount > bootlimit)
> +		mmcpart = 3;
> +
> +	env_set_ulong("mmcpart", mmcpart);
> +
>  	/* Set mmcblk env */
> -	sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw", dev_no);
> +	sprintf(mmcblk, "/dev/mmcblk%dp%d rootwait rw", dev_no, mmcpart + 1);

Maybe I repeat myself - this is your board, and fine for me if you do in
this way. But is not much more flexible to do this with a script instead
of hard code into the board file ?

>  	env_set("mmcroot", mmcblk);
>  
>  	sprintf(cmd, "mmc dev %d", dev_no);
> 

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================


More information about the U-Boot mailing list