[PATCH v4 4/6] boot: bootmeth_android: Conditionally dependent on abootimg

Casey Connolly casey.connolly at linaro.org
Wed Jan 14 16:24:43 CET 2026


Hi George,

This patch doesn't seem to build properly when cmd/abootimg.c is enabled:

../cmd/abootimg.c:26:6: error: redefinition of 'set_abootimg_addr'
   26 | void set_abootimg_addr(ulong addr)
      |      ^~~~~~~~~~~~~~~~~
In file included from ../cmd/abootimg.c:10:
../include/image.h:2044:13: note: previous definition of
'set_abootimg_addr' with type 'void(ulong)' {aka 'void(long unsigned int)'}
 2044 | void __weak set_abootimg_addr(ulong addr) {}
      |             ^~~~~~~~~~~~~~~~~
../cmd/abootimg.c:41:6: error: redefinition of 'set_avendor_bootimg_addr'
   41 | void set_avendor_bootimg_addr(ulong addr)
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
../include/image.h:2065:13: note: previous definition of
'set_avendor_bootimg_addr' with type 'void(ulong)' {aka 'void(long
unsigned int)'}
 2065 | void __weak set_avendor_bootimg_addr(ulong addr) {}
      |             ^~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [../scripts/Makefile.build:271: cmd/abootimg.o] Error 1

On 30/06/2025 09:56, George Chan via B4 Relay wrote:
> From: George Chan <gchan9527 at gmail.com>
> 
> If target u-boot img do not support androidboot v3 or greater,
> abootimg might not be necessary.
> 
> aarch64-linux-gnu-ld.bfd: boot/bootmeth_android.o: in function `boot_android_normal':
> /home/user/sources/u-boot-next/boot/bootmeth_android.c:541:(.text.boot_android_normal+0xd0): undefined reference to `set_avendor_bootimg_addr'
> aarch64-linux-gnu-ld.bfd: /home/user/sources/u-boot-next/boot/bootmeth_android.c:543:(.text.boot_android_normal+0xd8): undefined reference to `set_abootimg_addr'
> Segmentation fault (core dumped)
> 
> Reviewed-by: Mattijs Korpershoek <mkorpershoek at kernel.org>
> Acked-by: Mattijs Korpershoek <mkorpershoek at kernel.org>
> Signed-off-by: George Chan <gchan9527 at gmail.com>
> ---
>  boot/bootmeth_android.c | 2 +-
>  include/image.h         | 2 ++
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/boot/bootmeth_android.c b/boot/bootmeth_android.c
> index 8c2bde10e17..d7740b86d67 100644
> --- a/boot/bootmeth_android.c
> +++ b/boot/bootmeth_android.c
> @@ -534,7 +534,7 @@ static int boot_android_normal(struct bootflow *bflow)
>  	if (ret < 0)
>  		return log_msg_ret("read boot", ret);
>  
> -	if (priv->header_version >= 3) {
> +	if (IS_ENABLED(CONFIG_CMD_ABOOTIMG) && priv->header_version >= 3) {
>  		ret = read_slotted_partition(desc, "vendor_boot", priv->slot,
>  					     priv->vendor_boot_img_size, vloadaddr);
>  		if (ret < 0)
> diff --git a/include/image.h b/include/image.h
> index 11d33ceeb39..82a861ba8bf 100644
> --- a/include/image.h
> +++ b/include/image.h
> @@ -2050,6 +2050,7 @@ ulong get_abootimg_addr(void);
>   * Return: no returned results
>   */
>  void set_abootimg_addr(ulong addr);
> +void __weak set_abootimg_addr(ulong addr) {}
>  
>  /**
>   * get_ainit_bootimg_addr() - Get Android init boot image address
> @@ -2071,6 +2072,7 @@ ulong get_avendor_bootimg_addr(void);
>   * Return: no returned results
>   */
>  void set_avendor_bootimg_addr(ulong addr);
> +void __weak set_avendor_bootimg_addr(ulong addr) {}
>  
>  /**
>   * board_fit_config_name_match() - Check for a matching board name
> 

-- 
// Casey (she/her)



More information about the U-Boot mailing list