[U-Boot] [PATCH] common: build ymodem and s_record only on need

André Przywara andre.przywara at arm.com
Mon Feb 12 00:54:51 UTC 2018


Hi,

On 11/02/18 09:53, Jun Nie wrote:
> Build ymodem and s_record only on need to shrink
> spl image size.
> 
> Signed-off-by: Jun Nie <jun.nie at linaro.org>
> ---
>  common/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/common/Makefile b/common/Makefile
> index c7bde23..8e1569f 100644
> --- a/common/Makefile
> +++ b/common/Makefile
> @@ -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.

> +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.

>  
>  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
> 



More information about the U-Boot mailing list