I am trying to build Android R but getting the following error in the kernel makefile:
> kernel/exynos/AndroidKernel.mk:155: error: writing to readonly
> directory:
> "/data/home/sumkumar/work/workspace/R/out/../out/target/product/**/obj/KERNEL_OBJ/arch/arm64/boot/Image"
This was handled in Android Q by using the flag "BUILD_BROKEN_PHONY_TARGETS=true" but in R this is deprecated hence I cannot use the same.
After looking at following link given for phony rules changes from google for Android R (https://android.googlesource.com/platform/build/+/master/Changes.md#phony_targets) I have updated my Makefile as follows by removing the "../" in the erronous path and past the previous error,
#KERNEL_OUT ?= $(if $(filter /% ~%,$(TARGET_OUT_INTERMEDIATES)),,$(realpath $(OUT_DIR))/../)$(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ
KERNEL_OUT ?= $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ
But now I am getting errors with phony-rebuild as mentioned below:
kernel/exynos/AndroidKernel.mk:139: error: real file "out/target/product/**/obj/KERNEL_OBJ/.config" depends on PHONY target "phony-rebuild"
14:21:04 ckati failed with: exit status 1
I understand that phony targets are always dirty, hence every file will be rebuilt which depends on that phony, but in my case this rebuilding is required. Attaching a snap of the file depicting the same
KERNEL_CONFIG := $(KERNEL_OUT)/.config
KERNEL_CONFIG := $(KERNEL_OUT)/.config
.PHONY: phony-rebuild
$(KERNEL_CONFIG): phony-rebuild
$(show) echo "make $(KERNEL_DEFCONFIG)"
$(MAKE_CONFIG_CMD)
$(info MAKE_CONFIG_CMD is $(MAKE_CONFIG_CMD))
Please let me know if there is any way to avoid using phony-rebuild and replace it with an alternate mechanism.
Regards,