blob: b6ce49f30368ac26158985a2a6c96ba37449ae38 [file] [log] [blame]
David Zeuthen21e95262016-07-27 17:58:40 -04001#
David Zeuthenc612e2e2016-09-16 16:44:08 -04002# Copyright 2016, The Android Open Source Project
David Zeuthen21e95262016-07-27 17:58:40 -04003#
David Zeuthenc612e2e2016-09-16 16:44:08 -04004# Permission is hereby granted, free of charge, to any person
5# obtaining a copy of this software and associated documentation
6# files (the "Software"), to deal in the Software without
7# restriction, including without limitation the rights to use, copy,
8# modify, merge, publish, distribute, sublicense, and/or sell copies
9# of the Software, and to permit persons to whom the Software is
10# furnished to do so, subject to the following conditions:
David Zeuthen21e95262016-07-27 17:58:40 -040011#
David Zeuthenc612e2e2016-09-16 16:44:08 -040012# The above copyright notice and this permission notice shall be
13# included in all copies or substantial portions of the Software.
David Zeuthen21e95262016-07-27 17:58:40 -040014#
David Zeuthenc612e2e2016-09-16 16:44:08 -040015# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22# SOFTWARE.
David Zeuthen21e95262016-07-27 17:58:40 -040023#
24
25LOCAL_PATH := $(my-dir)
26
27avb_common_cflags := \
28 -D_FILE_OFFSET_BITS=64 \
29 -D_POSIX_C_SOURCE=199309L \
30 -Wa,--noexecstack \
31 -Werror \
32 -Wall \
33 -Wextra \
34 -Wformat=2 \
35 -Wno-psabi \
36 -Wno-unused-parameter \
37 -ffunction-sections \
David Zeuthen1eb74c92016-10-03 16:47:38 -040038 -fstack-protector-strong
David Zeuthen21e95262016-07-27 17:58:40 -040039avb_common_cppflags := \
40 -Wnon-virtual-dtor \
41 -fno-strict-aliasing
42avb_common_ldflags := \
43 -Wl,--gc-sections
44
45include $(CLEAR_VARS)
46LOCAL_SRC_FILES := avbtool
47LOCAL_MODULE_CLASS := EXECUTABLES
David Zeuthen0b7f1d32016-10-25 17:53:49 -040048LOCAL_REQUIRED_MODULES := fec
David Zeuthen21e95262016-07-27 17:58:40 -040049LOCAL_IS_HOST_MODULE := true
50LOCAL_MODULE := avbtool
51include $(BUILD_PREBUILT)
52
David Zeuthenbaf59e22016-11-14 15:39:43 -050053# Build libavb for the target (for e.g. fs_mgr usage).
David Zeuthen21e95262016-07-27 17:58:40 -040054include $(CLEAR_VARS)
55LOCAL_MODULE := libavb
56LOCAL_MODULE_HOST_OS := linux
David Zeuthenbaf59e22016-11-14 15:39:43 -050057LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
David Zeuthen21e95262016-07-27 17:58:40 -040058LOCAL_CLANG := true
David Zeuthen1eb74c92016-10-03 16:47:38 -040059LOCAL_CFLAGS := $(avb_common_cflags) -DAVB_ENABLE_DEBUG -DAVB_COMPILATION
David Zeuthen21e95262016-07-27 17:58:40 -040060LOCAL_LDFLAGS := $(avb_common_ldflags)
David Zeuthen21e95262016-07-27 17:58:40 -040061LOCAL_SRC_FILES := \
62 libavb/avb_chain_partition_descriptor.c \
David Zeuthen8b6973b2016-09-20 12:39:49 -040063 libavb/avb_crc32.c \
David Zeuthen21e95262016-07-27 17:58:40 -040064 libavb/avb_crypto.c \
65 libavb/avb_descriptor.c \
66 libavb/avb_footer.c \
67 libavb/avb_hash_descriptor.c \
68 libavb/avb_hashtree_descriptor.c \
69 libavb/avb_kernel_cmdline_descriptor.c \
70 libavb/avb_property_descriptor.c \
71 libavb/avb_rsa.c \
72 libavb/avb_sha256.c \
73 libavb/avb_sha512.c \
74 libavb/avb_slot_verify.c \
75 libavb/avb_sysdeps_posix.c \
76 libavb/avb_util.c \
77 libavb/avb_vbmeta_image.c
bowgotsaiaf004a82016-10-24 17:10:45 +080078include $(BUILD_STATIC_LIBRARY)
David Zeuthen21e95262016-07-27 17:58:40 -040079
David Zeuthenbaf59e22016-11-14 15:39:43 -050080# Build libavb for the host (for unit tests).
David Zeuthen21e95262016-07-27 17:58:40 -040081include $(CLEAR_VARS)
82LOCAL_MODULE := libavb_host
83LOCAL_MODULE_HOST_OS := linux
David Zeuthenbaf59e22016-11-14 15:39:43 -050084LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
David Zeuthen21e95262016-07-27 17:58:40 -040085LOCAL_MODULE_CLASS := STATIC_LIBRARIES
86LOCAL_CLANG := true
87LOCAL_CFLAGS := $(avb_common_cflags) -fno-stack-protector -DAVB_ENABLE_DEBUG -DAVB_COMPILATION
88LOCAL_LDFLAGS := $(avb_common_ldflags)
David Zeuthen21e95262016-07-27 17:58:40 -040089LOCAL_SRC_FILES := \
90 libavb/avb_chain_partition_descriptor.c \
David Zeuthen8b6973b2016-09-20 12:39:49 -040091 libavb/avb_crc32.c \
David Zeuthen21e95262016-07-27 17:58:40 -040092 libavb/avb_crypto.c \
93 libavb/avb_descriptor.c \
94 libavb/avb_footer.c \
95 libavb/avb_hash_descriptor.c \
96 libavb/avb_hashtree_descriptor.c \
97 libavb/avb_kernel_cmdline_descriptor.c \
98 libavb/avb_property_descriptor.c \
99 libavb/avb_rsa.c \
100 libavb/avb_sha256.c \
101 libavb/avb_sha512.c \
102 libavb/avb_slot_verify.c \
103 libavb/avb_util.c \
104 libavb/avb_vbmeta_image.c
105include $(BUILD_HOST_STATIC_LIBRARY)
106
David Zeuthenbaf59e22016-11-14 15:39:43 -0500107# Build libavb_ab for the host (for unit tests).
108include $(CLEAR_VARS)
109LOCAL_MODULE := libavb_ab_host
110LOCAL_REQUIRED_MODULES := libavb_host
111LOCAL_MODULE_HOST_OS := linux
112LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
113LOCAL_MODULE_CLASS := STATIC_LIBRARIES
114LOCAL_CLANG := true
115LOCAL_CFLAGS := $(avb_common_cflags) -fno-stack-protector -DAVB_ENABLE_DEBUG -DAVB_COMPILATION
116LOCAL_LDFLAGS := $(avb_common_ldflags)
117LOCAL_SRC_FILES := \
118 libavb_ab/avb_ab_flow.c
119include $(BUILD_HOST_STATIC_LIBRARY)
120
Darren Krahn147b08d2016-12-20 16:38:29 -0800121# Build libavb_atx for the host (for unit tests).
122include $(CLEAR_VARS)
123LOCAL_MODULE := libavb_atx_host
124LOCAL_REQUIRED_MODULES := libavb_host
125LOCAL_MODULE_HOST_OS := linux
126LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
127LOCAL_MODULE_CLASS := STATIC_LIBRARIES
128LOCAL_CLANG := true
129LOCAL_CFLAGS := $(avb_common_cflags) -fno-stack-protector -DAVB_ENABLE_DEBUG -DAVB_COMPILATION
130LOCAL_LDFLAGS := $(avb_common_ldflags)
131LOCAL_SRC_FILES := \
132 libavb_atx/avb_atx_validate.c
133include $(BUILD_HOST_STATIC_LIBRARY)
134
David Zeuthen21e95262016-07-27 17:58:40 -0400135include $(CLEAR_VARS)
136LOCAL_MODULE := libavb_host_sysdeps
David Zeuthenbaf59e22016-11-14 15:39:43 -0500137LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
David Zeuthen21e95262016-07-27 17:58:40 -0400138LOCAL_MODULE_HOST_OS := linux
139LOCAL_MODULE_CLASS := STATIC_LIBRARIES
140LOCAL_CLANG := true
141LOCAL_CFLAGS := $(avb_common_cflags) -DAVB_ENABLE_DEBUG -DAVB_COMPILATION
142LOCAL_LDFLAGS := $(avb_common_ldflags)
David Zeuthen21e95262016-07-27 17:58:40 -0400143LOCAL_SRC_FILES := \
144 libavb/avb_sysdeps_posix.c
145include $(BUILD_HOST_STATIC_LIBRARY)
146
147include $(CLEAR_VARS)
148LOCAL_MODULE := libavb_host_unittest
Darren Krahn147b08d2016-12-20 16:38:29 -0800149LOCAL_REQUIRED_MODULES := simg2img img2simg avbtool
David Zeuthen21e95262016-07-27 17:58:40 -0400150LOCAL_MODULE_HOST_OS := linux
151LOCAL_CPP_EXTENSION := .cc
152LOCAL_CLANG := true
153LOCAL_CFLAGS := $(avb_common_cflags) -DAVB_ENABLE_DEBUG -DAVB_COMPILATION
154LOCAL_CPPFLAGS := $(avb_common_cppflags)
155LOCAL_LDFLAGS := $(avb_common_ldflags)
David Zeuthen21e95262016-07-27 17:58:40 -0400156LOCAL_STATIC_LIBRARIES := \
157 libavb_host \
158 libavb_host_sysdeps \
David Zeuthenbaf59e22016-11-14 15:39:43 -0500159 libavb_ab_host \
Darren Krahn147b08d2016-12-20 16:38:29 -0800160 libavb_atx_host \
David Zeuthen21e95262016-07-27 17:58:40 -0400161 libgmock_host \
162 libgtest_host
163LOCAL_SHARED_LIBRARIES := \
Darren Krahn147b08d2016-12-20 16:38:29 -0800164 libchrome \
Jocelyn Bohr1bb0e3b2017-01-20 13:55:51 -0800165 libcrypto
David Zeuthen21e95262016-07-27 17:58:40 -0400166LOCAL_SRC_FILES := \
David Zeuthen8b6973b2016-09-20 12:39:49 -0400167 test/avb_ab_flow_unittest.cc \
Darren Krahn147b08d2016-12-20 16:38:29 -0800168 test/avb_atx_validate_unittest.cc \
David Zeuthen21e95262016-07-27 17:58:40 -0400169 test/avb_slot_verify_unittest.cc \
David Zeuthen8681a332016-11-23 13:44:06 -0500170 test/avb_unittest_util.cc \
David Zeuthen21e95262016-07-27 17:58:40 -0400171 test/avb_util_unittest.cc \
172 test/avb_vbmeta_image_unittest.cc \
David Zeuthen8b6973b2016-09-20 12:39:49 -0400173 test/avbtool_unittest.cc \
174 test/fake_avb_ops.cc
David Zeuthen21e95262016-07-27 17:58:40 -0400175LOCAL_LDLIBS_linux := -lrt
176include $(BUILD_HOST_NATIVE_TEST)
177
178include $(CLEAR_VARS)
Darren Krahn147b08d2016-12-20 16:38:29 -0800179LOCAL_MODULE := libavb_host_user_code_test
180LOCAL_MODULE_HOST_OS := linux
181LOCAL_MODULE_CLASS := STATIC_LIBRARIES
182LOCAL_CPP_EXTENSION := .cc
183LOCAL_CLANG := true
184LOCAL_CFLAGS := $(avb_common_cflags)
185LOCAL_CPPFLAGS := $(avb_common_cppflags)
186LOCAL_LDFLAGS := $(avb_common_ldflags)
187LOCAL_SRC_FILES := test/user_code_test.cc
188include $(BUILD_HOST_STATIC_LIBRARY)
189
190include $(CLEAR_VARS)
David Zeuthen8b6973b2016-09-20 12:39:49 -0400191LOCAL_MODULE := bootctrl.avb
192LOCAL_MODULE_RELATIVE_PATH := hw
193LOCAL_REQUIRED_MODULES := libavb
194LOCAL_SRC_FILES := \
195 boot_control/boot_control_avb.c \
196 boot_control/avb_ops_device.c \
David Zeuthenbaf59e22016-11-14 15:39:43 -0500197 libavb_ab/avb_ab_flow.c \
David Zeuthen8b6973b2016-09-20 12:39:49 -0400198 libavb/avb_sysdeps_posix.c
199LOCAL_CLANG := true
200LOCAL_CFLAGS := $(avb_common_cflags) -DAVB_COMPILATION
201LOCAL_LDFLAGS := $(avb_common_ldflags)
bowgotsaifaa5d3a2017-01-24 21:35:31 +0800202LOCAL_SHARED_LIBRARIES := libbase libcutils
David Zeuthenbaf59e22016-11-14 15:39:43 -0500203LOCAL_STATIC_LIBRARIES := libfs_mgr libavb
David Zeuthenb0013ae2016-10-20 17:00:49 -0400204LOCAL_POST_INSTALL_CMD := \
205 $(hide) mkdir -p $(TARGET_OUT_SHARED_LIBRARIES)/hw && \
206 ln -sf bootctrl.avb.so $(TARGET_OUT_SHARED_LIBRARIES)/hw/bootctrl.default.so
David Zeuthen8b6973b2016-09-20 12:39:49 -0400207include $(BUILD_SHARED_LIBRARY)
208
209include $(CLEAR_VARS)
David Zeuthen21e95262016-07-27 17:58:40 -0400210LOCAL_SRC_FILES := libavb_host_symbols_test
211LOCAL_MODULE_TAGS := debug
David Zeuthenbaf59e22016-11-14 15:39:43 -0500212LOCAL_ADDITIONAL_DEPENDENCIES := libavb_ab_host
David Zeuthen21e95262016-07-27 17:58:40 -0400213include $(BUILD_HOST_PREBUILT)