summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fastboot/Android.mk3
-rw-r--r--init/Android.bp4
-rw-r--r--mkbootimg/Android.bp32
-rw-r--r--mkbootimg/include/abi_check/mkbootimg_abi_check.h28
-rw-r--r--mkbootimg/include/bootimg/bootimg.h (renamed from mkbootimg/bootimg.h)28
-rw-r--r--mkbootimg/mkbootimg_dummy.cpp24
6 files changed, 101 insertions, 18 deletions
diff --git a/fastboot/Android.mk b/fastboot/Android.mk
index f5bcc264d..944b00b16 100644
--- a/fastboot/Android.mk
+++ b/fastboot/Android.mk
@@ -22,7 +22,8 @@ LOCAL_CFLAGS += -DFASTBOOT_VERSION="\"$(tool_version)\""
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../adb \
- $(LOCAL_PATH)/../mkbootimg \
+
+LOCAL_HEADER_LIBRARIES := bootimg_headers
LOCAL_SRC_FILES := \
bootimg_utils.cpp \
diff --git a/init/Android.bp b/init/Android.bp
index 31c8efb09..70a4ac651 100644
--- a/init/Android.bp
+++ b/init/Android.bp
@@ -127,9 +127,7 @@ cc_library_static {
"watchdogd.cpp",
],
whole_static_libs: ["libcap"],
- include_dirs: [
- "system/core/mkbootimg",
- ],
+ header_libs: ["bootimg_headers"],
proto: {
type: "lite",
export_proto_headers: true,
diff --git a/mkbootimg/Android.bp b/mkbootimg/Android.bp
new file mode 100644
index 000000000..b49434679
--- /dev/null
+++ b/mkbootimg/Android.bp
@@ -0,0 +1,32 @@
+// Copyright 2012 The Android Open Source Project
+
+cc_library_headers {
+ name: "libmkbootimg_abi_headers",
+ vendor_available: true,
+ export_include_dirs: ["include"],
+}
+
+cc_library_headers {
+ name: "bootimg_headers",
+ vendor_available: true,
+ export_include_dirs: ["include/bootimg"],
+ host_supported: true,
+ target: {
+ windows: {
+ enabled: true,
+ },
+ },
+}
+
+cc_library {
+ name: "libmkbootimg_abi_check",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
+ srcs: [
+ "mkbootimg_dummy.cpp",
+ ],
+ header_libs: ["libmkbootimg_abi_headers"],
+ export_header_lib_headers: ["libmkbootimg_abi_headers"],
+}
diff --git a/mkbootimg/include/abi_check/mkbootimg_abi_check.h b/mkbootimg/include/abi_check/mkbootimg_abi_check.h
new file mode 100644
index 000000000..d478aba09
--- /dev/null
+++ b/mkbootimg/include/abi_check/mkbootimg_abi_check.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <bootimg/bootimg.h>
+
+// This header has been created for the following reaons:
+// 1) In order for a change in a user defined type to be classified as API /
+// ABI breaking, it needs to be referenced by an 'exported interface'
+// (in this case the function mkbootimg_dummy).
+// 2) Since 'mkbootimg_dummy' needs to be exported, we need to have it
+// exposed through a public header.
+// 3) It is desirable not to pollute bootimg.h with interfaces which are not
+// 'used' in reality by on device binaries. Furthermore, bootimg.h might
+// be exported by a library in the future, so we must avoid polluting it.
+void mkbootimg_dummy(boot_img_hdr*);
diff --git a/mkbootimg/bootimg.h b/mkbootimg/include/bootimg/bootimg.h
index 1be8c229c..4311b46f9 100644
--- a/mkbootimg/bootimg.h
+++ b/mkbootimg/include/bootimg/bootimg.h
@@ -2,16 +2,16 @@
**
** Copyright 2007, The Android Open Source Project
**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
**
-** http://www.apache.org/licenses/LICENSE-2.0
+** http://www.apache.org/licenses/LICENSE-2.0
**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
** limitations under the License.
*/
@@ -34,17 +34,17 @@
struct boot_img_hdr_v0 {
uint8_t magic[BOOT_MAGIC_SIZE];
- uint32_t kernel_size; /* size in bytes */
- uint32_t kernel_addr; /* physical load addr */
+ uint32_t kernel_size; /* size in bytes */
+ uint32_t kernel_addr; /* physical load addr */
uint32_t ramdisk_size; /* size in bytes */
uint32_t ramdisk_addr; /* physical load addr */
- uint32_t second_size; /* size in bytes */
- uint32_t second_addr; /* physical load addr */
+ uint32_t second_size; /* size in bytes */
+ uint32_t second_addr; /* physical load addr */
- uint32_t tags_addr; /* physical addr for kernel tags */
- uint32_t page_size; /* flash page size we assume */
+ uint32_t tags_addr; /* physical addr for kernel tags */
+ uint32_t page_size; /* flash page size we assume */
/*
* version for the boot image header.
*/
diff --git a/mkbootimg/mkbootimg_dummy.cpp b/mkbootimg/mkbootimg_dummy.cpp
new file mode 100644
index 000000000..410d37909
--- /dev/null
+++ b/mkbootimg/mkbootimg_dummy.cpp
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <abi_check/mkbootimg_abi_check.h>
+
+void mkbootimg_dummy(boot_img_hdr* hdr) {
+ // TODO: Hack to trigger abi checks, remove this.
+ if (hdr) {
+ hdr--;
+ }
+}