blob: 7561800ef992bcb2779c5220171c9500827c93a5 [file] [log] [blame]
Bob Badoure8af2842022-04-07 10:44:22 -07001package {
2 default_applicable_licenses: ["Android-Apache-2.0"],
3}
4
Andrew Walbran68a8c162022-03-07 15:38:42 +00005rust_ffi_static {
6 name: "libpvmfw",
7 crate_name: "pvmfw",
David Brazdil30a7f082022-07-07 15:30:14 +01008 defaults: ["vmbase_ffi_defaults"],
Andrew Walbran68a8c162022-03-07 15:38:42 +00009 srcs: ["src/main.rs"],
10 edition: "2021",
Pierre-Clément Tosie8726e42022-10-17 13:35:27 +010011 features: [
12 "legacy",
13 ],
Andrew Walbranf2594882022-03-15 17:32:53 +000014 rustlibs: [
Pierre-Clément Tosia8a4a202022-11-03 14:16:46 +000015 "libaarch64_paging",
Pierre-Clément Tosifc531152022-10-20 12:22:23 +010016 "libbuddy_system_allocator",
Alice Wangcb9d2f92023-02-06 10:29:00 +000017 "libdiced_open_dice_nostd",
Andrew Walbran730375d2022-12-21 14:04:34 +000018 "libfdtpci",
Pierre-Clément Tosia0934c12022-11-25 20:54:11 +000019 "liblibfdt",
Pierre-Clément Tosi37105a62022-10-18 12:21:48 +010020 "liblog_rust_nostd",
Andrew Walbranb398fc82023-01-24 14:45:46 +000021 "libonce_cell_nostd",
Pierre-Clément Tosi2d652982023-01-09 19:30:17 +000022 "libpvmfw_avb_nostd",
Pierre-Clément Tosi4ef75222022-10-26 17:40:50 +010023 "libpvmfw_embedded_key",
Pierre-Clément Tosi328dfb62022-11-25 18:20:42 +000024 "libtinyvec_nostd",
Andrew Walbrand1d03182022-12-09 18:20:01 +000025 "libvirtio_drivers",
Andrew Walbrandd74b902022-04-14 16:12:50 +000026 "libvmbase",
Pierre-Clément Tosi8383c542022-11-01 14:07:29 +000027 "libzeroize_nostd",
Andrew Walbranf2594882022-03-15 17:32:53 +000028 ],
Andrew Walbran68a8c162022-03-07 15:38:42 +000029}
Andrew Walbran15068b02022-03-22 15:57:34 +000030
31cc_binary {
Pierre-Clément Tosib1300352022-09-09 11:01:06 +010032 name: "pvmfw",
David Brazdil30a7f082022-07-07 15:30:14 +010033 defaults: ["vmbase_elf_defaults"],
Andrew Walbran15068b02022-03-22 15:57:34 +000034 srcs: [
Andrew Walbran267f6c12022-03-24 11:26:36 +000035 "idmap.S",
Andrew Walbran15068b02022-03-22 15:57:34 +000036 ],
37 static_libs: [
38 "libpvmfw",
39 ],
Andrew Walbrana5b7af52022-07-06 15:06:20 +000040 linker_scripts: [
41 "image.ld",
42 ":vmbase_sections",
43 ],
Jiyong Park17b8d752022-12-16 14:36:24 +090044 // `installable: false` is inherited from vmbase_elf_defaults, and that
45 // hides this module from Make, which makes it impossible for the Make world
46 // to place the unstripped binary to the symbols directory. Marking back as
47 // installable exposes this module to the Make world again. Note that this
48 // module (pvmfw) still is NOT installed to any of the filesystem images. It
49 // is fed into pvmfw_bin and then into pvmfw_img to become a standalone
50 // partition image. This is just to package the unstripped file into the
51 // symbols zip file for debugging purpose.
52 installable: true,
Andrew Walbran15068b02022-03-22 15:57:34 +000053}
David Brazdil05d4e072022-04-25 14:47:06 +010054
55raw_binary {
Pierre-Clément Tosib1300352022-09-09 11:01:06 +010056 name: "pvmfw_bin",
57 stem: "pvmfw.bin",
58 src: ":pvmfw",
David Brazdil05d4e072022-04-25 14:47:06 +010059 enabled: false,
60 target: {
61 android_arm64: {
62 enabled: true,
63 },
64 },
65}
David Brazdilac216b52022-04-25 15:07:22 +010066
Jaewan Kim2cf6f392023-02-10 01:35:47 +090067// Provide pvmfw.bin binary regardless of the architecture for building test.
68// Note that skipping tests on unsupported device is easy
69// while configuring server configuration to make such tests to run on working
70// devices.
71prebuilt_etc {
72 name: "pvmfw_test",
73 filename: "pvmfw_test.bin",
74 target: {
75 android_arm64: {
76 src: ":pvmfw_bin",
77 },
78 },
79 src: "empty_file",
80 installable: false,
81}
82
Pierre-Clément Tosib5771c02022-09-06 16:01:35 +010083prebuilt_etc {
Pierre-Clément Tosi6ec2ae22022-10-26 15:14:45 +010084 name: "pvmfw_embedded_key",
85 src: ":avb_testkey_rsa4096_pub_bin",
86 installable: false,
87}
88
Pierre-Clément Tosi4ef75222022-10-26 17:40:50 +010089genrule {
90 name: "pvmfw_embedded_key_rs",
91 srcs: [":pvmfw_embedded_key"],
92 out: ["lib.rs"],
93 cmd: "(" +
94 " echo '#![no_std]';" +
95 " echo '#![allow(missing_docs)]';" +
96 " echo 'pub const PUBLIC_KEY: &[u8] = &[';" +
97 " xxd -i < $(in);" +
98 " echo '];';" +
99 ") > $(out)",
100}
101
102rust_library_rlib {
103 name: "libpvmfw_embedded_key",
104 defaults: ["vmbase_ffi_defaults"],
105 prefer_rlib: true,
106 srcs: [":pvmfw_embedded_key_rs"],
107 crate_name: "pvmfw_embedded_key",
108 apex_available: ["com.android.virt"],
109}
110
Pierre-Clément Tosi6ec2ae22022-10-26 15:14:45 +0100111prebuilt_etc {
Pierre-Clément Tosib5771c02022-09-06 16:01:35 +0100112 name: "pvmfw_sign_key",
113 src: ":avb_testkey_rsa4096",
114 installable: false,
115}
116
David Brazdilac216b52022-04-25 15:07:22 +0100117bootimg {
118 name: "pvmfw_img",
119 stem: "pvmfw.img",
120 kernel_prebuilt: ":pvmfw_bin",
121 header_version: "3",
122 partition_name: "pvmfw",
123 enabled: false,
124 target: {
125 android_arm64: {
126 enabled: true,
127 },
128 },
Pierre-Clément Tosib5771c02022-09-06 16:01:35 +0100129 use_avb: true,
130 avb_private_key: ":pvmfw_sign_key",
David Brazdilac216b52022-04-25 15:07:22 +0100131}