blob: 1cee84841bd8aa8652284c133c1bbf24e1763a75 [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: [
Alice Wangcb9d2f92023-02-06 10:29:00 +000011 "libdiced_open_dice_nostd",
Pierre-Clément Tosi992c2bb2024-10-02 10:37:42 +010012 "liblibfdt_nostd",
David Brazdilb41aa8f2022-07-05 12:41:00 +010013 "liblog_rust_nostd",
Andrew Walbranfb49a412025-01-15 12:14:24 +000014 "libspin_nostd",
Andrew Walbran8217d062022-11-22 16:56:18 +000015 "libvirtio_drivers",
Andrew Walbraneef98202022-04-27 16:23:06 +000016 "libvmbase",
17 ],
Michał Mazurekdba27002024-12-02 16:05:30 +010018 target: {
19 android_arm64: {
20 rustlibs: [
21 "libaarch64_paging",
22 ],
23 },
24 },
Andrew Walbraneef98202022-04-27 16:23:06 +000025}
26
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +010027genrule {
28 name: "vmbase_image.ld.S.mm",
29 // Soong won't let us use cc_object to preprocess *.ld.S files because it
30 // can't resist feeding any and all *.S files to the assembler, which fails
31 // because linker scripts typically aren't valid assembly. Also, cc_object
32 // rejects inputs that don't end in one of .{s,S,c,cpp,cc,cxx,mm}. So keep
33 // the proper extension (.ld.S) for the file in VCS and use this convoluted
34 // extra step to please Soong by pretending that our linker script is in
35 // fact some Object C++ code, which fortunately it doesn't try to compile.
36 srcs: ["image.ld.S"],
37 out: ["image.ld.S.mm"],
38 cmd: "cp $(in) $(out)",
39 visibility: ["//visibility:private"],
40}
41
42cc_defaults {
43 name: "vmbase_example_ld_defaults",
44 defaults: ["vmbase_cc_defaults"],
45 cflags: [
46 "-E",
47 "-P",
48 "-xassembler-with-cpp", // allow C preprocessor directives
Ryan Prichardba8850a2025-01-22 17:56:17 -080049 // Soong passes an implicit -c before -E. Suppress the warning about -c
50 // being unused.
51 "-Wno-unused-command-line-argument",
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +010052 ],
53 srcs: [":vmbase_image.ld.S.mm"],
54 visibility: ["//visibility:private"],
55}
56
57cc_object {
58 name: "vmbase_example_bios.ld",
59 defaults: ["vmbase_example_ld_defaults"],
60 cflags: ["-DVMBASE_EXAMPLE_IS_BIOS"],
61}
62
Pierre-Clément Tosi48ac6a92024-08-14 00:42:05 +010063cc_object {
64 name: "vmbase_example_kernel.ld",
65 defaults: ["vmbase_example_ld_defaults"],
66 cflags: ["-DVMBASE_EXAMPLE_IS_KERNEL"],
67}
68
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +010069cc_defaults {
70 name: "vmbase_example_elf_defaults",
David Brazdil30a7f082022-07-07 15:30:14 +010071 defaults: ["vmbase_elf_defaults"],
Andrew Walbraneef98202022-04-27 16:23:06 +000072 srcs: [
73 "idmap.S",
74 ],
75 static_libs: [
Andrew Walbraneef98202022-04-27 16:23:06 +000076 "libvmbase_example",
77 ],
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +010078}
79
80cc_binary {
81 name: "vmbase_example_bios",
82 defaults: ["vmbase_example_elf_defaults"],
83 asflags: ["-DVMBASE_EXAMPLE_IS_BIOS"],
Andrew Walbrana5b7af52022-07-06 15:06:20 +000084 linker_scripts: [
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +010085 ":vmbase_example_bios.ld",
Andrew Walbrana5b7af52022-07-06 15:06:20 +000086 ":vmbase_sections",
87 ],
Andrew Walbraneef98202022-04-27 16:23:06 +000088}
89
Pierre-Clément Tosi48ac6a92024-08-14 00:42:05 +010090cc_binary {
91 name: "vmbase_example_kernel",
92 defaults: ["vmbase_example_elf_defaults"],
93 asflags: ["-DVMBASE_EXAMPLE_IS_KERNEL"],
94 linker_scripts: [
95 ":vmbase_example_kernel.ld",
96 ":vmbase_sections",
97 ],
98}
99
Andrew Walbraneef98202022-04-27 16:23:06 +0000100raw_binary {
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +0100101 name: "vmbase_example_bios_bin",
102 stem: "vmbase_example_bios.bin",
103 src: ":vmbase_example_bios",
Andrew Walbraneef98202022-04-27 16:23:06 +0000104 enabled: false,
105 target: {
106 android_arm64: {
107 enabled: true,
108 },
109 },
110}
Pierre-Clément Tosi48ac6a92024-08-14 00:42:05 +0100111
112raw_binary {
113 name: "vmbase_example_kernel_bin",
114 stem: "vmbase_example_kernel.bin",
115 src: ":vmbase_example_kernel",
116 enabled: false,
117 target: {
118 android_arm64: {
119 enabled: true,
120 },
121 },
122}