I have a .patch file that I want to apply to the android kernel, and I do so via:
patch -p1 < <patch-file>
After running it, I see git binary diffs are not supported
print for the following line of the patch:
+PRODUCT_COPY_FILES += \
+ hardware/ril/libquectel-ril/arm64-v8a/dir:system/bin/dir \
whereas dir
is a binary defined in a patch file.
Should I be initializing git, adding all the files, and then running git apply patch-file
?
Edit:
After running git init
, git add
, git commit
, I ran git apply <patch-file>
, and now I get:
warning: device/qcom/common/rootdir/etc/init.class_main.sh has type 100644, expected 100755
error: patch failed: device/qcom/sdm845/sdm845.mk:87
error: device/qcom/sdm845/sdm845.mk: patch does not apply
warning: device/qcom/sepolicy/generic/vendor/common/file_contexts has type 100644, expected 100755
file.patch:37781: new blank line at EOF.
+
warning: system/core/init/selinux.cpp has type 100644, expected 100755
error: patch failed: system/core/init/selinux.cpp:430
error: system/core/init/selinux.cpp: patch does not apply
patch
itself doesn't support them? Git added binary patches so that you could turn a commit into a patch even if some of the files in the commit are not printable text. Presumably whoever provided these patches, provided them on the assumption that you have the appropriate Git repository. If you can find the right source repository and clone it, you'll be in great shape. If not, you can find some other repository and clone it and hope, or turn what you have into a repository and wish-and-hope. – Contractedgit patch apply
to try to apply it. A patch only works if you have the right original file as well, though. I can't tell whether you have the right original file for that particular patch. – Contractedgit commit
? – Scheidergit patch apply
at any time: if you run it in a non-Git-repository, it just tries to be an improved version ofpatch
. But if you have a full Git repository, it can make use of theindex
lines at the front of each diff. – Contractedgit patch apply
? From what I looked up online, it'sgit apply patch-file
, which upon running errors outerror: device/qcom/sdm845/sdm845.mk: patch does not apply
– Scheidergit apply
, notgit patch apply
. Thepatch does not apply
error means that the patch is for files you don't have in the first place, which is what I was getting at: a patch is only good if you have the files it patches. You have some other set of files. – Contracteddevice/qcom/sdm845/sdm845.mk
file does exist though – Scheiderfile
, and I have a file that says "small medium large" namedfile
, do we have the same files? – Contracted