blob: e5dfc2a4968bb2b85d042808c6138d286443ad12 [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
43 ],
44 srcs: [":vmbase_image.ld.S.mm"],
45 visibility: ["//visibility:private"],
46}
47
48cc_object {
49 name: "vmbase_example_bios.ld",
50 defaults: ["vmbase_example_ld_defaults"],
51 cflags: ["-DVMBASE_EXAMPLE_IS_BIOS"],
52}
53
Pierre-Clément Tosi48ac6a92024-08-14 00:42:05 +010054cc_object {
55 name: "vmbase_example_kernel.ld",
56 defaults: ["vmbase_example_ld_defaults"],
57 cflags: ["-DVMBASE_EXAMPLE_IS_KERNEL"],
58}
59
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +010060cc_defaults {
61 name: "vmbase_example_elf_defaults",
David Brazdil30a7f082022-07-07 15:30:14 +010062 defaults: ["vmbase_elf_defaults"],
Andrew Walbraneef98202022-04-27 16:23:06 +000063 srcs: [
64 "idmap.S",
65 ],
66 static_libs: [
Andrew Walbraneef98202022-04-27 16:23:06 +000067 "libvmbase_example",
68 ],
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +010069}
70
71cc_binary {
72 name: "vmbase_example_bios",
73 defaults: ["vmbase_example_elf_defaults"],
74 asflags: ["-DVMBASE_EXAMPLE_IS_BIOS"],
Andrew Walbrana5b7af52022-07-06 15:06:20 +000075 linker_scripts: [
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +010076 ":vmbase_example_bios.ld",
Andrew Walbrana5b7af52022-07-06 15:06:20 +000077 ":vmbase_sections",
78 ],
Andrew Walbraneef98202022-04-27 16:23:06 +000079}
80
Pierre-Clément Tosi48ac6a92024-08-14 00:42:05 +010081cc_binary {
82 name: "vmbase_example_kernel",
83 defaults: ["vmbase_example_elf_defaults"],
84 asflags: ["-DVMBASE_EXAMPLE_IS_KERNEL"],
85 linker_scripts: [
86 ":vmbase_example_kernel.ld",
87 ":vmbase_sections",
88 ],
89}
90
Andrew Walbraneef98202022-04-27 16:23:06 +000091raw_binary {
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +010092 name: "vmbase_example_bios_bin",
93 stem: "vmbase_example_bios.bin",
94 src: ":vmbase_example_bios",
Andrew Walbraneef98202022-04-27 16:23:06 +000095 enabled: false,
96 target: {
97 android_arm64: {
98 enabled: true,
99 },
100 },
101}
Pierre-Clément Tosi48ac6a92024-08-14 00:42:05 +0100102
103raw_binary {
104 name: "vmbase_example_kernel_bin",
105 stem: "vmbase_example_kernel.bin",
106 src: ":vmbase_example_kernel",
107 enabled: false,
108 target: {
109 android_arm64: {
110 enabled: true,
111 },
112 },
113}