diff mbox series

[U-Boot] rockchip: make_fit_atf.py: fix .its generation for a single atf image

Message ID 20190926191515.29068-1-heiko@sntech.de
State Accepted
Commit d46b548290042a248216cbaed99964dc77a26bf4
Delegated to: Philipp Tomsich
Headers show
Series [U-Boot] rockchip: make_fit_atf.py: fix .its generation for a single atf image | expand

Commit Message

Heiko Stuebner Sept. 26, 2019, 7:15 p.m. UTC
The commit 619f002db864 ("rockchip: make_fit_atf.py: fix loadables property
set error") fixed the double-loading of the primary atf-image, but didn't
take into account that there may be rare atf images with only that main
section present.

Right now this will result in a broken its due to the loadables section not
getting closed correctly, so fix that by adapting the guards around the loop.

The guards now protect against 0 segments when the bl31 binary doesn't
contain any section and 1 segment when only a core atf section is present.

Fixes: 619f002db864 ("rockchip: make_fit_atf.py: fix loadables property set error")
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 arch/arm/mach-rockchip/make_fit_atf.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Kever Yang Sept. 27, 2019, 12:58 a.m. UTC | #1
On 2019/9/27 上午3:15, Heiko Stuebner wrote:
> The commit 619f002db864 ("rockchip: make_fit_atf.py: fix loadables property
> set error") fixed the double-loading of the primary atf-image, but didn't
> take into account that there may be rare atf images with only that main
> section present.
>
> Right now this will result in a broken its due to the loadables section not
> getting closed correctly, so fix that by adapting the guards around the loop.
>
> The guards now protect against 0 segments when the bl31 binary doesn't
> contain any section and 1 segment when only a core atf section is present.
>
> Fixes: 619f002db864 ("rockchip: make_fit_atf.py: fix loadables property set error")
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>

Reviewed-by: Kever Yang<kever.yang@rock-chips.com>

Thanks,
- Kever
> ---
>   arch/arm/mach-rockchip/make_fit_atf.py | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-rockchip/make_fit_atf.py b/arch/arm/mach-rockchip/make_fit_atf.py
> index b9a1988298..585edcf9d5 100755
> --- a/arch/arm/mach-rockchip/make_fit_atf.py
> +++ b/arch/arm/mach-rockchip/make_fit_atf.py
> @@ -82,7 +82,7 @@ def append_conf_section(file, cnt, dtname, segments):
>       file.write('\t\t\tdescription = "%s";\n' % dtname)
>       file.write('\t\t\tfirmware = "atf_1";\n')
>       file.write('\t\t\tloadables = "uboot"')
> -    if segments != 0:
> +    if segments > 1:
>           file.write(',')
>       for i in range(1, segments):
>           file.write('"atf_%d"' % (i + 1))
> @@ -90,7 +90,7 @@ def append_conf_section(file, cnt, dtname, segments):
>               file.write(',')
>           else:
>               file.write(';\n')
> -    if segments == 0:
> +    if segments <= 1:
>           file.write(';\n')
>       file.write('\t\t\tfdt = "fdt_1";\n')
>       file.write('\t\t};\n')
Kever Yang Sept. 29, 2019, 12:55 a.m. UTC | #2
On 2019/9/27 上午8:58, Kever Yang wrote:
>
> On 2019/9/27 上午3:15, Heiko Stuebner wrote:
>> The commit 619f002db864 ("rockchip: make_fit_atf.py: fix loadables 
>> property
>> set error") fixed the double-loading of the primary atf-image, but 
>> didn't
>> take into account that there may be rare atf images with only that main
>> section present.
>>
>> Right now this will result in a broken its due to the loadables 
>> section not
>> getting closed correctly, so fix that by adapting the guards around 
>> the loop.
>>
>> The guards now protect against 0 segments when the bl31 binary doesn't
>> contain any section and 1 segment when only a core atf section is 
>> present.
>>
>> Fixes: 619f002db864 ("rockchip: make_fit_atf.py: fix loadables 
>> property set error")
>> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
>
> Reviewed-by: Kever Yang<kever.yang@rock-chips.com>

Applied to u-boot-rockchip/master.


>
> Thanks,
> - Kever
>> ---
>>   arch/arm/mach-rockchip/make_fit_atf.py | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/arm/mach-rockchip/make_fit_atf.py 
>> b/arch/arm/mach-rockchip/make_fit_atf.py
>> index b9a1988298..585edcf9d5 100755
>> --- a/arch/arm/mach-rockchip/make_fit_atf.py
>> +++ b/arch/arm/mach-rockchip/make_fit_atf.py
>> @@ -82,7 +82,7 @@ def append_conf_section(file, cnt, dtname, segments):
>>       file.write('\t\t\tdescription = "%s";\n' % dtname)
>>       file.write('\t\t\tfirmware = "atf_1";\n')
>>       file.write('\t\t\tloadables = "uboot"')
>> -    if segments != 0:
>> +    if segments > 1:
>>           file.write(',')
>>       for i in range(1, segments):
>>           file.write('"atf_%d"' % (i + 1))
>> @@ -90,7 +90,7 @@ def append_conf_section(file, cnt, dtname, segments):
>>               file.write(',')
>>           else:
>>               file.write(';\n')
>> -    if segments == 0:
>> +    if segments <= 1:
>>           file.write(';\n')
>>       file.write('\t\t\tfdt = "fdt_1";\n')
>>       file.write('\t\t};\n')
>
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
diff mbox series

Patch

diff --git a/arch/arm/mach-rockchip/make_fit_atf.py b/arch/arm/mach-rockchip/make_fit_atf.py
index b9a1988298..585edcf9d5 100755
--- a/arch/arm/mach-rockchip/make_fit_atf.py
+++ b/arch/arm/mach-rockchip/make_fit_atf.py
@@ -82,7 +82,7 @@  def append_conf_section(file, cnt, dtname, segments):
     file.write('\t\t\tdescription = "%s";\n' % dtname)
     file.write('\t\t\tfirmware = "atf_1";\n')
     file.write('\t\t\tloadables = "uboot"')
-    if segments != 0:
+    if segments > 1:
         file.write(',')
     for i in range(1, segments):
         file.write('"atf_%d"' % (i + 1))
@@ -90,7 +90,7 @@  def append_conf_section(file, cnt, dtname, segments):
             file.write(',')
         else:
             file.write(';\n')
-    if segments == 0:
+    if segments <= 1:
         file.write(';\n')
     file.write('\t\t\tfdt = "fdt_1";\n')
     file.write('\t\t};\n')