blob: ab21191a62355c545c9afaf5e4f385b59c54f846 [file] [log] [blame]
Andrew Walbraneef98202022-04-27 16:23:06 +00001package {
2 default_applicable_licenses: ["Android-Apache-2.0"],
3}
4
5rust_ffi_static {
6 name: "libvmbase_example",
David Brazdil30a7f082022-07-07 15:30:14 +01007 defaults: ["vmbase_ffi_defaults"],
Andrew Walbraneef98202022-04-27 16:23:06 +00008 crate_name: "vmbase_example",
9 srcs: ["src/main.rs"],
Andrew Walbraneef98202022-04-27 16:23:06 +000010 rustlibs: [
Andrew Walbran13564542022-04-20 16:29:45 +000011 "libaarch64_paging",
Alice Wangcb9d2f92023-02-06 10:29:00 +000012 "libdiced_open_dice_nostd",
Pierre-Clément Tosi992c2bb2024-10-02 10:37:42 +010013 "liblibfdt_nostd",
David Brazdilb41aa8f2022-07-05 12:41:00 +010014 "liblog_rust_nostd",
Andrew Walbran8217d062022-11-22 16:56:18 +000015 "libvirtio_drivers",
Andrew Walbraneef98202022-04-27 16:23:06 +000016 "libvmbase",
17 ],
Andrew Walbraneef98202022-04-27 16:23:06 +000018}
19
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +010020genrule {
21 name: "vmbase_image.ld.S.mm",
22 // Soong won't let us use cc_object to preprocess *.ld.S files because it
23 // can't resist feeding any and all *.S files to the assembler, which fails
24 // because linker scripts typically aren't valid assembly. Also, cc_object
25 // rejects inputs that don't end in one of .{s,S,c,cpp,cc,cxx,mm}. So keep
26 // the proper extension (.ld.S) for the file in VCS and use this convoluted
27 // extra step to please Soong by pretending that our linker script is in
28 // fact some Object C++ code, which fortunately it doesn't try to compile.
29 srcs: ["image.ld.S"],
30 out: ["image.ld.S.mm"],
31 cmd: "cp $(in) $(out)",
32 visibility: ["//visibility:private"],
33}
34
35cc_defaults {
36 name: "vmbase_example_ld_defaults",
37 defaults: ["vmbase_cc_defaults"],
38 cflags: [
39 "-E",
40 "-P",
41 "-xassembler-with-cpp", // allow C preprocessor directives
42 ],
43 srcs: [":vmbase_image.ld.S.mm"],
44 visibility: ["//visibility:private"],
45}
46
47cc_object {
48 name: "vmbase_example_bios.ld",
49 defaults: ["vmbase_example_ld_defaults"],
50 cflags: ["-DVMBASE_EXAMPLE_IS_BIOS"],
51}
52
Pierre-Clément Tosi48ac6a92024-08-14 00:42:05 +010053cc_object {
54 name: "vmbase_example_kernel.ld",
55 defaults: ["vmbase_example_ld_defaults"],
56 cflags: ["-DVMBASE_EXAMPLE_IS_KERNEL"],
57}
58
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +010059cc_defaults {
60 name: "vmbase_example_elf_defaults",
David Brazdil30a7f082022-07-07 15:30:14 +010061 defaults: ["vmbase_elf_defaults"],
Andrew Walbraneef98202022-04-27 16:23:06 +000062 srcs: [
63 "idmap.S",
64 ],
65 static_libs: [
Andrew Walbraneef98202022-04-27 16:23:06 +000066 "libvmbase_example",
67 ],
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +010068}
69
70cc_binary {
71 name: "vmbase_example_bios",
72 defaults: ["vmbase_example_elf_defaults"],
73 asflags: ["-DVMBASE_EXAMPLE_IS_BIOS"],
Andrew Walbrana5b7af52022-07-06 15:06:20 +000074 linker_scripts: [
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +010075 ":vmbase_example_bios.ld",
Andrew Walbrana5b7af52022-07-06 15:06:20 +000076 ":vmbase_sections",
77 ],
Andrew Walbraneef98202022-04-27 16:23:06 +000078}
79
Pierre-Clément Tosi48ac6a92024-08-14 00:42:05 +010080cc_binary {
81 name: "vmbase_example_kernel",
82 defaults: ["vmbase_example_elf_defaults"],
83 asflags: ["-DVMBASE_EXAMPLE_IS_KERNEL"],
84 linker_scripts: [
85 ":vmbase_example_kernel.ld",
86 ":vmbase_sections",
87 ],
88}
89
Andrew Walbraneef98202022-04-27 16:23:06 +000090raw_binary {
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +010091 name: "vmbase_example_bios_bin",
92 stem: "vmbase_example_bios.bin",
93 src: ":vmbase_example_bios",
Andrew Walbraneef98202022-04-27 16:23:06 +000094 enabled: false,
95 target: {
96 android_arm64: {
97 enabled: true,
98 },
99 },
100}
Pierre-Clément Tosi48ac6a92024-08-14 00:42:05 +0100101
102raw_binary {
103 name: "vmbase_example_kernel_bin",
104 stem: "vmbase_example_kernel.bin",
105 src: ":vmbase_example_kernel",
106 enabled: false,
107 target: {
108 android_arm64: {
109 enabled: true,
110 },
111 },
112}