[PATCH v3 4/5] Image size checks: Deduplicate Makefile
Marek Vasut
marek.vasut at mailbox.org
Thu Sep 4 17:03:24 CEST 2025
On 9/4/25 10:30 AM, Philip Oberfichtner wrote:
> On Wed, Sep 03, 2025 at 03:02:20PM +0200, Marek Vasut wrote:
>> On 9/3/25 12:56 PM, Philip Oberfichtner wrote:
>>> Deduplicate some redundancies within the SIZE_CHECK code in the toplevel
>>> Makefile. No functional changes.
>>>
>>> Note: To make this work for the special case of SPL, spl_size_limit.c
>>> has to print an empty string "" instead of zero when there is no size
>>> limit in place.
>>>
>>> Signed-off-by: Philip Oberfichtner <pro at denx.de>
>>> ---
>>> Makefile | 45 +++++++++++-------------------------------
>>> tools/spl_size_limit.c | 4 ++--
>>> 2 files changed, 13 insertions(+), 36 deletions(-)
>>>
>>> diff --git a/Makefile b/Makefile
>>> index a17d8b57196..b6f01591ee9 100644
>>> --- a/Makefile
>>> +++ b/Makefile
>>> @@ -428,8 +428,9 @@ KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS)
>>> # Check ths size of a binary:
>>> # Args:
>>> # $1: File to check
>>> -# #2: Size limit in bytes (decimal or 0xhex)
>>> +# #2: Size limit in bytes (decimal or 0xhex), always return OK if undefined
>>
>> You should be able to use the HAS_ variables to correctly test for and
>> handle the undefined case .
>
> In general, I agree. But this would mean to reintroduce the multiply
> duplicated Makefile bloat à la:
>
> ifeq ($(CONFIG_HAS_BOARD_SIZE_LIMIT),y)
> BOARD_SIZE_CHECK= @ $(call size_check,$@,$(CONFIG_BOARD_SIZE_LIMIT))
> else
> BOARD_SIZE_CHECK =
> endif
>
>
> That's why after all I preferred my "test -z" solution. Is there maybe
> a third way I am missing out on?
>
> What do you think about giving size_check another argument, i.e.
> call size_check,$@,$(CONFIG_HAS_BOARD_SIZE_LIMIT),$(CONFIG_BOARD_SIZE_LIMIT)
This could be an option , yes .
More information about the U-Boot
mailing list