Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2] package/libcamera: strip symbols before signing IPA libs
@ 2022-05-06 10:46 Quentin Schulz
  2022-05-31 10:13 ` Quentin Schulz
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Quentin Schulz @ 2022-05-06 10:46 UTC (permalink / raw)
  To: buildroot; +Cc: Quentin Schulz, Quentin Schulz, Kieran Bingham

From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

Open-Source IPA shlibs need to be signed in order to be runnable within
the same process, otherwise they are deemed Closed-Source and run in
another process and communicate over IPC.

The shlib installed on the target should be the same as the one signed
by libcamera during package creation otherwise the signature won't match
the shlib.

Buildroot sanitizes RPATH in a post build process. meson gets rid of
rpath while installing so we don't need to do it manually.

Buildroot may strip symbols, so we need to do the same before signing.
Since meson install target is also signing the IPA shlibs, let's strip
them before this happens.

Cc: Quentin Schulz <foss+buildroot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---

v2:
 - use LIBCAMERA_POST_BUILD_HOOKS instead of replacing
 LIBCAMERA_INSTALL_TARGET_CMDS,
 - add handling of BR2_STRIP_EXCLUDE_FILES to not strip files which
 shouldn't,
 - added --no-run-if-empty to xargs, in case no IPA is selected,
 - removed stderr redirect and pipe to true to not hide useful
 information or fail the build if strip does not work,

 package/libcamera/libcamera.mk | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/package/libcamera/libcamera.mk b/package/libcamera/libcamera.mk
index 77381ab3ca..41d6a5abef 100644
--- a/package/libcamera/libcamera.mk
+++ b/package/libcamera/libcamera.mk
@@ -104,4 +104,24 @@ LIBCAMERA_DEPENDENCIES += libexecinfo
 LIBCAMERA_LDFLAGS = $(TARGET_LDFLAGS) -lexecinfo
 endif
 
+# Open-Source IPA shlibs need to be signed in order to be runnable within the
+# same process, otherwise they are deemed Closed-Source and run in another
+# process and communicate over IPC.
+# Buildroot sanitizes RPATH in a post build process. meson gets rid of rpath
+# while installing so we don't need to do it manually here.
+# Buildroot may strip symbols, so we need to do the same before signing
+# otherwise the signature won't match the shlib on the rootfs. Since meson
+# install target is signing the shlibs, we need to strip them before.
+LIBCAMERA_STRIP_FIND_CMD = \
+	find $(@D)/build/src/ipa \
+	$(if $(call qstrip,$(BR2_STRIP_EXCLUDE_FILES)), \
+		-not \( $(call findfileclauses,$(call qstrip,$(BR2_STRIP_EXCLUDE_FILES))) \) ) \
+	-type f -name 'ipa_*.so' -print0
+
+define LIBCAMERA_BUILD_STRIP_IPA_SO
+	$(LIBCAMERA_STRIP_FIND_CMD) | xargs --no-run-if-empty -0 $(STRIPCMD)
+endef
+
+LIBCAMERA_POST_BUILD_HOOKS += LIBCAMERA_BUILD_STRIP_IPA_SO
+
 $(eval $(meson-package))
-- 
2.35.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-07-22  8:33 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-06 10:46 [Buildroot] [PATCH v2] package/libcamera: strip symbols before signing IPA libs Quentin Schulz
2022-05-31 10:13 ` Quentin Schulz
2022-07-04 15:25   ` Quentin Schulz
2022-07-04 17:29 ` James Hilliard
2022-07-04 19:13   ` Kieran Bingham
2022-07-04 19:45     ` James Hilliard
2022-07-04 21:49       ` Kieran Bingham
2022-07-04 22:18         ` James Hilliard
2022-07-04 20:09   ` Yann E. MORIN
2022-07-04 20:18     ` James Hilliard
2022-07-04 20:04 ` Yann E. MORIN
2022-07-04 22:16   ` Kieran Bingham
2022-07-04 22:23     ` James Hilliard
2022-07-22  8:32 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox