aosproot icon indicating copy to clipboard operation
aosproot copied to clipboard

patch_code failing to apply on crDroid

Open mmtrt opened this issue 3 years ago • 7 comments

 -> aosproot patch_code
Applying /root/aosp/crd13/vendor/aosproot/patches/build/make/0001-Apply-Magisk-patch-to-boot-image.patch in /root/aosp/crd13/build/make
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.
Traceback (most recent call last):
  File "/root/aosp/crd13/out/host/linux-x86/bin/aosproot/internal/stdlib/runpy.py", line 196, in _run_module_as_main
  File "/root/aosp/crd13/out/host/linux-x86/bin/aosproot/internal/stdlib/runpy.py", line 86, in _run_code
  File "/root/aosp/crd13/out/host/linux-x86/bin/aosproot/__main__.py", line 12, in <module>
  File "/root/aosp/crd13/out/host/linux-x86/bin/aosproot/internal/stdlib/runpy.py", line 196, in _run_module_as_main
  File "/root/aosp/crd13/out/host/linux-x86/bin/aosproot/internal/stdlib/runpy.py", line 86, in _run_code
  File "/root/aosp/crd13/out/host/linux-x86/bin/aosproot/aosproot.py", line 129, in <module>
  File "/root/aosp/crd13/out/host/linux-x86/bin/aosproot/aosproot.py", line 123, in main
  File "/root/aosp/crd13/out/host/linux-x86/bin/aosproot/aosproot.py", line 84, in patch_code
  File "/root/aosp/crd13/out/host/linux-x86/bin/aosproot/internal/stdlib/subprocess.py", line 369, in check_call
subprocess.CalledProcessError: Command '['git', '-C', '/root/aosp/crd13/build/make', 'am', '/root/aosp/crd13/vendor/aosproot/patches/build/make/0001-Apply-Magisk-patch-to-boot-image.patch']' returned non-zero exit status 128.

mmtrt avatar Mar 17 '23 07:03 mmtrt

What does git status inside build/make/ look like? Based on that error, it seems like you might need to cancel a rebase with git rebase --abort (and possible sync the repos again).

chenxiaolong avatar Mar 18 '23 00:03 chenxiaolong

looks like this,

➜  make git:(5465713) git status
Not currently on any branch.
You are in the middle of an am session.
  (fix conflicts and then run "git am --continue")
  (use "git am --skip" to skip this patch)
  (use "git am --abort" to restore the original branch)

nothing to commit, working tree clean

mmtrt avatar Mar 18 '23 05:03 mmtrt

resynced and retrying failed again. diff

➜  crd13 aosproot patch_code
Applying /root/aosp/crd13/vendor/aosproot/patches/build/make/0001-Apply-Magisk-patch-to-boot-image.patch in /root/aosp/crd13/build/make
Applying: Apply Magisk patch to boot image
error: patch failed: core/Makefile:5111
error: core/Makefile: patch does not apply
Patch failed at 0001 Apply Magisk patch to boot image
hint: Use 'git am --show-current-patch=diff' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Traceback (most recent call last):
  File "/root/aosp/crd13/out/host/linux-x86/bin/aosproot/internal/stdlib/runpy.py", line 196, in _run_module_as_main
  File "/root/aosp/crd13/out/host/linux-x86/bin/aosproot/internal/stdlib/runpy.py", line 86, in _run_code
  File "/root/aosp/crd13/out/host/linux-x86/bin/aosproot/__main__.py", line 12, in <module>
  File "/root/aosp/crd13/out/host/linux-x86/bin/aosproot/internal/stdlib/runpy.py", line 196, in _run_module_as_main
  File "/root/aosp/crd13/out/host/linux-x86/bin/aosproot/internal/stdlib/runpy.py", line 86, in _run_code
  File "/root/aosp/crd13/out/host/linux-x86/bin/aosproot/aosproot.py", line 129, in <module>
  File "/root/aosp/crd13/out/host/linux-x86/bin/aosproot/aosproot.py", line 123, in main
  File "/root/aosp/crd13/out/host/linux-x86/bin/aosproot/aosproot.py", line 84, in patch_code
  File "/root/aosp/crd13/out/host/linux-x86/bin/aosproot/internal/stdlib/subprocess.py", line 369, in check_call
subprocess.CalledProcessError: Command '['git', '-C', '/root/aosp/crd13/build/make', 'am', '/root/aosp/crd13/vendor/aosproot/patches/build/make/0001-Apply-Magisk-patch-to-boot-image.patch']' returned non-zero exit status 128.

mmtrt avatar Mar 18 '23 05:03 mmtrt

Ah, I wonder if the ROM you're building has some small changes to core/Makefile compared to AOSP. git am will fail to apply a patch if the diff doesn't match exactly.

I'd suggest applying the patch manually:

cd build/make
git am --abort
patch -p1 -i ../../vendor/aosproot/patches/build/make/0001-Apply-Magisk-patch-to-boot-image.patch

chenxiaolong avatar Mar 18 '23 18:03 chenxiaolong

fixed patch & applied manually, build fails now https://paste.myself5.de/enuwacubud

mmtrt avatar Mar 18 '23 20:03 mmtrt

Try replacing:

if info_dict['init_boot'] == 'true':

with:

if info_dict.get('init_boot') == 'true':

chenxiaolong avatar Mar 18 '23 21:03 chenxiaolong

still failing, even tho magisk apk is present. https://paste.myself5.de/eretirimuh

mmtrt avatar Mar 19 '23 04:03 mmtrt