1rust_binary {
2    name: "trusty_security_vm_launcher",
3    crate_name: "trusty_security_vm_launcher",
4    srcs: ["src/main.rs"],
5    edition: "2021",
6    prefer_rlib: true,
7    rustlibs: [
8        "android.system.virtualizationservice-rust",
9        "libanyhow",
10        "libclap",
11        "libvmclient",
12    ],
13    bootstrap: true,
14    apex_available: ["//apex_available:platform"],
15    system_ext_specific: true,
16    enabled: select(release_flag("RELEASE_AVF_ENABLE_EARLY_VM"), {
17        true: true,
18        false: false,
19    }),
20}
21
22prebuilt_etc {
23    name: "lk_trusty.elf",
24    system_ext_specific: true,
25    relative_install_path: "vm/trusty_vm",
26    filename: "lk_trusty.elf",
27    arch: {
28        x86_64: {
29            src: ":trusty_security_vm_signed",
30        },
31        arm64: {
32            src: ":trusty_security_vm_signed",
33        },
34    },
35    src: ":empty_file",
36}
37
38filegroup {
39    name: "trusty_vm_sign_key",
40    srcs: [":avb_testkey_rsa4096"],
41}
42
43// python -c "import hashlib; print(hashlib.sha256(b'trusty_security_vm_salt').hexdigest())"
44trusty_security_vm_salt = "75a71e967c1a1e0f805cca20465e7acf83e6a04e567a67c426d8b5a94f8d61c5"
45
46TRUSTY_SECURITY_VM_VERSION = 1
47
48avb_add_hash_footer {
49    name: "trusty_security_vm_signed",
50    filename: "trusty_security_vm_signed",
51    partition_name: "boot",
52    private_key: ":trusty_vm_sign_key",
53    salt: trusty_security_vm_salt,
54    rollback_index: TRUSTY_SECURITY_VM_VERSION,
55    props: [
56        {
57            name: "com.android.virt.cap",
58            value: "trusty_security_vm",
59        },
60    ],
61    src: ":empty_file",
62    enabled: false,
63    arch: {
64        x86_64: {
65            src: ":trusty-lk.elf",
66            enabled: true,
67        },
68        arm64: {
69            src: ":trusty-test-lk.elf",
70            enabled: true,
71        },
72    },
73}
74