From 10d755b758bb356055338fdd2fa39ff0a88c9f05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-Cl=C3=A9ment=20Tosi?= Date: Wed, 1 Feb 2023 13:07:01 +0000 Subject: libavb: Introduce baremetal variant of the library Introduce a library intended for baremetal targets that statically link against libcrypto_baremetal instead of the libcrypto userspace library. Bug: 267447272 Test: - Change-Id: I853fb4d2761384dba498fd3547c59703f4a235e5 --- Android.bp | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/Android.bp b/Android.bp index 8354a88..b4660f8 100644 --- a/Android.bp +++ b/Android.bp @@ -114,9 +114,6 @@ cc_defaults { local_include_dirs: [ "libavb/boringssl", ], - shared_libs: [ - "libcrypto", - ], } cc_defaults { @@ -155,14 +152,24 @@ cc_defaults { "avb_sources", "avb_crypto_ops_impl_boringssl", ], + header_libs: [ + "avb_headers", + ], + export_header_lib_headers: ["avb_headers"], +} + +// Build libavb - this is a static library that depends +// on only libc and libcrypto, but no other dependencies. +cc_library_static { + name: "libavb", + defaults: ["libavb_defaults"], host_supported: true, ramdisk_available: true, vendor_ramdisk_available: true, recovery_available: true, - header_libs: [ - "avb_headers", + shared_libs: [ + "libcrypto", ], - export_header_lib_headers: ["avb_headers"], target: { linux: { srcs: ["libavb/avb_sysdeps_posix.c"], @@ -173,21 +180,17 @@ cc_defaults { }, } -// Build libavb - this is a static library that depends -// on only libc and libcrypto, but no other dependencies. -cc_library_static { - name: "libavb", - defaults: ["libavb_defaults"], -} - -// Build libavb_non_debug - this is a static library that depends -// on only libc and libcrypto, but no other dependencies. -// The non debug version of the library doesn't print any debug -// message. +// A variant of the library that can run in baremetal environments. +// +// The debug feature isn't enabled, removing verbose logging and assertions. cc_library_static { - name: "libavb_non_debug", + name: "libavb_baremetal", defaults: ["libavb_defaults"], cflags: ["-UAVB_ENABLE_DEBUG"], + static_libs: [ + "libcrypto_baremetal", + ], + srcs: ["libavb/avb_sysdeps_posix.c"], } // Build libavb_user for the target - in addition to libavb, it @@ -205,7 +208,10 @@ cc_library_static { "avb_headers", ], export_header_lib_headers: ["avb_headers"], - shared_libs: ["libbase"], + shared_libs: [ + "libbase", + "libcrypto", + ], static_libs: ["libfs_mgr"], cflags: [ "-DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED", -- cgit v1.2.3