blob: ff7bd83e2dee833c7c61e65ccae52447e7bce204 [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",
Pierre-Clément Tosi1bf532b2023-11-13 11:06:20 +000012 "libcstr",
Alice Wangcb9d2f92023-02-06 10:29:00 +000013 "libdiced_open_dice_nostd",
Andrew Walbran730375d2022-12-21 14:04:34 +000014 "libfdtpci",
David Brazdil1baa9a92022-06-28 14:47:50 +010015 "liblibfdt",
David Brazdilb41aa8f2022-07-05 12:41:00 +010016 "liblog_rust_nostd",
Andrew Walbran8217d062022-11-22 16:56:18 +000017 "libvirtio_drivers",
Andrew Walbraneef98202022-04-27 16:23:06 +000018 "libvmbase",
19 ],
Andrew Walbraneef98202022-04-27 16:23:06 +000020}
21
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +010022genrule {
23 name: "vmbase_image.ld.S.mm",
24 // Soong won't let us use cc_object to preprocess *.ld.S files because it
25 // can't resist feeding any and all *.S files to the assembler, which fails
26 // because linker scripts typically aren't valid assembly. Also, cc_object
27 // rejects inputs that don't end in one of .{s,S,c,cpp,cc,cxx,mm}. So keep
28 // the proper extension (.ld.S) for the file in VCS and use this convoluted
29 // extra step to please Soong by pretending that our linker script is in
30 // fact some Object C++ code, which fortunately it doesn't try to compile.
31 srcs: ["image.ld.S"],
32 out: ["image.ld.S.mm"],
33 cmd: "cp $(in) $(out)",
34 visibility: ["//visibility:private"],
35}
36
37cc_defaults {
38 name: "vmbase_example_ld_defaults",
39 defaults: ["vmbase_cc_defaults"],
40 cflags: [
41 "-E",
42 "-P",
43 "-xassembler-with-cpp", // allow C preprocessor directives
44 ],
45 srcs: [":vmbase_image.ld.S.mm"],
46 visibility: ["//visibility:private"],
47}
48
49cc_object {
50 name: "vmbase_example_bios.ld",
51 defaults: ["vmbase_example_ld_defaults"],
52 cflags: ["-DVMBASE_EXAMPLE_IS_BIOS"],
53}
54
Pierre-Clément Tosi48ac6a92024-08-14 00:42:05 +010055cc_object {
56 name: "vmbase_example_kernel.ld",
57 defaults: ["vmbase_example_ld_defaults"],
58 cflags: ["-DVMBASE_EXAMPLE_IS_KERNEL"],
59}
60
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +010061cc_defaults {
62 name: "vmbase_example_elf_defaults",
David Brazdil30a7f082022-07-07 15:30:14 +010063 defaults: ["vmbase_elf_defaults"],
Andrew Walbraneef98202022-04-27 16:23:06 +000064 srcs: [
65 "idmap.S",
66 ],
67 static_libs: [
Andrew Walbraneef98202022-04-27 16:23:06 +000068 "libvmbase_example",
69 ],
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +010070}
71
72cc_binary {
73 name: "vmbase_example_bios",
74 defaults: ["vmbase_example_elf_defaults"],
75 asflags: ["-DVMBASE_EXAMPLE_IS_BIOS"],
Andrew Walbrana5b7af52022-07-06 15:06:20 +000076 linker_scripts: [
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +010077 ":vmbase_example_bios.ld",
Andrew Walbrana5b7af52022-07-06 15:06:20 +000078 ":vmbase_sections",
79 ],
Andrew Walbraneef98202022-04-27 16:23:06 +000080}
81
Pierre-Clément Tosi48ac6a92024-08-14 00:42:05 +010082cc_binary {
83 name: "vmbase_example_kernel",
84 defaults: ["vmbase_example_elf_defaults"],
85 asflags: ["-DVMBASE_EXAMPLE_IS_KERNEL"],
86 linker_scripts: [
87 ":vmbase_example_kernel.ld",
88 ":vmbase_sections",
89 ],
90}
91
Andrew Walbraneef98202022-04-27 16:23:06 +000092raw_binary {
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +010093 name: "vmbase_example_bios_bin",
94 stem: "vmbase_example_bios.bin",
95 src: ":vmbase_example_bios",
Andrew Walbraneef98202022-04-27 16:23:06 +000096 enabled: false,
97 target: {
98 android_arm64: {
99 enabled: true,
100 },
101 },
102}
Pierre-Clément Tosi48ac6a92024-08-14 00:42:05 +0100103
104raw_binary {
105 name: "vmbase_example_kernel_bin",
106 stem: "vmbase_example_kernel.bin",
107 src: ":vmbase_example_kernel",
108 enabled: false,
109 target: {
110 android_arm64: {
111 enabled: true,
112 },
113 },
114}