summaryrefslogtreecommitdiffstats
path: root/mkbootimg
diff options
context:
space:
mode:
authorJayant Chowdhary <jchowdhary@google.com>2018-03-28 18:45:35 -0700
committerTao Bao <tbao@google.com>2018-03-31 07:13:33 -0700
commit478c7c1eafdce7c0a5dd951b6fc8d324505c4f95 (patch)
tree09fd00d34cf31290bd97de7ebc2f8a71d01c10e0 /mkbootimg
parent95a524460ab5f7694e488114378a1476415e3fe2 (diff)
downloadsystem_core-478c7c1eafdce7c0a5dd951b6fc8d324505c4f95.tar.gz
system_core-478c7c1eafdce7c0a5dd951b6fc8d324505c4f95.tar.bz2
system_core-478c7c1eafdce7c0a5dd951b6fc8d324505c4f95.zip
Add dummy vndk library libmkbootimg to enable abi checks on boot_img_hdr.
Bug: 74763691 Test: m -j libmkbootimg creates libmkbootimg.so.lsdump. Test: make -j64 Change-Id: I8d716c560467aaf090f4f7ee9cfbc53a9405f05d (cherry picked from commit 4cc755dce527434dc4b79c1734185faeab084bac)
Diffstat (limited to 'mkbootimg')
-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
4 files changed, 98 insertions, 14 deletions
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--;
+ }
+}