Thanks Dan for the descriptive answer, this helped alot in solving the 
issue.

Regards,
Sumit Kumar 
On Wednesday, August 12, 2020 at 4:49:34 AM UTC+5:30 Dan Willemsen wrote:

> So the problem here is likely because it's mixing absolute and relative 
> paths. All makefile rules (inputs and outputs) should be using $(OUT_DIR) 
> as is (which is usually "out", but can be an absolute path if the user has 
> changed it). So this would be appropriate:
>
> KERNEL_OUT ?= $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ
>
>
> But then the rule itself is likely expecting to use that path as an 
> absolute path, since the kernel build system likely uses `cd` to change 
> into a different path, where the relative path is no longer correct. The 
> best solution is to expand it inside those rules, as it keeps absolute 
> paths out of the ninja file (which can preserve the ability to diff between 
> checkouts, and allows moving the source directory without requiring 
> rebuilding everything). This doc section 
> <https://android.googlesource.com/platform/build/+/master/Changes.md#envsetup_sh-variables-with-make-equivalents>
>  has 
> an example, but it's essentially something like:
>
> $(KERNEL_OUT)/arch/.../zImage: PRIVATE_SRCDIR := $(KERNEL_SRCDIR)
> $(KERNEL_OUT)/arch/.../zImage: PRIVATE_OUT := $(KERNEL_OUT)
> $(KERNEL_OUT)/arch/.../zImage: $(KERNEL_CONFIG) $(sort $(shell find -L 
> $(KERNEL_SRCDIR) -type f))
>     $(MAKE) -C $(PRIVATE_SRCDIR) O=$$(cd $(PRIVATE_OUT); pwd) ...
>
> (If you can guarantee that nothing later in the build will change 
> KERNEL_SRCDIR/KERNEL_OUT, then you wouldn't need to use the PRIVATE_* 
> indirection, but it's generally a good idea to do so to prevent issues in 
> the future)
>
> - Dan
>
> On Tue, Aug 11, 2020 at 12:06 PM Sumit Kumar <[email protected]> wrote:
>
>> HI Dan, 
>>     Thank for the insight , i was able to get through the phony-rebuild 
>> with an alternate mechanism "KERNEL_CONFIG: $(shell find -L 
>> $(KERNEL_SRCDIR)" and the build is passing successfully the only issue now 
>> i am getting is because of the previous change 
>>
>> *#KERNEL_OUT ?= $(if $(filter /% 
>> ~%,$(TARGET_OUT_INTERMEDIATES)),,$(realpath 
>> $(OUT_DIR))/../)$(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ*
>> *KERNEL_OUT ?= $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ*
>>
>> all the kernel intermidiates are generated in* kernel source * folder as 
>> we have removed the *realpath $(OUT_DIR) *from the equation , generating 
>> kernel intermidiates in *kernel_source *dir is not acceptable, i have 
>> tried all diffrent methods of pointing to the real 
>> *"out/target/product/**" * but with out success,  , 
>> further please help me with the following querry
>>
>> ->  from the link 
>> https://android.googlesource.com/platform/build/+/master/Changes.md#phony_targets
>>  
>>       *The target is a real file, but it's outside the output 
>> directories. All outputs from the build system should be within the output 
>> directory, otherwise m clean is unable to clean the build, and future 
>> builds may not work properly*.
>> :- Does this mean the path to the target file should start with "*out*"  
>> because 
>> i am not getting readonly error only when the path is specified as 
>> *out/target/product/**  
>> *as mentoined by *KERNE_OUT *above , but any other real path "
>> */data/home/sumkumar/work/workspace/R/out/target/product/**/obj/KERNEL_OBJ/arch/arm64/boot/Image"
>>  * is 
>> leading to error thrown ?
>>
>> Please sugget any alternative for this so that the kernel intermidiates 
>> are actually generated in the real *out/target/product/**/obj/KERNEL_OBJ* 
>> directory 
>> .
>>
>> Regards,
>> Sumit Kumar
>>
>> On Tuesday, August 11, 2020 at 8:43:40 PM UTC+5:30 [email protected] 
>> wrote:
>>
>>> II
>>>
>>> تم الإرسال من هاتف Huawei الخاص بي
>>>
>>>
>>> -------- الرسالة الأصلية --------
>>> من:‏ 'Dan Willemsen' via Android Building <[email protected]>
>>> التاريخ:‏ الثلاثاء، ١١ آب، ٢٠٢٠ ١٢:٠٢ ص
>>> إلى:‏ Android Building <[email protected]>
>>> الموضوع:‏ Re: [android-building] Replacement for BUILD_BROKEN_PHONY and 
>>> phony-rebuild in android R
>>>
>>> but in my case this rebuilding is required .
>>>
>>>
>>> I think this is where we're disconnected. Forcing rebuilds means that 
>>> incremental builds will nearly never be as fast as they should be, as the 
>>> entire tree starting from that phony would need to be rebuilt even if you 
>>> weren't touching anything related to the kernel. Instead, we'd much prefer 
>>> that the rule depended on what it uses, so it'll only be re-executed when 
>>> necessary. That list of dependencies may end up being a significant portion 
>>> of the kernel tree, but that's still better than every build.
>>>
>>> This also gets more important as we improve per-action sandboxing to get 
>>> better incremental builds and remote execution / cross-machine caching of 
>>> build actions. We're not there yet, but that's the direction we'd like to 
>>> be heading.
>>>
>>> - Dan 
>>>
>>> On Wed, Jul 29, 2020 at 9:08 AM Sumit Kumar <[email protected]> wrote:
>>>
>>> hi all,
>>>     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 depreciated hence 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 understood as phony targets are always dirty hence every file will 
>>> be rebuild 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,
>>>
>>> -- 
>>> -- 
>>> You received this message because you are subscribed to the "Android 
>>> Building" mailing list.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> For more options, visit this group at
>>> http://groups.google.com/group/android-building?hl=en
>>>
>>> --- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Android Building" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/android-building/786689cd-9816-454d-ba1f-bead4944ce3fo%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/android-building/786689cd-9816-454d-ba1f-bead4944ce3fo%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> -- 
>>> -- 
>>> You received this message because you are subscribed to the "Android 
>>> Building" mailing list.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> For more options, visit this group at
>>> http://groups.google.com/group/android-building?hl=en
>>>
>>> --- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Android Building" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>>
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/android-building/CALQgHdnNEArhZ-NoDSwrmmncaacN8WVFDeekUPYj%3DmUmk4rYiQ%40mail.gmail.com
>>>  
>>> <https://groups.google.com/d/msgid/android-building/CALQgHdnNEArhZ-NoDSwrmmncaacN8WVFDeekUPYj%3DmUmk4rYiQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> -- 
>> -- 
>> You received this message because you are subscribed to the "Android 
>> Building" mailing list.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/android-building?hl=en
>>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Android Building" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/android-building/03948d45-7e96-4919-b311-5fe0e4abba7cn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/android-building/03948d45-7e96-4919-b311-5fe0e4abba7cn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
-- 
You received this message because you are subscribed to the "Android Building" 
mailing list.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-building/4cda382b-55fb-4f82-81b2-cece91f41fc2n%40googlegroups.com.

Reply via email to