[v8,20/23] package/ti-k3: fix BR2_PACKAGE_TI_K3_SOC setting for am64x SOC

Message ID 20240301133620.3547430-21-dario.binacchi@amarulasolutions.com
State New
Headers show
Series
  • Add support for AM62x-SK HS-FS devices
Related show

Commit Message

Dario Binacchi March 1, 2024, 1:36 p.m. UTC
In the case of SOC am64x, ti-k3-r5-loader creates the following
tiboot3.bin files:
- GP    -> tiboot3_am64x-gp-evm.bin
- HS    -> tiboot3_am64x_sr2-hs-evm.bin
- HS_FS -> tiboot3_am64x_sr2-hs-fs-evm.bin

The patch allows you to identify the correct file based on the SEC_TYPE
option.

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>

---

Added in v8

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
 package/ti-k3/Config.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Romain Naour March 2, 2024, 11:06 a.m. UTC | #1
Hi Dario,

Le 01/03/2024 à 14:36, Dario Binacchi a écrit :
> In the case of SOC am64x, ti-k3-r5-loader creates the following
> tiboot3.bin files:
> - GP    -> tiboot3_am64x-gp-evm.bin
> - HS    -> tiboot3_am64x_sr2-hs-evm.bin
> - HS_FS -> tiboot3_am64x_sr2-hs-fs-evm.bin
> 
> The patch allows you to identify the correct file based on the SEC_TYPE
> option.

It seems this patch should be merged with the AM64x u-boot version bump since
ti-k3-r5 (aka u-boot) now provide tiboot3.bin.

Also other TI K3 SoC variant like AM65 provide a sr2 binary:

tiboot3-am62ax-hs-fs-evm.bin
tiboot3-am62ax-gp-evm.bin
tiboot3-am62ax-hs-evm.bin

tiboot3-am62px-hs-fs-evm.bin

tiboot3-am62x-hs-fs-evm.bin
tiboot3-am62x-gp-evm.bin
tiboot3-am62x-hs-evm.bin

tiboot3-am64x_sr2-hs-fs-evm.bin
tiboot3-am64x-gp-evm.bin
tiboot3-am64x_sr2-hs-evm.bin

tiboot3-am65x_sr2-gp-evm.bin
tiboot3-am65x_sr2-hs-evm.bin

tiboot3-j7200-gp-evm.bin
tiboot3-j7200_sr2-hs-fs-evm.bin
tiboot3-j7200_sr2-hs-evm.bin

tiboot3-j721e-gp-evm.bin
tiboot3-j721e_sr2-hs-fs-evm.bin
tiboot3-j721e_sr1_1-hs-evm.bin

tiboot3-j721s2-gp-evm.bin
tiboot3-j721s2-hs-fs-evm.bin

tiboot3-j722s-hs-fs-evm.bin

tiboot3-j784s4-gp-evm.bin
tiboot3-j784s4-hs-fs-evm.bin

Maybe we need to introduce TI_K3_R5_LOADER_SOC_SUFFIX to handle sr2, sr1_1 or "" ?

Best regards,
Romain


> 
> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> 
> ---
> 
> Added in v8
> 
> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> ---
>  package/ti-k3/Config.in | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/package/ti-k3/Config.in b/package/ti-k3/Config.in
> index b8545b7bca62..9c61f8880a15 100644
> --- a/package/ti-k3/Config.in
> +++ b/package/ti-k3/Config.in
> @@ -43,7 +43,8 @@ config BR2_PACKAGE_TI_K3_SOC
>  	string
>  	default "am62ax" if BR2_PACKAGE_TI_K3_SOC_AM62AX
>  	default "am62x"  if BR2_PACKAGE_TI_K3_SOC_AM62X
> -	default "am64x"  if BR2_PACKAGE_TI_K3_SOC_AM64X
> +	default "am64x"  if BR2_PACKAGE_TI_K3_SOC_AM64X && BR2_PACKAGE_TI_K3_SECTYPE_GP
> +	default "am64x_sr2"  if BR2_PACKAGE_TI_K3_SOC_AM64X && !BR2_PACKAGE_TI_K3_SECTYPE_GP
>  	default "am65x"  if BR2_PACKAGE_TI_K3_SOC_AM65X
>  
>  config BR2_PACKAGE_TI_K3_SECTYPE
Dario Binacchi March 2, 2024, 2:21 p.m. UTC | #2
Hi Romain, All,

On Sat, Mar 2, 2024 at 12:06 PM Romain Naour <romain.naour@smile.fr> wrote:
>
> Hi Dario,
>
> Le 01/03/2024 à 14:36, Dario Binacchi a écrit :
> > In the case of SOC am64x, ti-k3-r5-loader creates the following
> > tiboot3.bin files:
> > - GP    -> tiboot3_am64x-gp-evm.bin
> > - HS    -> tiboot3_am64x_sr2-hs-evm.bin
> > - HS_FS -> tiboot3_am64x_sr2-hs-fs-evm.bin
> >
> > The patch allows you to identify the correct file based on the SEC_TYPE
> > option.
>
> It seems this patch should be merged with the AM64x u-boot version bump since
> ti-k3-r5 (aka u-boot) now provide tiboot3.bin.

I will squash it to [PATCH 21/23] configs/ti_am64x_sk_defconfig: bump
U-Boot version to 2024.01

>
> Also other TI K3 SoC variant like AM65 provide a sr2 binary:
>
> tiboot3-am62ax-hs-fs-evm.bin
> tiboot3-am62ax-gp-evm.bin
> tiboot3-am62ax-hs-evm.bin
>
> tiboot3-am62px-hs-fs-evm.bin
>
> tiboot3-am62x-hs-fs-evm.bin
> tiboot3-am62x-gp-evm.bin
> tiboot3-am62x-hs-evm.bin
>
> tiboot3-am64x_sr2-hs-fs-evm.bin
> tiboot3-am64x-gp-evm.bin
> tiboot3-am64x_sr2-hs-evm.bin
>
> tiboot3-am65x_sr2-gp-evm.bin
> tiboot3-am65x_sr2-hs-evm.bin
>
> tiboot3-j7200-gp-evm.bin
> tiboot3-j7200_sr2-hs-fs-evm.bin
> tiboot3-j7200_sr2-hs-evm.bin
>
> tiboot3-j721e-gp-evm.bin
> tiboot3-j721e_sr2-hs-fs-evm.bin
> tiboot3-j721e_sr1_1-hs-evm.bin
>
> tiboot3-j721s2-gp-evm.bin
> tiboot3-j721s2-hs-fs-evm.bin
>
> tiboot3-j722s-hs-fs-evm.bin
>
> tiboot3-j784s4-gp-evm.bin
> tiboot3-j784s4-hs-fs-evm.bin
>
> Maybe we need to introduce TI_K3_R5_LOADER_SOC_SUFFIX to handle sr2, sr1_1 or "" ?
>
At first, I also thought about a new configuration to specify an
additional suffix, but after verifying
that BR2_PACKAGE_TI_K3_SOC is only used in
boot/ti-k3-r5-loader/ti-k3-r5-loader.mk, the
adopted solution:

-       default "am64x"  if BR2_PACKAGE_TI_K3_SOC_AM64X
+       default "am64x"  if BR2_PACKAGE_TI_K3_SOC_AM64X &&
BR2_PACKAGE_TI_K3_SECTYPE_GP
+       default "am64x_sr2"  if BR2_PACKAGE_TI_K3_SOC_AM64X &&
!BR2_PACKAGE_TI_K3_SECTYPE_GP

seemed the simplest to me.

And I think this approach can also be used for the variants you
listed, since for each {SOC,SEC_TYPE} pair
there exists one and only one tiboot3.bin.

Furthermore, if I'm not missing anything, this remains the only
adjustment we need to make since there are no
other configurations in buildroot among those you listed. So, in my
humble opinion, for now, this should be fine.

So, please let me know if, in addition to squashing this patch into
"[21/23] configs/ti_am64x_sk_defconfig:
bump U-Boot version to 2024.01", I need to make any other adjustments
for version 9.

Thanks and regards,
Dario

> Best regards,
> Romain
>
>
> >
> > Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> >
> > ---
> >
> > Added in v8
> >
> > Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> > ---
> >  package/ti-k3/Config.in | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/package/ti-k3/Config.in b/package/ti-k3/Config.in
> > index b8545b7bca62..9c61f8880a15 100644
> > --- a/package/ti-k3/Config.in
> > +++ b/package/ti-k3/Config.in
> > @@ -43,7 +43,8 @@ config BR2_PACKAGE_TI_K3_SOC
> >       string
> >       default "am62ax" if BR2_PACKAGE_TI_K3_SOC_AM62AX
> >       default "am62x"  if BR2_PACKAGE_TI_K3_SOC_AM62X
> > -     default "am64x"  if BR2_PACKAGE_TI_K3_SOC_AM64X
> > +     default "am64x"  if BR2_PACKAGE_TI_K3_SOC_AM64X && BR2_PACKAGE_TI_K3_SECTYPE_GP
> > +     default "am64x_sr2"  if BR2_PACKAGE_TI_K3_SOC_AM64X && !BR2_PACKAGE_TI_K3_SECTYPE_GP
> >       default "am65x"  if BR2_PACKAGE_TI_K3_SOC_AM65X
> >
> >  config BR2_PACKAGE_TI_K3_SECTYPE
>
Romain Naour March 2, 2024, 10:52 p.m. UTC | #3
Hello Dario,

Le 02/03/2024 à 15:21, Dario Binacchi a écrit :
> Hi Romain, All,
> 
> On Sat, Mar 2, 2024 at 12:06 PM Romain Naour <romain.naour@smile.fr> wrote:
>>
>> Hi Dario,
>>
>> Le 01/03/2024 à 14:36, Dario Binacchi a écrit :
>>> In the case of SOC am64x, ti-k3-r5-loader creates the following
>>> tiboot3.bin files:
>>> - GP    -> tiboot3_am64x-gp-evm.bin
>>> - HS    -> tiboot3_am64x_sr2-hs-evm.bin
>>> - HS_FS -> tiboot3_am64x_sr2-hs-fs-evm.bin
>>>
>>> The patch allows you to identify the correct file based on the SEC_TYPE
>>> option.
>>
>> It seems this patch should be merged with the AM64x u-boot version bump since
>> ti-k3-r5 (aka u-boot) now provide tiboot3.bin.
> 
> I will squash it to [PATCH 21/23] configs/ti_am64x_sk_defconfig: bump
> U-Boot version to 2024.01

Ok

> 
>>
>> Also other TI K3 SoC variant like AM65 provide a sr2 binary:
>>
>> tiboot3-am62ax-hs-fs-evm.bin
>> tiboot3-am62ax-gp-evm.bin
>> tiboot3-am62ax-hs-evm.bin
>>
>> tiboot3-am62px-hs-fs-evm.bin
>>
>> tiboot3-am62x-hs-fs-evm.bin
>> tiboot3-am62x-gp-evm.bin
>> tiboot3-am62x-hs-evm.bin
>>
>> tiboot3-am64x_sr2-hs-fs-evm.bin
>> tiboot3-am64x-gp-evm.bin
>> tiboot3-am64x_sr2-hs-evm.bin
>>
>> tiboot3-am65x_sr2-gp-evm.bin
>> tiboot3-am65x_sr2-hs-evm.bin
>>
>> tiboot3-j7200-gp-evm.bin
>> tiboot3-j7200_sr2-hs-fs-evm.bin
>> tiboot3-j7200_sr2-hs-evm.bin
>>
>> tiboot3-j721e-gp-evm.bin
>> tiboot3-j721e_sr2-hs-fs-evm.bin
>> tiboot3-j721e_sr1_1-hs-evm.bin
>>
>> tiboot3-j721s2-gp-evm.bin
>> tiboot3-j721s2-hs-fs-evm.bin
>>
>> tiboot3-j722s-hs-fs-evm.bin
>>
>> tiboot3-j784s4-gp-evm.bin
>> tiboot3-j784s4-hs-fs-evm.bin
>>
>> Maybe we need to introduce TI_K3_R5_LOADER_SOC_SUFFIX to handle sr2, sr1_1 or "" ?
>>
> At first, I also thought about a new configuration to specify an
> additional suffix, but after verifying
> that BR2_PACKAGE_TI_K3_SOC is only used in
> boot/ti-k3-r5-loader/ti-k3-r5-loader.mk, the
> adopted solution:
> 
> -       default "am64x"  if BR2_PACKAGE_TI_K3_SOC_AM64X
> +       default "am64x"  if BR2_PACKAGE_TI_K3_SOC_AM64X &&
> BR2_PACKAGE_TI_K3_SECTYPE_GP
> +       default "am64x_sr2"  if BR2_PACKAGE_TI_K3_SOC_AM64X &&
> !BR2_PACKAGE_TI_K3_SECTYPE_GP
> 
> seemed the simplest to me.
> 
> And I think this approach can also be used for the variants you
> listed, since for each {SOC,SEC_TYPE} pair
> there exists one and only one tiboot3.bin.

What about removing BR2_PACKAGE_TI_K3_SOC and BR2_PACKAGE_TI_K3_SECTYPE
(inherited from ti-k3-image-gen, so we need them until we can remove this
package) we just need to know the name of the file we should copy based on TI K3
SoC and Security type selection.

config BR2_PACKAGE_TI_K3_TIBOOT3_BIN
	string
	default "tiboot3-am62ax-gp-evm.bin" if BR2_PACKAGE_TI_K3_SOC_AM62AX &&
BR2_PACKAGE_TI_K3_SECTYPE_GP
	default "tiboot3-am62ax-hs-evm.bin" if BR2_PACKAGE_TI_K3_SOC_AM62AX &&
BR2_PACKAGE_TI_K3_SECTYPE_HS
	default "tiboot3-am62ax-hs-fs-evm.bin" if BR2_PACKAGE_TI_K3_SOC_AM62AX &&
BR2_PACKAGE_TI_K3_SECTYPE_HS_FS
...

 define TI_K3_R5_LOADER_INSTALL_IMAGES_CMDS
 	cp $(@D)/spl/u-boot-spl.bin $(BINARIES_DIR)/r5-u-boot-spl.bin
	cp $(@D)/$(BR2_PACKAGE_TI_K3_TIBOOT3_BIN) $(BINARIES_DIR)/tiboot3.bin
 endef

So we can avoid using complex find -regex -exec -cp command :)

BR2_PACKAGE_TI_K3_TIBOOT3_BIN can be defined in ti-k3-r5-loader package.

Best regards,
Romain


> 
> Furthermore, if I'm not missing anything, this remains the only
> adjustment we need to make since there are no
> other configurations in buildroot among those you listed. So, in my
> humble opinion, for now, this should be fine.
> 
> So, please let me know if, in addition to squashing this patch into
> "[21/23] configs/ti_am64x_sk_defconfig:
> bump U-Boot version to 2024.01", I need to make any other adjustments
> for version 9.
> 
> Thanks and regards,
> Dario
> 
>> Best regards,
>> Romain
>>
>>
>>>
>>> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
>>>
>>> ---
>>>
>>> Added in v8
>>>
>>> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
>>> ---
>>>  package/ti-k3/Config.in | 3 ++-
>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/package/ti-k3/Config.in b/package/ti-k3/Config.in
>>> index b8545b7bca62..9c61f8880a15 100644
>>> --- a/package/ti-k3/Config.in
>>> +++ b/package/ti-k3/Config.in
>>> @@ -43,7 +43,8 @@ config BR2_PACKAGE_TI_K3_SOC
>>>       string
>>>       default "am62ax" if BR2_PACKAGE_TI_K3_SOC_AM62AX
>>>       default "am62x"  if BR2_PACKAGE_TI_K3_SOC_AM62X
>>> -     default "am64x"  if BR2_PACKAGE_TI_K3_SOC_AM64X
>>> +     default "am64x"  if BR2_PACKAGE_TI_K3_SOC_AM64X && BR2_PACKAGE_TI_K3_SECTYPE_GP
>>> +     default "am64x_sr2"  if BR2_PACKAGE_TI_K3_SOC_AM64X && !BR2_PACKAGE_TI_K3_SECTYPE_GP
>>>       default "am65x"  if BR2_PACKAGE_TI_K3_SOC_AM65X
>>>
>>>  config BR2_PACKAGE_TI_K3_SECTYPE
>>
> 
>
Dario Binacchi March 3, 2024, 9:50 a.m. UTC | #4
Hello Romain,

On Sat, Mar 2, 2024 at 11:52 PM Romain Naour <romain.naour@smile.fr> wrote:
>
> Hello Dario,
>
> Le 02/03/2024 à 15:21, Dario Binacchi a écrit :
> > Hi Romain, All,
> >
> > On Sat, Mar 2, 2024 at 12:06 PM Romain Naour <romain.naour@smile.fr> wrote:
> >>
> >> Hi Dario,
> >>
> >> Le 01/03/2024 à 14:36, Dario Binacchi a écrit :
> >>> In the case of SOC am64x, ti-k3-r5-loader creates the following
> >>> tiboot3.bin files:
> >>> - GP    -> tiboot3_am64x-gp-evm.bin
> >>> - HS    -> tiboot3_am64x_sr2-hs-evm.bin
> >>> - HS_FS -> tiboot3_am64x_sr2-hs-fs-evm.bin
> >>>
> >>> The patch allows you to identify the correct file based on the SEC_TYPE
> >>> option.
> >>
> >> It seems this patch should be merged with the AM64x u-boot version bump since
> >> ti-k3-r5 (aka u-boot) now provide tiboot3.bin.
> >
> > I will squash it to [PATCH 21/23] configs/ti_am64x_sk_defconfig: bump
> > U-Boot version to 2024.01
>
> Ok
>
> >
> >>
> >> Also other TI K3 SoC variant like AM65 provide a sr2 binary:
> >>
> >> tiboot3-am62ax-hs-fs-evm.bin
> >> tiboot3-am62ax-gp-evm.bin
> >> tiboot3-am62ax-hs-evm.bin
> >>
> >> tiboot3-am62px-hs-fs-evm.bin
> >>
> >> tiboot3-am62x-hs-fs-evm.bin
> >> tiboot3-am62x-gp-evm.bin
> >> tiboot3-am62x-hs-evm.bin
> >>
> >> tiboot3-am64x_sr2-hs-fs-evm.bin
> >> tiboot3-am64x-gp-evm.bin
> >> tiboot3-am64x_sr2-hs-evm.bin
> >>
> >> tiboot3-am65x_sr2-gp-evm.bin
> >> tiboot3-am65x_sr2-hs-evm.bin
> >>
> >> tiboot3-j7200-gp-evm.bin
> >> tiboot3-j7200_sr2-hs-fs-evm.bin
> >> tiboot3-j7200_sr2-hs-evm.bin
> >>
> >> tiboot3-j721e-gp-evm.bin
> >> tiboot3-j721e_sr2-hs-fs-evm.bin
> >> tiboot3-j721e_sr1_1-hs-evm.bin
> >>
> >> tiboot3-j721s2-gp-evm.bin
> >> tiboot3-j721s2-hs-fs-evm.bin
> >>
> >> tiboot3-j722s-hs-fs-evm.bin
> >>
> >> tiboot3-j784s4-gp-evm.bin
> >> tiboot3-j784s4-hs-fs-evm.bin
> >>
> >> Maybe we need to introduce TI_K3_R5_LOADER_SOC_SUFFIX to handle sr2, sr1_1 or "" ?
> >>
> > At first, I also thought about a new configuration to specify an
> > additional suffix, but after verifying
> > that BR2_PACKAGE_TI_K3_SOC is only used in
> > boot/ti-k3-r5-loader/ti-k3-r5-loader.mk, the
> > adopted solution:
> >
> > -       default "am64x"  if BR2_PACKAGE_TI_K3_SOC_AM64X
> > +       default "am64x"  if BR2_PACKAGE_TI_K3_SOC_AM64X &&
> > BR2_PACKAGE_TI_K3_SECTYPE_GP
> > +       default "am64x_sr2"  if BR2_PACKAGE_TI_K3_SOC_AM64X &&
> > !BR2_PACKAGE_TI_K3_SECTYPE_GP
> >
> > seemed the simplest to me.
> >
> > And I think this approach can also be used for the variants you
> > listed, since for each {SOC,SEC_TYPE} pair
> > there exists one and only one tiboot3.bin.
>
> What about removing BR2_PACKAGE_TI_K3_SOC and BR2_PACKAGE_TI_K3_SECTYPE
> (inherited from ti-k3-image-gen, so we need them until we can remove this
> package) we just need to know the name of the file we should copy based on TI K3
> SoC and Security type selection.
>
> config BR2_PACKAGE_TI_K3_TIBOOT3_BIN
>         string
>         default "tiboot3-am62ax-gp-evm.bin" if BR2_PACKAGE_TI_K3_SOC_AM62AX &&
> BR2_PACKAGE_TI_K3_SECTYPE_GP
>         default "tiboot3-am62ax-hs-evm.bin" if BR2_PACKAGE_TI_K3_SOC_AM62AX &&
> BR2_PACKAGE_TI_K3_SECTYPE_HS
>         default "tiboot3-am62ax-hs-fs-evm.bin" if BR2_PACKAGE_TI_K3_SOC_AM62AX &&
> BR2_PACKAGE_TI_K3_SECTYPE_HS_FS
> ...
>
>  define TI_K3_R5_LOADER_INSTALL_IMAGES_CMDS
>         cp $(@D)/spl/u-boot-spl.bin $(BINARIES_DIR)/r5-u-boot-spl.bin
>         cp $(@D)/$(BR2_PACKAGE_TI_K3_TIBOOT3_BIN) $(BINARIES_DIR)/tiboot3.bin
>  endef
>
> So we can avoid using complex find -regex -exec -cp command :)
>
> BR2_PACKAGE_TI_K3_TIBOOT3_BIN can be defined in ti-k3-r5-loader package.

Sure, for me it's fine.

However, this is an additional patch to add that isn't necessary at this moment.
Can we consider adding it after this series has been merged? I recall
that currently the compilation of
the Hs and HS-FS variants for am62x are broken. Therefore, having
verified with Andreas tests that the
changes made in this series are okay for am62x_sk_defconfig and
am64x_sk_defconfig, I would merge
the series as soon as possible and then proceed with implementing
further improvements.

So, my intention is to submit version 9 with the only change being the
squash of this patch to [PATCH 21/23]
"configs/ti_am64x_sk_defconfig: bump U-Boot version to 2024.01".

Do you agree?

Thanks and regards,
Dario

>
> Best regards,
> Romain
>
>
> >
> > Furthermore, if I'm not missing anything, this remains the only
> > adjustment we need to make since there are no
> > other configurations in buildroot among those you listed. So, in my
> > humble opinion, for now, this should be fine.
> >
> > So, please let me know if, in addition to squashing this patch into
> > "[21/23] configs/ti_am64x_sk_defconfig:
> > bump U-Boot version to 2024.01", I need to make any other adjustments
> > for version 9.
> >
> > Thanks and regards,
> > Dario
> >
> >> Best regards,
> >> Romain
> >>
> >>
> >>>
> >>> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> >>>
> >>> ---
> >>>
> >>> Added in v8
> >>>
> >>> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> >>> ---
> >>>  package/ti-k3/Config.in | 3 ++-
> >>>  1 file changed, 2 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/package/ti-k3/Config.in b/package/ti-k3/Config.in
> >>> index b8545b7bca62..9c61f8880a15 100644
> >>> --- a/package/ti-k3/Config.in
> >>> +++ b/package/ti-k3/Config.in
> >>> @@ -43,7 +43,8 @@ config BR2_PACKAGE_TI_K3_SOC
> >>>       string
> >>>       default "am62ax" if BR2_PACKAGE_TI_K3_SOC_AM62AX
> >>>       default "am62x"  if BR2_PACKAGE_TI_K3_SOC_AM62X
> >>> -     default "am64x"  if BR2_PACKAGE_TI_K3_SOC_AM64X
> >>> +     default "am64x"  if BR2_PACKAGE_TI_K3_SOC_AM64X && BR2_PACKAGE_TI_K3_SECTYPE_GP
> >>> +     default "am64x_sr2"  if BR2_PACKAGE_TI_K3_SOC_AM64X && !BR2_PACKAGE_TI_K3_SECTYPE_GP
> >>>       default "am65x"  if BR2_PACKAGE_TI_K3_SOC_AM65X
> >>>
> >>>  config BR2_PACKAGE_TI_K3_SECTYPE
> >>
> >
> >
>


--

Dario Binacchi

Senior Embedded Linux Developer

dario.binacchi@amarulasolutions.com
'Krzysztof Kozlowski' via Amarula Linux March 5, 2024, 6:59 a.m. UTC | #5
Dario, Romain,

On Sun, Mar 03, 2024 at 10:50:10AM +0100, Dario Binacchi wrote:
> Hello Romain,
> 
> On Sat, Mar 2, 2024 at 11:52 PM Romain Naour <romain.naour@smile.fr> wrote:
> >
> > Hello Dario,
> >
> > Le 02/03/2024 à 15:21, Dario Binacchi a écrit :
> > > Hi Romain, All,
> > >
> > > On Sat, Mar 2, 2024 at 12:06 PM Romain Naour <romain.naour@smile.fr> wrote:
> > >>
> > >> Hi Dario,
> > >>
> > >> Le 01/03/2024 à 14:36, Dario Binacchi a écrit :
> > >>> In the case of SOC am64x, ti-k3-r5-loader creates the following
> > >>> tiboot3.bin files:
> > >>> - GP    -> tiboot3_am64x-gp-evm.bin
> > >>> - HS    -> tiboot3_am64x_sr2-hs-evm.bin
> > >>> - HS_FS -> tiboot3_am64x_sr2-hs-fs-evm.bin
> > >>>
> > >>> The patch allows you to identify the correct file based on the SEC_TYPE
> > >>> option.
> > >>
> > >> It seems this patch should be merged with the AM64x u-boot version bump since
> > >> ti-k3-r5 (aka u-boot) now provide tiboot3.bin.
> > >
> > > I will squash it to [PATCH 21/23] configs/ti_am64x_sk_defconfig: bump
> > > U-Boot version to 2024.01
> >
> > Ok
> >
> > >
> > >>
> > >> Also other TI K3 SoC variant like AM65 provide a sr2 binary:
> > >>
> > >> tiboot3-am62ax-hs-fs-evm.bin
> > >> tiboot3-am62ax-gp-evm.bin
> > >> tiboot3-am62ax-hs-evm.bin
> > >>
> > >> tiboot3-am62px-hs-fs-evm.bin
> > >>
> > >> tiboot3-am62x-hs-fs-evm.bin
> > >> tiboot3-am62x-gp-evm.bin
> > >> tiboot3-am62x-hs-evm.bin
> > >>
> > >> tiboot3-am64x_sr2-hs-fs-evm.bin
> > >> tiboot3-am64x-gp-evm.bin
> > >> tiboot3-am64x_sr2-hs-evm.bin
> > >>
> > >> tiboot3-am65x_sr2-gp-evm.bin
> > >> tiboot3-am65x_sr2-hs-evm.bin
> > >>
> > >> tiboot3-j7200-gp-evm.bin
> > >> tiboot3-j7200_sr2-hs-fs-evm.bin
> > >> tiboot3-j7200_sr2-hs-evm.bin
> > >>
> > >> tiboot3-j721e-gp-evm.bin
> > >> tiboot3-j721e_sr2-hs-fs-evm.bin
> > >> tiboot3-j721e_sr1_1-hs-evm.bin
> > >>
> > >> tiboot3-j721s2-gp-evm.bin
> > >> tiboot3-j721s2-hs-fs-evm.bin
> > >>
> > >> tiboot3-j722s-hs-fs-evm.bin
> > >>
> > >> tiboot3-j784s4-gp-evm.bin
> > >> tiboot3-j784s4-hs-fs-evm.bin
> > >>
> > >> Maybe we need to introduce TI_K3_R5_LOADER_SOC_SUFFIX to handle sr2, sr1_1 or "" ?
> > >>
> > > At first, I also thought about a new configuration to specify an
> > > additional suffix, but after verifying
> > > that BR2_PACKAGE_TI_K3_SOC is only used in
> > > boot/ti-k3-r5-loader/ti-k3-r5-loader.mk, the
> > > adopted solution:
> > >
> > > -       default "am64x"  if BR2_PACKAGE_TI_K3_SOC_AM64X
> > > +       default "am64x"  if BR2_PACKAGE_TI_K3_SOC_AM64X &&
> > > BR2_PACKAGE_TI_K3_SECTYPE_GP
> > > +       default "am64x_sr2"  if BR2_PACKAGE_TI_K3_SOC_AM64X &&
> > > !BR2_PACKAGE_TI_K3_SECTYPE_GP
> > >
> > > seemed the simplest to me.
> > >
> > > And I think this approach can also be used for the variants you
> > > listed, since for each {SOC,SEC_TYPE} pair
> > > there exists one and only one tiboot3.bin.
> >
> > What about removing BR2_PACKAGE_TI_K3_SOC and BR2_PACKAGE_TI_K3_SECTYPE
> > (inherited from ti-k3-image-gen, so we need them until we can remove this
> > package) we just need to know the name of the file we should copy based on TI K3
> > SoC and Security type selection.
> >
> > config BR2_PACKAGE_TI_K3_TIBOOT3_BIN
> >         string
> >         default "tiboot3-am62ax-gp-evm.bin" if BR2_PACKAGE_TI_K3_SOC_AM62AX &&
> > BR2_PACKAGE_TI_K3_SECTYPE_GP
> >         default "tiboot3-am62ax-hs-evm.bin" if BR2_PACKAGE_TI_K3_SOC_AM62AX &&
> > BR2_PACKAGE_TI_K3_SECTYPE_HS
> >         default "tiboot3-am62ax-hs-fs-evm.bin" if BR2_PACKAGE_TI_K3_SOC_AM62AX &&
> > BR2_PACKAGE_TI_K3_SECTYPE_HS_FS
> > ...
> >
> >  define TI_K3_R5_LOADER_INSTALL_IMAGES_CMDS
> >         cp $(@D)/spl/u-boot-spl.bin $(BINARIES_DIR)/r5-u-boot-spl.bin
> >         cp $(@D)/$(BR2_PACKAGE_TI_K3_TIBOOT3_BIN) $(BINARIES_DIR)/tiboot3.bin
> >  endef
> >
> > So we can avoid using complex find -regex -exec -cp command :)
> >
> > BR2_PACKAGE_TI_K3_TIBOOT3_BIN can be defined in ti-k3-r5-loader package.
> 
> Sure, for me it's fine.
> 
> However, this is an additional patch to add that isn't necessary at this moment.
> Can we consider adding it after this series has been merged? I recall
> that currently the compilation of
> the Hs and HS-FS variants for am62x are broken. Therefore, having
> verified with Andreas tests that the
> changes made in this series are okay for am62x_sk_defconfig and
> am64x_sk_defconfig, I would merge
> the series as soon as possible and then proceed with implementing
> further improvements.

I'd agree here, I think what we have now and what has already been
posted as v9 is more than good enough to make a cut and hopefully have
an initial solution that's acceptable to others here as well, and serve
as a base for future additions/improvements. Software development is
iterative IMHO anyways.

Thanks, Andreas


> 
> So, my intention is to submit version 9 with the only change being the
> squash of this patch to [PATCH 21/23]
> "configs/ti_am64x_sk_defconfig: bump U-Boot version to 2024.01".
> 
> Do you agree?
> 
> Thanks and regards,
> Dario
> 
> >
> > Best regards,
> > Romain
> >
> >
> > >
> > > Furthermore, if I'm not missing anything, this remains the only
> > > adjustment we need to make since there are no
> > > other configurations in buildroot among those you listed. So, in my
> > > humble opinion, for now, this should be fine.
> > >
> > > So, please let me know if, in addition to squashing this patch into
> > > "[21/23] configs/ti_am64x_sk_defconfig:
> > > bump U-Boot version to 2024.01", I need to make any other adjustments
> > > for version 9.
> > >
> > > Thanks and regards,
> > > Dario
> > >
> > >> Best regards,
> > >> Romain
> > >>
> > >>
> > >>>
> > >>> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> > >>>
> > >>> ---
> > >>>
> > >>> Added in v8
> > >>>
> > >>> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> > >>> ---
> > >>>  package/ti-k3/Config.in | 3 ++-
> > >>>  1 file changed, 2 insertions(+), 1 deletion(-)
> > >>>
> > >>> diff --git a/package/ti-k3/Config.in b/package/ti-k3/Config.in
> > >>> index b8545b7bca62..9c61f8880a15 100644
> > >>> --- a/package/ti-k3/Config.in
> > >>> +++ b/package/ti-k3/Config.in
> > >>> @@ -43,7 +43,8 @@ config BR2_PACKAGE_TI_K3_SOC
> > >>>       string
> > >>>       default "am62ax" if BR2_PACKAGE_TI_K3_SOC_AM62AX
> > >>>       default "am62x"  if BR2_PACKAGE_TI_K3_SOC_AM62X
> > >>> -     default "am64x"  if BR2_PACKAGE_TI_K3_SOC_AM64X
> > >>> +     default "am64x"  if BR2_PACKAGE_TI_K3_SOC_AM64X && BR2_PACKAGE_TI_K3_SECTYPE_GP
> > >>> +     default "am64x_sr2"  if BR2_PACKAGE_TI_K3_SOC_AM64X && !BR2_PACKAGE_TI_K3_SECTYPE_GP
> > >>>       default "am65x"  if BR2_PACKAGE_TI_K3_SOC_AM65X
> > >>>
> > >>>  config BR2_PACKAGE_TI_K3_SECTYPE
> > >>
> > >
> > >
> >
> 
> 
> --
> 
> Dario Binacchi
> 
> Senior Embedded Linux Developer
> 
> dario.binacchi@amarulasolutions.com
> 
> __________________________________
> 
> 
> Amarula Solutions SRL
> 
> Via Le Canevare 30, 31100 Treviso, Veneto, IT
> 
> T. +39 042 243 5310
> info@amarulasolutions.com
> 
> www.amarulasolutions.com

Patch

diff --git a/package/ti-k3/Config.in b/package/ti-k3/Config.in
index b8545b7bca62..9c61f8880a15 100644
--- a/package/ti-k3/Config.in
+++ b/package/ti-k3/Config.in
@@ -43,7 +43,8 @@  config BR2_PACKAGE_TI_K3_SOC
 	string
 	default "am62ax" if BR2_PACKAGE_TI_K3_SOC_AM62AX
 	default "am62x"  if BR2_PACKAGE_TI_K3_SOC_AM62X
-	default "am64x"  if BR2_PACKAGE_TI_K3_SOC_AM64X
+	default "am64x"  if BR2_PACKAGE_TI_K3_SOC_AM64X && BR2_PACKAGE_TI_K3_SECTYPE_GP
+	default "am64x_sr2"  if BR2_PACKAGE_TI_K3_SOC_AM64X && !BR2_PACKAGE_TI_K3_SECTYPE_GP
 	default "am65x"  if BR2_PACKAGE_TI_K3_SOC_AM65X
 
 config BR2_PACKAGE_TI_K3_SECTYPE