blob: ed3ef8db53111ef33beb7755017906c57594dffb [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",
Pierre-Clément Tosi8edf72e2022-12-06 16:02:57 +000017 "libdice_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",
Pierre-Clément Tosi4ef75222022-10-26 17:40:50 +010021 "libpvmfw_embedded_key",
Pierre-Clément Tosi328dfb62022-11-25 18:20:42 +000022 "libtinyvec_nostd",
Andrew Walbrand1d03182022-12-09 18:20:01 +000023 "libvirtio_drivers",
Andrew Walbrandd74b902022-04-14 16:12:50 +000024 "libvmbase",
Pierre-Clément Tosi8383c542022-11-01 14:07:29 +000025 "libzeroize_nostd",
Andrew Walbranf2594882022-03-15 17:32:53 +000026 ],
Andrew Walbran68a8c162022-03-07 15:38:42 +000027}
Andrew Walbran15068b02022-03-22 15:57:34 +000028
29cc_binary {
Pierre-Clément Tosib1300352022-09-09 11:01:06 +010030 name: "pvmfw",
David Brazdil30a7f082022-07-07 15:30:14 +010031 defaults: ["vmbase_elf_defaults"],
Andrew Walbran15068b02022-03-22 15:57:34 +000032 srcs: [
Andrew Walbran267f6c12022-03-24 11:26:36 +000033 "idmap.S",
Andrew Walbran15068b02022-03-22 15:57:34 +000034 ],
35 static_libs: [
36 "libpvmfw",
37 ],
Andrew Walbrana5b7af52022-07-06 15:06:20 +000038 linker_scripts: [
39 "image.ld",
40 ":vmbase_sections",
41 ],
Jiyong Park17b8d752022-12-16 14:36:24 +090042 // `installable: false` is inherited from vmbase_elf_defaults, and that
43 // hides this module from Make, which makes it impossible for the Make world
44 // to place the unstripped binary to the symbols directory. Marking back as
45 // installable exposes this module to the Make world again. Note that this
46 // module (pvmfw) still is NOT installed to any of the filesystem images. It
47 // is fed into pvmfw_bin and then into pvmfw_img to become a standalone
48 // partition image. This is just to package the unstripped file into the
49 // symbols zip file for debugging purpose.
50 installable: true,
Andrew Walbran15068b02022-03-22 15:57:34 +000051}
David Brazdil05d4e072022-04-25 14:47:06 +010052
53raw_binary {
Pierre-Clément Tosib1300352022-09-09 11:01:06 +010054 name: "pvmfw_bin",
55 stem: "pvmfw.bin",
56 src: ":pvmfw",
David Brazdil05d4e072022-04-25 14:47:06 +010057 enabled: false,
58 target: {
59 android_arm64: {
60 enabled: true,
61 },
62 },
63}
David Brazdilac216b52022-04-25 15:07:22 +010064
Pierre-Clément Tosib5771c02022-09-06 16:01:35 +010065prebuilt_etc {
Pierre-Clément Tosi6ec2ae22022-10-26 15:14:45 +010066 name: "pvmfw_embedded_key",
67 src: ":avb_testkey_rsa4096_pub_bin",
68 installable: false,
69}
70
Pierre-Clément Tosi4ef75222022-10-26 17:40:50 +010071genrule {
72 name: "pvmfw_embedded_key_rs",
73 srcs: [":pvmfw_embedded_key"],
74 out: ["lib.rs"],
75 cmd: "(" +
76 " echo '#![no_std]';" +
77 " echo '#![allow(missing_docs)]';" +
78 " echo 'pub const PUBLIC_KEY: &[u8] = &[';" +
79 " xxd -i < $(in);" +
80 " echo '];';" +
81 ") > $(out)",
82}
83
84rust_library_rlib {
85 name: "libpvmfw_embedded_key",
86 defaults: ["vmbase_ffi_defaults"],
87 prefer_rlib: true,
88 srcs: [":pvmfw_embedded_key_rs"],
89 crate_name: "pvmfw_embedded_key",
90 apex_available: ["com.android.virt"],
91}
92
Pierre-Clément Tosi6ec2ae22022-10-26 15:14:45 +010093prebuilt_etc {
Pierre-Clément Tosib5771c02022-09-06 16:01:35 +010094 name: "pvmfw_sign_key",
95 src: ":avb_testkey_rsa4096",
96 installable: false,
97}
98
David Brazdilac216b52022-04-25 15:07:22 +010099bootimg {
100 name: "pvmfw_img",
101 stem: "pvmfw.img",
102 kernel_prebuilt: ":pvmfw_bin",
103 header_version: "3",
104 partition_name: "pvmfw",
105 enabled: false,
106 target: {
107 android_arm64: {
108 enabled: true,
109 },
110 },
Pierre-Clément Tosib5771c02022-09-06 16:01:35 +0100111 use_avb: true,
112 avb_private_key: ":pvmfw_sign_key",
David Brazdilac216b52022-04-25 15:07:22 +0100113}