Skip to contentSkip to conversation

Thoughts about U-boot binary size increase

DISCUSSION Lukasz Majewski 4 participants 9 messages Mar 28, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Dear Community,

I'd like to share with you some thoughts about growth of u-boot's binary size for SPL and u-boot proper.

Board: XEA
SoC : imx287 (still in active production)
Problem: SPL size constrained to ~55 KiB (This cannot be exceeded).
Board design constraints u-boot proper size to less than ~448 KiB

When XEA was added (2019.07):
- u-boot.sb (SPL): 37 KiB
- u-boot.img : 401 KiB

Now (2024.04):
- u-boot.sb (SPL): 40 KiB
- u-boot.img : 427 KiB

(With a _lot_ of effort put to reduce the size)

Hence, the question - would it be possible to take more concern about the binary size growth?

Maybe CI could catch patches, which enable by default some features and the size is unintentionally increased?

I'm open for any feedback and thoughts on "stopping" the binary size increase.

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

#1 lore raw
Quoted 12 lines · Lukasz Majewski

Dear Community,

I'd like to share with you some thoughts about growth of u-boot's binary size for SPL and u-boot proper.

Board: XEA
SoC : imx287 (still in active production)
Problem: SPL size constrained to ~55 KiB (This cannot be exceeded).
Board design constraints u-boot proper size to less than ~448 KiB

Quoted 6 lines

When XEA was added (2019.07):
- u-boot.sb (SPL): 37 KiB
- u-boot.img : 401 KiB

Now (2024.04):
- u-boot.sb (SPL): 40 KiB

Do you know which symbol(s) grew in here ?

Quoted 9 lines

- u-boot.img : 427 KiB

(With a _lot_ of effort put to reduce the size)

Hence, the question - would it be possible to take more concern about the binary size growth?

Maybe CI could catch patches, which enable by default some features and the size is unintentionally increased?

Try and set CONFIG_BOARD_SIZE_LIMIT and CONFIG_SPL_SIZE_LIMIT for this board, that would trip build error if the size grows too large.

#2 lore raw

Hi Marek,

Quoted 13 lines · Lukasz Majewski
Quoted 12 lines

Dear Community,

I'd like to share with you some thoughts about growth of u-boot's binary size for SPL and u-boot proper.

Board: XEA
SoC : imx287 (still in active production)
Problem: SPL size constrained to ~55 KiB (This cannot be exceeded).
Board design constraints u-boot proper size to less than
~448 KiB

Quoted 8 lines
Quoted 6 lines

When XEA was added (2019.07):
- u-boot.sb (SPL): 37 KiB
- u-boot.img : 401 KiB

Now (2024.04):
- u-boot.sb (SPL): 40 KiB

Do you know which symbol(s) grew in here ?

I will need to check it.

Quoted 5 lines
Quoted 5 lines

- u-boot.img : 427 KiB

(With a _lot_ of effort put to reduce the size)

Quoted 8 lines
Quoted 5 lines

Hence, the question - would it be possible to take more concern about the binary size growth?

Maybe CI could catch patches, which enable by default some features and the size is unintentionally increased?

Try and set CONFIG_BOARD_SIZE_LIMIT and CONFIG_SPL_SIZE_LIMIT for this board, that would trip build error if the size grows too large.

I think that setting CONFIG_BOARD_SIZE_LIMIT and CONFIG_SPL_SIZE_LIMIT would help for rising the "red flag" of the size limit.

However, I would like to signal that there is a problem with u-boot size increase.

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

#3 lore raw
In reply to Lukasz Majewski
Quoted 22 lines · Lukasz Majewski

Dear Community,

I'd like to share with you some thoughts about growth of u-boot's binary size for SPL and u-boot proper.

Board: XEA
SoC : imx287 (still in active production)
Problem: SPL size constrained to ~55 KiB (This cannot be exceeded).
Board design constraints u-boot proper size to less than ~448 KiB

When XEA was added (2019.07):
- u-boot.sb (SPL): 37 KiB
- u-boot.img : 401 KiB

Now (2024.04):
- u-boot.sb (SPL): 40 KiB
- u-boot.img : 427 KiB

(With a _lot_ of effort put to reduce the size)

Quoted 8 lines

Hence, the question - would it be possible to take more concern about the binary size growth?

Maybe CI could catch patches, which enable by default some features and the size is unintentionally increased?

I'm open for any feedback and thoughts on "stopping" the binary size increase.

I think that's pretty amazingly small growth for nearly 5 years of bug fixes and feature enhancements that it's likely minor to make granular. If LTO is not enabled on this platform you should be able to use buildman to give you a "bloat" list from v2019.07 to v2024.04 and see if anything sticks out as being something that can be addressed. But that little growth seems pretty good to me at first glance.

Signature · 1 line
Tom
reviewer
#7 lore raw
In reply to Lukasz Majewski

Hi Lukasz,

Quoted 23 lines · Lukasz Majewski

Dear Community,

I'd like to share with you some thoughts about growth of u-boot's binary size for SPL and u-boot proper.

Board: XEA
SoC : imx287 (still in active production)
Problem: SPL size constrained to ~55 KiB (This cannot be exceeded).
Board design constraints u-boot proper size to less than ~448 KiB

When XEA was added (2019.07):
- u-boot.sb (SPL): 37 KiB
- u-boot.img : 401 KiB

Now (2024.04):
- u-boot.sb (SPL): 40 KiB
- u-boot.img : 427 KiB

(With a _lot_ of effort put to reduce the size)

Quoted 8 lines

Hence, the question - would it be possible to take more concern about the binary size growth?

Maybe CI could catch patches, which enable by default some features and the size is unintentionally increased?

I'm open for any feedback and thoughts on "stopping" the binary size increase.

In addition to adding CONFIG_BOARD_SIZE_LIMIT and CONFIG_SPL_SIZE_LIMIT checks, could you try the change below?

arch/arm/mach-imx/mxs/Kconfig +1 -0
index d2e4205c5ce5..ee8c23d0e04f 100644
@@ -32,6 +32,7 @@ if ARCH_MX28
 
 config MX28
        bool
+       select LTO
        default y
 

I did a quick imx28_xea_defconfig build test here:

U-Boot mainline
---------------

$ ls -al u-boot.img
-rw-rw-r-- 1 fabio fabio 444128 mar 28 09:11 u-boot.img
$ ls -al spl/u-boot-spl.bin
-rwxrwxr-x 1 fabio fabio 39800 mar 28 09:12 spl/u-boot-spl.bin

U-Boot mainline + LTO
---------------------

$ ls -al u-boot.img
-rw-rw-r-- 1 fabio fabio 424144 mar 28 09:14 u-boot.img
$ ls -al spl/u-boot-spl.bin
-rw-rw-r-- 1 fabio fabio 37664 mar 28 09:14 spl/u-boot-spl.bin
#8 lore raw

Hi Fabio,

Quoted 61 lines

Hi Lukasz,

Quoted 23 lines · Lukasz Majewski

Dear Community,

I'd like to share with you some thoughts about growth of u-boot's binary size for SPL and u-boot proper.

Board: XEA
SoC : imx287 (still in active production)
Problem: SPL size constrained to ~55 KiB (This cannot be exceeded).
Board design constraints u-boot proper size to less than
~448 KiB

When XEA was added (2019.07):
- u-boot.sb (SPL): 37 KiB
- u-boot.img : 401 KiB

Now (2024.04):
- u-boot.sb (SPL): 40 KiB
- u-boot.img : 427 KiB

(With a _lot_ of effort put to reduce the size)

Quoted 8 lines

Hence, the question - would it be possible to take more concern about the binary size growth?

Maybe CI could catch patches, which enable by default some features and the size is unintentionally increased?

I'm open for any feedback and thoughts on "stopping" the binary size increase.

In addition to adding CONFIG_BOARD_SIZE_LIMIT and CONFIG_SPL_SIZE_LIMIT checks, could you try the change below?

(quoted diff) +0 -0

b/arch/arm/mach-imx/mxs/Kconfig index d2e4205c5ce5..ee8c23d0e04f 100644 --- a/arch/arm/mach-imx/mxs/Kconfig
+++ b/arch/arm/mach-imx/mxs/Kconfig

arch/arm/mach-imx/mxs/Kconfig +1 -0
@@ -32,6 +32,7 @@ if ARCH_MX28
 
 config MX28
        bool
+       select LTO
        default y
 

I did a quick imx28_xea_defconfig build test here:

U-Boot mainline
---------------

$ ls -al u-boot.img
-rw-rw-r-- 1 fabio fabio 444128 mar 28 09:11 u-boot.img
$ ls -al spl/u-boot-spl.bin
-rwxrwxr-x 1 fabio fabio 39800 mar 28 09:12 spl/u-boot-spl.bin
Quoted 8 lines

U-Boot mainline + LTO
---------------------

$ ls -al u-boot.img
-rw-rw-r-- 1 fabio fabio 424144 mar 28 09:14 u-boot.img
$ ls -al spl/u-boot-spl.bin
-rw-rw-r-- 1 fabio fabio 37664 mar 28 09:14 spl/u-boot-spl.bin

Thanks for the tip - I will check if enabling LTO is not causing any regressions.

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

#4 lore raw
In reply to Tom Rini

Hi Tom,

Quoted 29 lines · Lukasz Majewski
Quoted 28 lines

Dear Community,

I'd like to share with you some thoughts about growth of u-boot's binary size for SPL and u-boot proper.

Board: XEA
SoC : imx287 (still in active production)
Problem: SPL size constrained to ~55 KiB (This cannot be exceeded).
Board design constraints u-boot proper size to less than
~448 KiB

When XEA was added (2019.07):
- u-boot.sb (SPL): 37 KiB
- u-boot.img : 401 KiB

Now (2024.04):
- u-boot.sb (SPL): 40 KiB
- u-boot.img : 427 KiB

(With a _lot_ of effort put to reduce the size)

Hence, the question - would it be possible to take more concern about the binary size growth?

Maybe CI could catch patches, which enable by default some features and the size is unintentionally increased?

Quoted 6 lines
Quoted 2 lines

I'm open for any feedback and thoughts on "stopping" the binary size increase.

I think that's pretty amazingly small growth for nearly 5 years of bug fixes and feature enhancements that it's likely minor to make granular.

Those results are after using OF_PLATDATA in SPL and other tricks - like compression of DTB in u-boot proper, so this caused some extra effort to keep small.

Quoted 1 line

If LTO is not enabled on this platform

As Fabio pointed out - I shall check if LTO can be (safely) enabled for imx287.

Quoted 6 lines

you should be able
to use buildman to give you a "bloat" list from v2019.07 to v2024.04 and see if anything sticks out as being something that can be addressed. But that little growth seems pretty good to me at first glance.

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

#5 lore raw
Quoted 34 lines · Lukasz Majewski

Hi Tom,

Quoted 32 lines · Lukasz Majewski
Quoted 30 lines

Dear Community,

I'd like to share with you some thoughts about growth of u-boot's binary size for SPL and u-boot proper.

Board: XEA
SoC : imx287 (still in active production)
Problem: SPL size constrained to ~55 KiB (This cannot be exceeded).
Board design constraints u-boot proper size to less than
~448 KiB

When XEA was added (2019.07):
- u-boot.sb (SPL): 37 KiB
- u-boot.img : 401 KiB

Now (2024.04):
- u-boot.sb (SPL): 40 KiB
- u-boot.img : 427 KiB

(With a _lot_ of effort put to reduce the size)

Hence, the question - would it be possible to take more concern about the binary size growth?

Maybe CI could catch patches, which enable by default some features and the size is unintentionally increased?

I'm open for any feedback and thoughts on "stopping" the binary size increase.

Quoted 7 lines
Quoted 3 lines

I think that's pretty amazingly small growth for nearly 5 years of bug fixes and feature enhancements that it's likely minor to make granular.

Those results are after using OF_PLATDATA in SPL and other tricks - like compression of DTB in u-boot proper, so this caused some extra effort to keep small.

Yes, and I'm still pretty happy with that. I would encourage you to do what I suggested, before turning on LTO (as that makes it hard to see symbol size changes due to the nature of LTO) as what you asked for in your original email is what I do, and have done for a very long time now, with 99% of every pull request / branch merge. I'm not saying I didn't miss anything, but I am saying it's a matter of specific changes and not a general problem. And if you hadn't previously set the options to enforce failure to build if hard size constraints are missed, please do so.

Signature · 1 line
Tom
#6 lore raw

Hi Tom,

Quoted 39 lines · Lukasz Majewski
Quoted 38 lines

Hi Tom,

Quoted 35 lines · Lukasz Majewski
Quoted 22 lines

Dear Community,

I'd like to share with you some thoughts about growth of u-boot's binary size for SPL and u-boot proper.

Board: XEA
SoC : imx287 (still in active production)
Problem: SPL size constrained to ~55 KiB (This cannot be exceeded). Board design constraints u-boot proper size to less than ~448 KiB

When XEA was added (2019.07):
- u-boot.sb (SPL): 37 KiB
- u-boot.img : 401 KiB

Now (2024.04):
- u-boot.sb (SPL): 40 KiB
- u-boot.img : 427 KiB

(With a _lot_ of effort put to reduce the size)

Quoted 8 lines

Hence, the question - would it be possible to take more concern about the binary size growth?

Maybe CI could catch patches, which enable by default some features and the size is unintentionally increased?

I'm open for any feedback and thoughts on "stopping" the binary size increase.

I think that's pretty amazingly small growth for nearly 5 years of bug fixes and feature enhancements that it's likely minor to make granular.

Quoted 5 lines
Quoted 3 lines

Those results are after using OF_PLATDATA in SPL and other tricks - like compression of DTB in u-boot proper, so this caused some extra effort to keep small.

Yes, and I'm still pretty happy with that.

Ok :-)

Quoted 7 lines

I would encourage you to do
what I suggested, before turning on LTO (as that makes it hard to see symbol size changes due to the nature of LTO) as what you asked for in your original email is what I do, and have done for a very long time now, with 99% of every pull request / branch merge. I'm not saying I didn't miss anything, but I am saying it's a matter of specific changes and not a general problem.

Ok. I will check binman's output for symbol sizes changes.

Quoted 4 lines

And if you hadn't previously set
the options to enforce failure to build if hard size constraints are missed, please do so.

I will.

Thanks for input and help.

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]