[U-Boot] [PATCH 01/15] lib: build charset.o only if needed

Alexander Graf agraf at suse.de
Sun Aug 26 17:45:41 UTC 2018



On 11.08.18 17:28, Heinrich Schuchardt wrote:
> charset.o is only needed for the EFI subsystem
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
>  lib/Makefile   |  5 ++++-
>  lib/vsprintf.c | 12 ++++++++----
>  2 files changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/Makefile b/lib/Makefile
> index 5f583aed37..2fd32798a0 100644
> --- a/lib/Makefile
> +++ b/lib/Makefile
> @@ -19,7 +19,10 @@ obj-$(CONFIG_ARCH_AT91) += at91/
>  obj-$(CONFIG_OPTEE) += optee/
>  
>  obj-$(CONFIG_AES) += aes.o
> -obj-y += charset.o
> +
> +ifndef API_BUILD
> +obj-$(CONFIG_EFI_LOADER) += charset.o
> +endif
>  obj-$(CONFIG_USB_TTY) += circbuf.o
>  obj-y += crc7.o
>  obj-y += crc8.o
> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> index 914fbd30cb..6100357858 100644
> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
> @@ -274,6 +274,8 @@ static char *string(char *buf, char *end, char *s, int field_width,
>  	return buf;
>  }
>  
> +#if defined(CONFIG_EFI_LOADER) && \
> +	!defined(CONFIG_SPL_BUILD) && !defined(API_BUILD)

I believe you want #if CONFIG_IS_ENABLED(EFI_LOADER) here, right? We
probably should move to that at other places where we explicitly check
for SPL_BUILD too.

>  static char *string16(char *buf, char *end, u16 *s, int field_width,
>  		int precision, int flags)
>  {
> @@ -294,8 +296,6 @@ static char *string16(char *buf, char *end, u16 *s, int field_width,
>  	return buf;
>  }
>  
> -#if defined(CONFIG_EFI_LOADER) && \
> -	!defined(CONFIG_SPL_BUILD) && !defined(API_BUILD)
>  static char *device_path_string(char *buf, char *end, void *dp, int field_width,
>  				int precision, int flags)
>  {
> @@ -612,10 +612,14 @@ repeat:
>  			continue;
>  
>  		case 's':
> -			if (qualifier == 'l' && !IS_ENABLED(CONFIG_SPL_BUILD)) {
> +#if defined(CONFIG_EFI_LOADER) && \
> +	!defined(CONFIG_SPL_BUILD) && !defined(API_BUILD)

This #if deserves a comment.


Alex

> +			if (qualifier == 'l') {
>  				str = string16(str, end, va_arg(args, u16 *),
>  					       field_width, precision, flags);
> -			} else {
> +			} else
> +#endif
> +			{
>  				str = string(str, end, va_arg(args, char *),
>  					     field_width, precision, flags);
>  			}
> 


More information about the U-Boot mailing list