Subject: Re: linux-next: manual merge of the risc-v tree with Linus' tree

From: Yangyu Chen <[email-masked]>
Date: Thu, 16 May 2024 10:17:14 +0800

> On May 16, 2024, at 07:36, Stephen Rothwell <[email-masked]> wrote:
> 
> Hi all,
> 
> Today's linux-next merge of the risc-v tree got a conflict in:
> 
>  arch/riscv/Makefile
> 
> between commit:
> 
>  ef10bdf9c3e6 ("riscv: Kconfig.socs: Split ARCH_CANAAN and SOC_CANAAN_K210")
> 
> from Linus' tree and commits:
> 
>  3b938e231b66 ("riscv: merge two if-blocks for KBUILD_IMAGE")
>  c1f59d035966 ("riscv: make image compression configurable")
> 
> from the risc-v tree.
> 
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
> 
> -- 
> Cheers,
> Stephen Rothwell
> 
> diff --cc arch/riscv/Makefile
> index 0577d34fb1a7,321c057e2bdc..000000000000
> --- a/arch/riscv/Makefile
> +++ b/arch/riscv/Makefile
> @@@ -132,12 -136,20 +139,20 @@@ endi
>  CHECKFLAGS += -D__riscv -D__riscv_xlen=$(BITS)
> 
>  # Default target when executing plain make
> - boot := arch/riscv/boot
> - ifeq ($(CONFIG_XIP_KERNEL),y)
> - KBUILD_IMAGE := $(boot)/xipImage
> - else
> - KBUILD_IMAGE := $(boot)/Image.gz
> + boot := arch/riscv/boot
> + boot-image-y := Image
> + boot-image-$(CONFIG_KERNEL_BZIP2) := Image.bz2
> + boot-image-$(CONFIG_KERNEL_GZIP) := Image.gz
> + boot-image-$(CONFIG_KERNEL_LZ4) := Image.lz4
> + boot-image-$(CONFIG_KERNEL_LZMA) := Image.lzma
> + boot-image-$(CONFIG_KERNEL_LZO) := Image.lzo
> + boot-image-$(CONFIG_KERNEL_ZSTD) := Image.zst
> + ifdef CONFIG_RISCV_M_MODE
> -boot-image-$(CONFIG_ARCH_CANAAN) := loader.bin
> ++boot-image-$(CONFIG_ARCH_CANAAN_K210) := loader.bin

Oh, No.

Here should be CONFIG_SOC_CANAAN_K210 not CONFIG_ARCH_CANAAN_K210 .

The correct diff should be:

diff --cc arch/riscv/Makefile
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@@ -132,12 -136,20 +139,20 @@@ endi
  CHECKFLAGS += -D__riscv -D__riscv_xlen=$(BITS)
  
  # Default target when executing plain make
- boot		:= arch/riscv/boot
- ifeq ($(CONFIG_XIP_KERNEL),y)
- KBUILD_IMAGE := $(boot)/xipImage
- else
- KBUILD_IMAGE	:= $(boot)/Image.gz
+ boot					:= arch/riscv/boot
+ boot-image-y				:= Image
+ boot-image-$(CONFIG_KERNEL_BZIP2)	:= Image.bz2
+ boot-image-$(CONFIG_KERNEL_GZIP)	:= Image.gz
+ boot-image-$(CONFIG_KERNEL_LZ4)		:= Image.lz4
+ boot-image-$(CONFIG_KERNEL_LZMA)	:= Image.lzma
+ boot-image-$(CONFIG_KERNEL_LZO)		:= Image.lzo
+ boot-image-$(CONFIG_KERNEL_ZSTD)	:= Image.zst
+ ifdef CONFIG_RISCV_M_MODE
 -boot-image-$(CONFIG_ARCH_CANAAN)	:= loader.bin
++boot-image-$(CONFIG_SOC_CANAAN_K210)	:= loader.bin
  endif
+ boot-image-$(CONFIG_EFI_ZBOOT)		:= vmlinuz.efi
+ boot-image-$(CONFIG_XIP_KERNEL)		:= xipImage
+ KBUILD_IMAGE				:= $(boot)/$(boot-image-y)
  
  libs-y += arch/riscv/lib/
  libs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
@@@ -154,20 -166,9 +169,9 @@@ endi
  endif
  
  vdso-install-y			+= arch/riscv/kernel/vdso/vdso.so.dbg
 -vdso-install-$(CONFIG_COMPAT)	+= arch/riscv/kernel/compat_vdso/compat_vdso.so.dbg:../compat_vdso/compat_vdso.so
 +vdso-install-$(CONFIG_COMPAT)	+= arch/riscv/kernel/compat_vdso/compat_vdso.so.dbg
  
- ifneq ($(CONFIG_XIP_KERNEL),y)
- ifeq ($(CONFIG_RISCV_M_MODE)$(CONFIG_SOC_CANAAN_K210),yy)
- KBUILD_IMAGE := $(boot)/loader.bin
- else
- ifeq ($(CONFIG_EFI_ZBOOT),)
- KBUILD_IMAGE := $(boot)/Image.gz
- else
- KBUILD_IMAGE := $(boot)/vmlinuz.efi
- endif
- endif
- endif
- BOOT_TARGETS := Image Image.gz loader loader.bin xipImage vmlinuz.efi
+ BOOT_TARGETS := Image Image.gz Image.bz2 Image.lz4 Image.lzma Image.lzo Image.zst loader loader.bin xipImage vmlinuz.efi
  
  all:	$(notdir $(KBUILD_IMAGE))

>  endif
> + boot-image-$(CONFIG_EFI_ZBOOT) := vmlinuz.efi
> + boot-image-$(CONFIG_XIP_KERNEL) := xipImage
> + KBUILD_IMAGE := $(boot)/$(boot-image-y)
> 
>  libs-y += arch/riscv/lib/
>  libs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
> @@@ -154,20 -166,9 +169,9 @@@ endi
>  endif
> 
>  vdso-install-y += arch/riscv/kernel/vdso/vdso.so.dbg
> -vdso-install-$(CONFIG_COMPAT) += arch/riscv/kernel/compat_vdso/compat_vdso.so.dbg:../compat_vdso/compat_vdso.so
> +vdso-install-$(CONFIG_COMPAT) += arch/riscv/kernel/compat_vdso/compat_vdso.so.dbg
> 
> - ifneq ($(CONFIG_XIP_KERNEL),y)
> - ifeq ($(CONFIG_RISCV_M_MODE)$(CONFIG_SOC_CANAAN_K210),yy)
> - KBUILD_IMAGE := $(boot)/loader.bin
> - else
> - ifeq ($(CONFIG_EFI_ZBOOT),)
> - KBUILD_IMAGE := $(boot)/Image.gz
> - else
> - KBUILD_IMAGE := $(boot)/vmlinuz.efi
> - endif
> - endif
> - endif
> - BOOT_TARGETS := Image Image.gz loader loader.bin xipImage vmlinuz.efi
> + BOOT_TARGETS := Image Image.gz Image.bz2 Image.lz4 Image.lzma Image.lzo Image.zst loader loader.bin xipImage vmlinuz.efi
> 
>  all: $(notdir $(KBUILD_IMAGE))
>