blob: 30d72bdd417115aa138f58fe6216542ef709e957 [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 Walbranfb49a412025-01-15 12:14:24 +000015 "libspin_nostd",
Andrew Walbran8217d062022-11-22 16:56:18 +000016 "libvirtio_drivers",
Andrew Walbraneef98202022-04-27 16:23:06 +000017 "libvmbase",
18 ],
Andrew Walbraneef98202022-04-27 16:23:06 +000019}
20
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +010021genrule {
22 name: "vmbase_image.ld.S.mm",
23 // Soong won't let us use cc_object to preprocess *.ld.S files because it
24 // can't resist feeding any and all *.S files to the assembler, which fails
25 // because linker scripts typically aren't valid assembly. Also, cc_object
26 // rejects inputs that don't end in one of .{s,S,c,cpp,cc,cxx,mm}. So keep
27 // the proper extension (.ld.S) for the file in VCS and use this convoluted
28 // extra step to please Soong by pretending that our linker script is in
29 // fact some Object C++ code, which fortunately it doesn't try to compile.
30 srcs: ["image.ld.S"],
31 out: ["image.ld.S.mm"],
32 cmd: "cp $(in) $(out)",
33 visibility: ["//visibility:private"],
34}
35
36cc_defaults {
37 name: "vmbase_example_ld_defaults",
38 defaults: ["vmbase_cc_defaults"],
39 cflags: [
40 "-E",
41 "-P",
42 "-xassembler-with-cpp", // allow C preprocessor directives
Ryan Prichardba8850a2025-01-22 17:56:17 -080043 // Soong passes an implicit -c before -E. Suppress the warning about -c
44 // being unused.
45 "-Wno-unused-command-line-argument",
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +010046 ],
47 srcs: [":vmbase_image.ld.S.mm"],
48 visibility: ["//visibility:private"],
49}
50
51cc_object {
52 name: "vmbase_example_bios.ld",
53 defaults: ["vmbase_example_ld_defaults"],
54 cflags: ["-DVMBASE_EXAMPLE_IS_BIOS"],
55}
56
Pierre-Clément Tosi48ac6a92024-08-14 00:42:05 +010057cc_object {
58 name: "vmbase_example_kernel.ld",
59 defaults: ["vmbase_example_ld_defaults"],
60 cflags: ["-DVMBASE_EXAMPLE_IS_KERNEL"],
61}
62
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +010063cc_defaults {
64 name: "vmbase_example_elf_defaults",
David Brazdil30a7f082022-07-07 15:30:14 +010065 defaults: ["vmbase_elf_defaults"],
Andrew Walbraneef98202022-04-27 16:23:06 +000066 srcs: [
67 "idmap.S",
68 ],
69 static_libs: [
Andrew Walbraneef98202022-04-27 16:23:06 +000070 "libvmbase_example",
71 ],
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +010072}
73
74cc_binary {
75 name: "vmbase_example_bios",
76 defaults: ["vmbase_example_elf_defaults"],
77 asflags: ["-DVMBASE_EXAMPLE_IS_BIOS"],
Andrew Walbrana5b7af52022-07-06 15:06:20 +000078 linker_scripts: [
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +010079 ":vmbase_example_bios.ld",
Andrew Walbrana5b7af52022-07-06 15:06:20 +000080 ":vmbase_sections",
81 ],
Andrew Walbraneef98202022-04-27 16:23:06 +000082}
83
Pierre-Clément Tosi48ac6a92024-08-14 00:42:05 +010084cc_binary {
85 name: "vmbase_example_kernel",
86 defaults: ["vmbase_example_elf_defaults"],
87 asflags: ["-DVMBASE_EXAMPLE_IS_KERNEL"],
88 linker_scripts: [
89 ":vmbase_example_kernel.ld",
90 ":vmbase_sections",
91 ],
92}
93
Andrew Walbraneef98202022-04-27 16:23:06 +000094raw_binary {
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +010095 name: "vmbase_example_bios_bin",
96 stem: "vmbase_example_bios.bin",
97 src: ":vmbase_example_bios",
Andrew Walbraneef98202022-04-27 16:23:06 +000098 enabled: false,
99 target: {
100 android_arm64: {
101 enabled: true,
102 },
103 },
104}
Pierre-Clément Tosi48ac6a92024-08-14 00:42:05 +0100105
106raw_binary {
107 name: "vmbase_example_kernel_bin",
108 stem: "vmbase_example_kernel.bin",
109 src: ":vmbase_example_kernel",
110 enabled: false,
111 target: {
112 android_arm64: {
113 enabled: true,
114 },
115 },
116}