Hi Shyam, Jagan,

On 26/04/19 11:01, Shyam Saini wrote:
> From: Jagan Teki <[email protected]>
> 
> 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 <[email protected]>
> Signed-off-by: Jagan Teki <[email protected]>
> ---
>  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: [email protected]
=====================================================================
_______________________________________________
U-Boot mailing list
[email protected]
https://lists.denx.de/listinfo/u-boot

Reply via email to