nmeum / android-tools

Unoffical CMake-based build system for android command line utilities
Apache License 2.0
191 stars 57 forks source link

33.0.3 breaks creating boot images with mkbootimg #76

Closed RayyanAnsari closed 2 years ago

RayyanAnsari commented 2 years ago

With the latest android-tools 33.0.3, creating a boot image using mkbootimg is broken with this error:

Traceback (most recent call last):
File "/usr/bin/mkbootimg", line 31, in <module>
from gki.generate_gki_certificate import generate_gki_certificate
ModuleNotFoundError: No module named 'gki'

This issue does not happen in android-tools 31.0.3.

https://bugs.archlinux.org/task/76090 @anatol

munix9 commented 2 years ago

FYI: On openSUSE, we install vendor/mkbootimg/gki to /usr/lib/android-tools/ and then patch vendor/mkbootimg/mkbootimg.py using https://build.opensuse.org/package/view_file/home:munix9/android-tools/fix-mkbootimg-gki-path.patch?expand=1

--- a/vendor/mkbootimg/mkbootimg.py
+++ b/vendor/mkbootimg/mkbootimg.py
@@ -28,6 +28,9 @@
 import re
 import tempfile

+import sys
+sys.path.append('/usr/lib/android-tools')
+
 from gki.generate_gki_certificate import generate_gki_certificate

 # Constant and structure definition is in

One more hint:
gki/generate_gki_certificate.py requires avbtool from vendor/avb/.
We copy that using cp -pd vendor/avb/avbtool{,.py} /usr/bin/

I think that was it.

anatol commented 2 years ago

generate_gki_certificate python function is defined at ./vendor/mkbootimg/gki

These python files need to be installed by CMakeLists.mkbootimg.txt.

cc @JamiKettunen

JamiKettunen commented 2 years ago

I'll take a look tomorrow, thanks for letting me know. I didn't yet hit this myself as I use the android-tools package from Void Linux repositories which is still on 31.0.3p2; seems I'll be adopting the package as I use it practically every day (including mkbootimg) so it receives more timely updates as well.

arthurlutz commented 7 months ago

Getting this same (packaging?) bug in ubuntu noble 24.4 : https://bugs.launchpad.net/ubuntu/+source/android-platform-tools/+bug/2058228

JamiKettunen commented 7 months ago

@arthurlutz Ubuntu don't even build their android-tools from this repo based on https://git.launchpad.net/ubuntu/+source/android-platform-tools/tree/?h=ubuntu/noble (similar to upstream Debian: https://salsa.debian.org/android-tools-team/android-platform-tools) but deal directly with the android sources with their own makefiles, besides the fix is already well-known as per the PR which closed this issue here.