summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJayant Chowdhary2018-03-28 20:45:35 -0500
committerTao Bao2018-03-31 09:13:33 -0500
commit478c7c1eafdce7c0a5dd951b6fc8d324505c4f95 (patch)
tree09fd00d34cf31290bd97de7ebc2f8a71d01c10e0 /mkbootimg
parent95a524460ab5f7694e488114378a1476415e3fe2 (diff)
downloadplatform-system-core-478c7c1eafdce7c0a5dd951b6fc8d324505c4f95.tar.gz
platform-system-core-478c7c1eafdce7c0a5dd951b6fc8d324505c4f95.tar.xz
platform-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 @@
1// Copyright 2012 The Android Open Source Project
2
3cc_library_headers {
4 name: "libmkbootimg_abi_headers",
5 vendor_available: true,
6 export_include_dirs: ["include"],
7}
8
9cc_library_headers {
10 name: "bootimg_headers",
11 vendor_available: true,
12 export_include_dirs: ["include/bootimg"],
13 host_supported: true,
14 target: {
15 windows: {
16 enabled: true,
17 },
18 },
19}
20
21cc_library {
22 name: "libmkbootimg_abi_check",
23 vendor_available: true,
24 vndk: {
25 enabled: true,
26 },
27 srcs: [
28 "mkbootimg_dummy.cpp",
29 ],
30 header_libs: ["libmkbootimg_abi_headers"],
31 export_header_lib_headers: ["libmkbootimg_abi_headers"],
32}
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 @@
1/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <bootimg/bootimg.h>
18
19// This header has been created for the following reaons:
20// 1) In order for a change in a user defined type to be classified as API /
21// ABI breaking, it needs to be referenced by an 'exported interface'
22// (in this case the function mkbootimg_dummy).
23// 2) Since 'mkbootimg_dummy' needs to be exported, we need to have it
24// exposed through a public header.
25// 3) It is desirable not to pollute bootimg.h with interfaces which are not
26// 'used' in reality by on device binaries. Furthermore, bootimg.h might
27// be exported by a library in the future, so we must avoid polluting it.
28void 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 @@
2** 2**
3** Copyright 2007, The Android Open Source Project 3** Copyright 2007, The Android Open Source Project
4** 4**
5** Licensed under the Apache License, Version 2.0 (the "License"); 5** Licensed under the Apache License, Version 2.0 (the "License");
6** you may not use this file except in compliance with the License. 6** you may not use this file except in compliance with the License.
7** You may obtain a copy of the License at 7** You may obtain a copy of the License at
8** 8**
9** http://www.apache.org/licenses/LICENSE-2.0 9** http://www.apache.org/licenses/LICENSE-2.0
10** 10**
11** Unless required by applicable law or agreed to in writing, software 11** Unless required by applicable law or agreed to in writing, software
12** distributed under the License is distributed on an "AS IS" BASIS, 12** distributed under the License is distributed on an "AS IS" BASIS,
13** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14** See the License for the specific language governing permissions and 14** See the License for the specific language governing permissions and
15** limitations under the License. 15** limitations under the License.
16*/ 16*/
17 17
@@ -34,17 +34,17 @@
34struct boot_img_hdr_v0 { 34struct boot_img_hdr_v0 {
35 uint8_t magic[BOOT_MAGIC_SIZE]; 35 uint8_t magic[BOOT_MAGIC_SIZE];
36 36
37 uint32_t kernel_size; /* size in bytes */ 37 uint32_t kernel_size; /* size in bytes */
38 uint32_t kernel_addr; /* physical load addr */ 38 uint32_t kernel_addr; /* physical load addr */
39 39
40 uint32_t ramdisk_size; /* size in bytes */ 40 uint32_t ramdisk_size; /* size in bytes */
41 uint32_t ramdisk_addr; /* physical load addr */ 41 uint32_t ramdisk_addr; /* physical load addr */
42 42
43 uint32_t second_size; /* size in bytes */ 43 uint32_t second_size; /* size in bytes */
44 uint32_t second_addr; /* physical load addr */ 44 uint32_t second_addr; /* physical load addr */
45 45
46 uint32_t tags_addr; /* physical addr for kernel tags */ 46 uint32_t tags_addr; /* physical addr for kernel tags */
47 uint32_t page_size; /* flash page size we assume */ 47 uint32_t page_size; /* flash page size we assume */
48 /* 48 /*
49 * version for the boot image header. 49 * version for the boot image header.
50 */ 50 */
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 @@
1/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <abi_check/mkbootimg_abi_check.h>
18
19void mkbootimg_dummy(boot_img_hdr* hdr) {
20 // TODO: Hack to trigger abi checks, remove this.
21 if (hdr) {
22 hdr--;
23 }
24}