Skip to content

Conversation

JamiKettunen
Copy link
Contributor

@JamiKettunen JamiKettunen commented Oct 8, 2022

It now requires an import of a gki/generate_gki_certificate.py, so install the scripts in /usr/share/android-tools/mkbootimg and symlink back to /usr/bin/mkbootimg to avoid having to patch anything.

Suggestions for a better way to create the symlink are welcome, I'm not entirely happy with it, but it does work :)

Fixes #76.

@JamiKettunen
Copy link
Contributor Author

JamiKettunen commented Oct 8, 2022

Now that I thought about it ${CMAKE_INSTALL_FULL_DATADIR}/android-tools (otherwise known as /usr/share/android-tools) would be a better place to put the scripts in than the rather arbitrary /usr/lib/android-tools.

I guess now my question is do I put the files in a /usr/share/android-tools/mkbootimg subdir? I've done that for now as well, let me know if anything should be changed.

@JamiKettunen JamiKettunen marked this pull request as draft October 8, 2022 13:03
@JamiKettunen JamiKettunen marked this pull request as ready for review October 8, 2022 13:11
@JamiKettunen
Copy link
Contributor Author

Would it be possible to also get #68 merged before creating a new 33.0.3p1 tag with this imho rather important fix included?

@@ -0,0 +1 @@
install(PROGRAMS avb/avbtool.py DESTINATION bin RENAME avbtool)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to split this PR into 2 separate commits.

1 - fix of mkbootimg
2 - enabling avb tool

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anatol Done, see #79 for avbtool.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I just realized you meant splitting it to 2 commits in this PR, oh well... let me know if you want them both here and I can close the other.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either works for me.

The current condition looks good to me. There is no need to redo it.

@nmeum are you OK with this PR?

It now requires an import of a gki/generate_gki_certificate.py, so
install the scripts in /usr/share/android-tools/mkbootimg and symlink
back to /usr/bin/mkbootimg to avoid having to patch anything.
@anatol anatol merged commit fe2501b into nmeum:master Oct 14, 2022
install(PROGRAMS mkbootimg/mkbootimg.py DESTINATION bin RENAME mkbootimg)
set(MKBOOTIMG_SCRIPTS_DIR "${CMAKE_INSTALL_FULL_DATADIR}/android-tools/mkbootimg")
install(PROGRAMS mkbootimg/mkbootimg.py DESTINATION ${MKBOOTIMG_SCRIPTS_DIR})
add_custom_target(mkbootimg_symlink ALL COMMAND ${CMAKE_COMMAND} -E create_symlink
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that this target is called even if I do not modify any sources

ninja: Entering directory `build'
[1/1] cd /home/anatol/sources/android-tools/build/vendor && /usr/bin/cmake -E create_symlink /usr/share/android-tools/mkbootimg/mkbootimg.py /home/anatol/sources/android-tools/build/vendor/mkbootimg

what is this custom target used for? Do we need it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing, this was one of the ways I found to create the final installed /usr/bin/mkbootimg symlink file itself (which the install() below places in /usr/bin/); I already acknowledged it wasn't so nice in the description of the PR.

Please do replace it with something else if you know a better way!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not really an CMake expert cc @nmeum for more help

@nmeum Do you know how to get install() target to avoid re-run here in case of a no-op build?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add_custom_target is not intended to have any output and is thus always run. You could maybe try to work around that via add_custom_command? I haven't looked into using that to create symlinks as part of the installation though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

33.0.3 breaks creating boot images with mkbootimg
3 participants