I use "CONFIG_EXTERNAL_KERNEL_TREE" for build and it failed

logs:

GNU Make 4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
make[3]: Entering directory '/home/lazy/openwrt-stm32mp1/toolchain/kernel-headers'
Updating goal targets....
 File 'compile' does not exist.
   File '.compile' does not exist.
     File '.host-compile' does not exist.
       File '/home/lazy/openwrt-stm32mp1/build_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-8.4.0_musl_eabi/linux-5.4.119/.built' does not exist.
         File '/home/lazy/openwrt-stm32mp1/build_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-8.4.0_musl_eabi/linux-5.4.119/.configured' does not exist.
           File '/home/lazy/openwrt-stm32mp1/build_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-8.4.0_musl_eabi/linux-5.4.119/.prepared' does not exist.
          Must remake target '/home/lazy/openwrt-stm32mp1/build_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-8.4.0_musl_eabi/linux-5.4.119/.prepared'.
rm -rf /home/lazy/openwrt-stm32mp1/build_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-8.4.0_musl_eabi/linux-*
mkdir -p /home/lazy/openwrt-stm32mp1/build_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-8.4.0_musl_eabi
if [ -d /home/lazy/openwrt-stm32mp1/build_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-8.4.0_musl_eabi/linux-5.4.119 ]; then rmdir /home/lazy/openwrt-stm32mp1/build_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-8.4.0_musl_eabi/linux-5.4.119; fi
ln -s "/home/lazy/linux-stm32mp" /home/lazy/openwrt-stm32mp1/build_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-8.4.0_musl_eabi/linux-5.4.119
export MAKEFLAGS= ; [ -d /home/lazy/openwrt-stm32mp1/build_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-8.4.0_musl_eabi/linux-5.4.119/user_headers ] && rm -rf /home/lazy/openwrt-stm32mp1/build_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-8.4.0_musl_eabi/linux-5.4.119/user_headers
Makefile:115: recipe for target '/home/lazy/openwrt-stm32mp1/build_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-8.4.0_musl_eabi/linux-5.4.119/.prepared' failed
make[3]: *** [/home/lazy/openwrt-stm32mp1/build_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-8.4.0_musl_eabi/linux-5.4.119/.prepared] Error 1
make[3]: Leaving directory '/home/lazy/openwrt-stm32mp1/toolchain/kernel-headers'
time: toolchain/kernel-headers/compile#0.01#0.00#0.03
    ERROR: toolchain/kernel-headers failed to build.
toolchain/Makefile:95: recipe for target 'toolchain/kernel-headers/compile' failed
make[2]: *** [toolchain/kernel-headers/compile] Error 1
make[2]: Leaving directory '/home/lazy/openwrt-stm32mp1'
toolchain/Makefile:93: recipe for target '/home/lazy/openwrt-stm32mp1/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-8.4.0_musl_eabi/stamp/.toolchain_compile' failed
make[1]: *** [/home/lazy/openwrt-stm32mp1/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-8.4.0_musl_eabi/stamp/.toolchain_compile] Error 2
make[1]: Leaving directory '/home/lazy/openwrt-stm32mp1'
/home/lazy/openwrt-stm32mp1/include/toplevel.mk:228: recipe for target 'world' failed
make: *** [world] Error 2

@namezis pinged me on IRC about this. I was assuming that the test for the directory would be enough, but could you try this, too:

diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
index 4b0b136a03a1..2904dcda2f72 100644
--- a/include/kernel-defaults.mk
+++ b/include/kernel-defaults.mk
@@ -43,7 +43,7 @@ else
                rmdir $(LINUX_DIR); \
        fi
        ln -s $(CONFIG_EXTERNAL_KERNEL_TREE) $(LINUX_DIR)
-       $(_SINGLE) [ -d $(LINUX_DIR)/user_headers ] && rm -rf $(LINUX_DIR)/user_headers
+       -$(_SINGLE) [ -d $(LINUX_DIR)/user_headers ] && rm -rf $(LINUX_DIR)/user_headers
   endef
 endif


i delete it and build success. but i afraid this will be make some bugs.