blob: 86a63b7c4464b13564304f8653c4877cb88990fa [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
55cc_defaults {
56 name: "vmbase_example_elf_defaults",
David Brazdil30a7f082022-07-07 15:30:14 +010057 defaults: ["vmbase_elf_defaults"],
Andrew Walbraneef98202022-04-27 16:23:06 +000058 srcs: [
59 "idmap.S",
60 ],
61 static_libs: [
Andrew Walbraneef98202022-04-27 16:23:06 +000062 "libvmbase_example",
63 ],
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +010064}
65
66cc_binary {
67 name: "vmbase_example_bios",
68 defaults: ["vmbase_example_elf_defaults"],
69 asflags: ["-DVMBASE_EXAMPLE_IS_BIOS"],
Andrew Walbrana5b7af52022-07-06 15:06:20 +000070 linker_scripts: [
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +010071 ":vmbase_example_bios.ld",
Andrew Walbrana5b7af52022-07-06 15:06:20 +000072 ":vmbase_sections",
73 ],
Andrew Walbraneef98202022-04-27 16:23:06 +000074}
75
76raw_binary {
Pierre-Clément Tosie0d68402024-08-14 00:27:47 +010077 name: "vmbase_example_bios_bin",
78 stem: "vmbase_example_bios.bin",
79 src: ":vmbase_example_bios",
Andrew Walbraneef98202022-04-27 16:23:06 +000080 enabled: false,
81 target: {
82 android_arm64: {
83 enabled: true,
84 },
85 },
86}