Skip to contentSkip to conversation

common: build ymodem and s_record only on need

PATCH New Jun Nie 2 participants 3 messages Feb 11, 2018 – Feb 12, 2018

lore
Share & tools
lore

Jun Nie

author
#0 lore raw

PATCH 1/1 common: build ymodem and s_record only on need

Build ymodem and s_record only on need to shrink
spl image size.

---
 common/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/Makefile +2 -2
index c7bde23..8e1569f 100644
@@ -28,6 +28,8 @@ obj-$(CONFIG_DISPLAY_BOARDINFO_LATE) += board_info.o
 obj-$(CONFIG_CMD_BOOTM) += bootm.o bootm_os.o
 obj-$(CONFIG_CMD_BOOTZ) += bootm.o bootm_os.o
 obj-$(CONFIG_CMD_BOOTI) += bootm.o bootm_os.o
+obj-$(CONFIG_CMD_LOADS) += s_record.o
+obj-$(CONFIG_CMD_LOADB) += xyzModem.o
 
 obj-$(CONFIG_CMD_BEDBUG) += bedbug.o
 obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += fdt_support.o
@@ -132,5 +134,3 @@ obj-$(CONFIG_CMD_DFU) += dfu.o
 obj-y += command.o
 obj-$(CONFIG_$(SPL_)LOG) += log.o
 obj-$(CONFIG_$(SPL_)LOG_CONSOLE) += log_console.o
-obj-y += s_record.o
-obj-y += xyzModem.o
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 common: build ymodem and s_record only on need

Hi,

Quoted 13 lines · Jun Nie

Build ymodem and s_record only on need to shrink
spl image size.

---
 common/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/Makefile +0 -0
index c7bde23..8e1569f 100644

common/Makefile obj-$(CONFIG_DISPLAY_BOARDINFO_LATE) += board_info.o · line 31

Quoted 4 lines
common/Makefile +1 -0
@@ -28,6 +28,8 @@ obj-$(CONFIG_DISPLAY_BOARDINFO_LATE) += board_info.o
 obj-$(CONFIG_CMD_BOOTM) += bootm.o bootm_os.o
 obj-$(CONFIG_CMD_BOOTZ) += bootm.o bootm_os.o
 obj-$(CONFIG_CMD_BOOTI) += bootm.o bootm_os.o
+obj-$(CONFIG_CMD_LOADS) += s_record.o

That sounds like a good idea, and indeed we need s_record.o only for CMD_LOADS, but in my case this _increases_ the binary size by 6 bytes.

common/Makefile obj-$(CONFIG_DISPLAY_BOARDINFO_LATE) += board_info.o · line 32

Quoted 1 line
common/Makefile +1 -0
+obj-$(CONFIG_CMD_LOADB) += xyzModem.o

I don't believe CMD_LOADB is enough. xyzModem.c exports xyzModem_* functions, which are not only used in load.c, but also in common/spl/spl_ymodem.c.
So you would need to check for config options enabling this, too.

But same as above, applying this change does not decrease the size of the SPL binary.
Mine goes from (current master, pine64_plus_defconfig):
text data bss dec hex filename
30038 360 440 30838 7876 spl/u-boot-spl
to:
text data bss dec hex filename
30044 360 440 30844 787c spl/u-boot-spl

It seems like xyzModem_* functions and srec_decode() were removed by the linker as dead code already.

So what does this save you? Can you share your numbers?

Cheers,
Andre.

Quoted 10 lines
common/Makefile +0 -2
 obj-$(CONFIG_CMD_BEDBUG) += bedbug.o
 obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += fdt_support.o
@@ -132,5 +134,3 @@ obj-$(CONFIG_CMD_DFU) += dfu.o
 obj-y += command.o
 obj-$(CONFIG_$(SPL_)LOG) += log.o
 obj-$(CONFIG_$(SPL_)LOG_CONSOLE) += log_console.o
-obj-y += s_record.o
-obj-y += xyzModem.o
author
#2 lore raw

PATCH 1/1 common: build ymodem and s_record only on need

2018-02-12 8:54 GMT+08:00 André Przywara <[email protected]>:

Quoted 24 lines

Hi,

Quoted 13 lines · Jun Nie

Build ymodem and s_record only on need to shrink
spl image size.

---
 common/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/Makefile +0 -0
index c7bde23..8e1569f 100644

common/Makefile obj-$(CONFIG_DISPLAY_BOARDINFO_LATE) += board_info.o · line 31

Quoted 4 lines
common/Makefile +1 -0
@@ -28,6 +28,8 @@ obj-$(CONFIG_DISPLAY_BOARDINFO_LATE) += board_info.o
 obj-$(CONFIG_CMD_BOOTM) += bootm.o bootm_os.o
 obj-$(CONFIG_CMD_BOOTZ) += bootm.o bootm_os.o
 obj-$(CONFIG_CMD_BOOTI) += bootm.o bootm_os.o
+obj-$(CONFIG_CMD_LOADS) += s_record.o

That sounds like a good idea, and indeed we need s_record.o only for CMD_LOADS, but in my case this _increases_ the binary size by 6 bytes.

Quoted 6 lines

common/Makefile obj-$(CONFIG_DISPLAY_BOARDINFO_LATE) += board_info.o · line 32

Quoted 1 line
common/Makefile +1 -0
+obj-$(CONFIG_CMD_LOADB) += xyzModem.o

I don't believe CMD_LOADB is enough. xyzModem.c exports xyzModem_* functions, which are not only used in load.c, but also in common/spl/spl_ymodem.c.
So you would need to check for config options enabling this, too.

Thanks for reminder! I will add more check for this.

Quoted 10 lines

But same as above, applying this change does not decrease the size of the SPL binary.
Mine goes from (current master, pine64_plus_defconfig):
text data bss dec hex filename
30038 360 440 30838 7876 spl/u-boot-spl
to:
text data bss dec hex filename
30044 360 440 30844 787c spl/u-boot-spl

Quoted 5 lines

It seems like xyzModem_* functions and srec_decode() were removed by the linker as dead code already.

So what does this save you? Can you share your numbers?

As you said, s_record.o does not impact on SPL size. For xyzModem, SPL can save 136 bytes on bananapi zero board when I enable FIT configuration. Otherwise, it does not impact SPL size neither.

No optimization:
text data bss dec hex filename
24229 440 268 24937 6169 spl/u-boot-spl

Add optimization for xyzmodem.c
text data bss dec hex filename
24091 440 268 24799 60df spl/u-boot-spl

Quoted 14 lines

Cheers,
Andre.

Quoted 10 lines
common/Makefile +0 -2
 obj-$(CONFIG_CMD_BEDBUG) += bedbug.o
 obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += fdt_support.o
@@ -132,5 +134,3 @@ obj-$(CONFIG_CMD_DFU) += dfu.o
 obj-y += command.o
 obj-$(CONFIG_$(SPL_)LOG) += log.o
 obj-$(CONFIG_$(SPL_)LOG_CONSOLE) += log_console.o
-obj-y += s_record.o
-obj-y += xyzModem.o