diff mbox series

xilinx: zynqmp: Add bootmenu support

Message ID 6193d95a9c0f3ae319a900b46d6212f7ab16aba4.1726041851.git.michal.simek@amd.com
State Accepted
Commit 61bf0fa8663d85c5d4088a9f82c9244181f3adce
Delegated to: Michal Simek
Headers show
Series xilinx: zynqmp: Add bootmenu support | expand

Commit Message

Michal Simek Sept. 11, 2024, 8:04 a.m. UTC
From: John Vicky Vykuntapu <johnvicky.vykuntapu@amd.com>

Popup the bootmenu for 5 sec with default boot options to CC on AMD CCs and
default to SOM on others.
Users can anytime disable the bootmenu by setting the variable
enable_bootmenu=0 in zynqmp_kria.env or setup it up at run time and save
variables to NV memory.

The patch is also fixing issue created by commit 4c7363068651 ("cmd:
setexpr: fix no matching string in gsub return empty value") which has
changed return value from setexpr command (Before this commit when
matching string wasn't found command return 1 that's why was possible to
use with if).

Signed-off-by: John Vicky Vykuntapu <johnvicky.vykuntapu@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
---

 board/xilinx/zynqmp/zynqmp_kria.env | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Comments

Simon Glass Sept. 12, 2024, 1 a.m. UTC | #1
Hi Michal,

On Wed, 11 Sept 2024 at 02:04, Michal Simek <michal.simek@amd.com> wrote:
>
> From: John Vicky Vykuntapu <johnvicky.vykuntapu@amd.com>
>
> Popup the bootmenu for 5 sec with default boot options to CC on AMD CCs and
> default to SOM on others.
> Users can anytime disable the bootmenu by setting the variable
> enable_bootmenu=0 in zynqmp_kria.env or setup it up at run time and save
> variables to NV memory.
>
> The patch is also fixing issue created by commit 4c7363068651 ("cmd:
> setexpr: fix no matching string in gsub return empty value") which has
> changed return value from setexpr command (Before this commit when
> matching string wasn't found command return 1 that's why was possible to
> use with if).
>
> Signed-off-by: John Vicky Vykuntapu <johnvicky.vykuntapu@amd.com>
> Signed-off-by: Michal Simek <michal.simek@amd.com>
> ---
>
>  board/xilinx/zynqmp/zynqmp_kria.env | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)

Can this use standard boot? For example 'bootflow scan -lb mmc' ?

>
> diff --git a/board/xilinx/zynqmp/zynqmp_kria.env b/board/xilinx/zynqmp/zynqmp_kria.env
> index 49ef3e7d7532..d0e431ebb46f 100644
> --- a/board/xilinx/zynqmp/zynqmp_kria.env
> +++ b/board/xilinx/zynqmp/zynqmp_kria.env
> @@ -49,9 +49,19 @@ usb_boot_devices='usb0 usb1 usb2 usb3 usb4'
>  som_cc_boot=if test ${card1_name} = SCK-KV-G; then setenv boot_targets mmc1 ${usb_boot_devices} pxe dhcp jtag && run distro_bootcmd; elif test ${card1_name} = SCK-KR-G; then setenv boot_targets ${usb_boot_devices} pxe dhcp jtag && run distro_bootcmd; else test ${card1_name} = SCK-KD-G; setenv boot_targets ${usb_boot_devices} pxe dhcp jtag && run distro_bootcmd; fi;"
>  som_mmc_boot=setenv boot_targets mmc0 && run distro_bootcmd
>
> +# To disable bootmenu set enable_bootmenu=0
> +enable_bootmenu=1
> +check_cc_for_default_boot=if test ${card1_name} = SCK-KV-G || test ${card1_name} = SCK-KR-G || test ${card1_name} = SCK-KD-G; then setenv bootmenu_default 1; else setenv bootmenu_default 0; fi
> +som_bootmenu=if test ${enable_bootmenu} = 1; then run check_cc_for_default_boot; bootmenu; else run som_mmc_boot; fi
> +
>  k26_starter=SMK-K26-XCL2G
>  k24_starter=SMK-K24-XCL2G
> -bootcmd=setenv model $board_name && if setexpr model gsub .*$k24_starter* $k24_starter || setexpr model gsub .*$k26_starter* $k26_starter; then run som_cc_boot; else run som_mmc_boot; run som_cc_boot; fi
> +bootcmd=setenv model $board_name; setexpr model gsub ".*${k24_starter}.*" starter; setexpr model gsub ".*${k26_starter}.*" starter; if test ${model} = "starter"; then run som_cc_boot; else run som_bootmenu; fi
> +
> +# Boot menu
> +bootmenu_0=eMMC Boot=run som_mmc_boot
> +bootmenu_1=SD Boot=run som_cc_boot

Would bootstd find these automatically?

> +bootmenu_delay=5
>
>  usb_hub_init=mw 1000 0056 && sleep 1 && i2c write 1000 2d aa 2 -s
>
> --
> 2.43.0
>

Regards,
Simon
Michal Simek Sept. 16, 2024, 11:49 a.m. UTC | #2
On 9/12/24 03:00, Simon Glass wrote:
> Hi Michal,
> 
> On Wed, 11 Sept 2024 at 02:04, Michal Simek <michal.simek@amd.com> wrote:
>>
>> From: John Vicky Vykuntapu <johnvicky.vykuntapu@amd.com>
>>
>> Popup the bootmenu for 5 sec with default boot options to CC on AMD CCs and
>> default to SOM on others.
>> Users can anytime disable the bootmenu by setting the variable
>> enable_bootmenu=0 in zynqmp_kria.env or setup it up at run time and save
>> variables to NV memory.
>>
>> The patch is also fixing issue created by commit 4c7363068651 ("cmd:
>> setexpr: fix no matching string in gsub return empty value") which has
>> changed return value from setexpr command (Before this commit when
>> matching string wasn't found command return 1 that's why was possible to
>> use with if).
>>
>> Signed-off-by: John Vicky Vykuntapu <johnvicky.vykuntapu@amd.com>
>> Signed-off-by: Michal Simek <michal.simek@amd.com>
>> ---
>>
>>   board/xilinx/zynqmp/zynqmp_kria.env | 12 +++++++++++-
>>   1 file changed, 11 insertions(+), 1 deletion(-)
> 
> Can this use standard boot? For example 'bootflow scan -lb mmc' ?

We didn't switch to it yet.


>>
>> diff --git a/board/xilinx/zynqmp/zynqmp_kria.env b/board/xilinx/zynqmp/zynqmp_kria.env
>> index 49ef3e7d7532..d0e431ebb46f 100644
>> --- a/board/xilinx/zynqmp/zynqmp_kria.env
>> +++ b/board/xilinx/zynqmp/zynqmp_kria.env
>> @@ -49,9 +49,19 @@ usb_boot_devices='usb0 usb1 usb2 usb3 usb4'
>>   som_cc_boot=if test ${card1_name} = SCK-KV-G; then setenv boot_targets mmc1 ${usb_boot_devices} pxe dhcp jtag && run distro_bootcmd; elif test ${card1_name} = SCK-KR-G; then setenv boot_targets ${usb_boot_devices} pxe dhcp jtag && run distro_bootcmd; else test ${card1_name} = SCK-KD-G; setenv boot_targets ${usb_boot_devices} pxe dhcp jtag && run distro_bootcmd; fi;"
>>   som_mmc_boot=setenv boot_targets mmc0 && run distro_bootcmd
>>
>> +# To disable bootmenu set enable_bootmenu=0
>> +enable_bootmenu=1
>> +check_cc_for_default_boot=if test ${card1_name} = SCK-KV-G || test ${card1_name} = SCK-KR-G || test ${card1_name} = SCK-KD-G; then setenv bootmenu_default 1; else setenv bootmenu_default 0; fi
>> +som_bootmenu=if test ${enable_bootmenu} = 1; then run check_cc_for_default_boot; bootmenu; else run som_mmc_boot; fi
>> +
>>   k26_starter=SMK-K26-XCL2G
>>   k24_starter=SMK-K24-XCL2G
>> -bootcmd=setenv model $board_name && if setexpr model gsub .*$k24_starter* $k24_starter || setexpr model gsub .*$k26_starter* $k26_starter; then run som_cc_boot; else run som_mmc_boot; run som_cc_boot; fi
>> +bootcmd=setenv model $board_name; setexpr model gsub ".*${k24_starter}.*" starter; setexpr model gsub ".*${k26_starter}.*" starter; if test ${model} = "starter"; then run som_cc_boot; else run som_bootmenu; fi
>> +
>> +# Boot menu
>> +bootmenu_0=eMMC Boot=run som_mmc_boot
>> +bootmenu_1=SD Boot=run som_cc_boot
> 
> Would bootstd find these automatically?

It will add them as targets but without specifying which mmc controller is SD 
and which one is EMMC.

I pretty much think that we should look what would be the best way to move to 
bootflows and how to do scan for some devices. Because I can't see support for 
NAND, JTAG(ram) and also dfu/thor.

Thanks,
Michal
Michal Simek Sept. 20, 2024, 1:33 p.m. UTC | #3
On 9/11/24 10:04, Michal Simek wrote:
> From: John Vicky Vykuntapu <johnvicky.vykuntapu@amd.com>
> 
> Popup the bootmenu for 5 sec with default boot options to CC on AMD CCs and
> default to SOM on others.
> Users can anytime disable the bootmenu by setting the variable
> enable_bootmenu=0 in zynqmp_kria.env or setup it up at run time and save
> variables to NV memory.
> 
> The patch is also fixing issue created by commit 4c7363068651 ("cmd:
> setexpr: fix no matching string in gsub return empty value") which has
> changed return value from setexpr command (Before this commit when
> matching string wasn't found command return 1 that's why was possible to
> use with if).
> 
> Signed-off-by: John Vicky Vykuntapu <johnvicky.vykuntapu@amd.com>
> Signed-off-by: Michal Simek <michal.simek@amd.com>
> ---
> 
>   board/xilinx/zynqmp/zynqmp_kria.env | 12 +++++++++++-
>   1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/board/xilinx/zynqmp/zynqmp_kria.env b/board/xilinx/zynqmp/zynqmp_kria.env
> index 49ef3e7d7532..d0e431ebb46f 100644
> --- a/board/xilinx/zynqmp/zynqmp_kria.env
> +++ b/board/xilinx/zynqmp/zynqmp_kria.env
> @@ -49,9 +49,19 @@ usb_boot_devices='usb0 usb1 usb2 usb3 usb4'
>   som_cc_boot=if test ${card1_name} = SCK-KV-G; then setenv boot_targets mmc1 ${usb_boot_devices} pxe dhcp jtag && run distro_bootcmd; elif test ${card1_name} = SCK-KR-G; then setenv boot_targets ${usb_boot_devices} pxe dhcp jtag && run distro_bootcmd; else test ${card1_name} = SCK-KD-G; setenv boot_targets ${usb_boot_devices} pxe dhcp jtag && run distro_bootcmd; fi;"
>   som_mmc_boot=setenv boot_targets mmc0 && run distro_bootcmd
>   
> +# To disable bootmenu set enable_bootmenu=0
> +enable_bootmenu=1
> +check_cc_for_default_boot=if test ${card1_name} = SCK-KV-G || test ${card1_name} = SCK-KR-G || test ${card1_name} = SCK-KD-G; then setenv bootmenu_default 1; else setenv bootmenu_default 0; fi
> +som_bootmenu=if test ${enable_bootmenu} = 1; then run check_cc_for_default_boot; bootmenu; else run som_mmc_boot; fi
> +
>   k26_starter=SMK-K26-XCL2G
>   k24_starter=SMK-K24-XCL2G
> -bootcmd=setenv model $board_name && if setexpr model gsub .*$k24_starter* $k24_starter || setexpr model gsub .*$k26_starter* $k26_starter; then run som_cc_boot; else run som_mmc_boot; run som_cc_boot; fi
> +bootcmd=setenv model $board_name; setexpr model gsub ".*${k24_starter}.*" starter; setexpr model gsub ".*${k26_starter}.*" starter; if test ${model} = "starter"; then run som_cc_boot; else run som_bootmenu; fi
> +
> +# Boot menu
> +bootmenu_0=eMMC Boot=run som_mmc_boot
> +bootmenu_1=SD Boot=run som_cc_boot
> +bootmenu_delay=5
>   
>   usb_hub_init=mw 1000 0056 && sleep 1 && i2c write 1000 2d aa 2 -s
>   

Applied.
M
diff mbox series

Patch

diff --git a/board/xilinx/zynqmp/zynqmp_kria.env b/board/xilinx/zynqmp/zynqmp_kria.env
index 49ef3e7d7532..d0e431ebb46f 100644
--- a/board/xilinx/zynqmp/zynqmp_kria.env
+++ b/board/xilinx/zynqmp/zynqmp_kria.env
@@ -49,9 +49,19 @@  usb_boot_devices='usb0 usb1 usb2 usb3 usb4'
 som_cc_boot=if test ${card1_name} = SCK-KV-G; then setenv boot_targets mmc1 ${usb_boot_devices} pxe dhcp jtag && run distro_bootcmd; elif test ${card1_name} = SCK-KR-G; then setenv boot_targets ${usb_boot_devices} pxe dhcp jtag && run distro_bootcmd; else test ${card1_name} = SCK-KD-G; setenv boot_targets ${usb_boot_devices} pxe dhcp jtag && run distro_bootcmd; fi;"
 som_mmc_boot=setenv boot_targets mmc0 && run distro_bootcmd
 
+# To disable bootmenu set enable_bootmenu=0
+enable_bootmenu=1
+check_cc_for_default_boot=if test ${card1_name} = SCK-KV-G || test ${card1_name} = SCK-KR-G || test ${card1_name} = SCK-KD-G; then setenv bootmenu_default 1; else setenv bootmenu_default 0; fi
+som_bootmenu=if test ${enable_bootmenu} = 1; then run check_cc_for_default_boot; bootmenu; else run som_mmc_boot; fi
+
 k26_starter=SMK-K26-XCL2G
 k24_starter=SMK-K24-XCL2G
-bootcmd=setenv model $board_name && if setexpr model gsub .*$k24_starter* $k24_starter || setexpr model gsub .*$k26_starter* $k26_starter; then run som_cc_boot; else run som_mmc_boot; run som_cc_boot; fi
+bootcmd=setenv model $board_name; setexpr model gsub ".*${k24_starter}.*" starter; setexpr model gsub ".*${k26_starter}.*" starter; if test ${model} = "starter"; then run som_cc_boot; else run som_bootmenu; fi
+
+# Boot menu
+bootmenu_0=eMMC Boot=run som_mmc_boot
+bootmenu_1=SD Boot=run som_cc_boot
+bootmenu_delay=5
 
 usb_hub_init=mw 1000 0056 && sleep 1 && i2c write 1000 2d aa 2 -s