build.rs 869 B

1234567891011121314151617181920212223242526272829
  1. use cc::Build;
  2. use std::env;
  3. fn main() {
  4. env::set_var("CROSS_COMPILE", "aarch64-linux-gnu");
  5. let platform = env::var("CARGO_CFG_PLATFORM").expect("Missing platform name");
  6. match platform.as_ref() {
  7. "qemu" => {
  8. Build::new()
  9. .file("entry.S")
  10. .file("exceptions.S")
  11. .file("idmap.S")
  12. .compile("empty");
  13. println!("cargo:rustc-link-arg=-Tqemu.ld");
  14. }
  15. "crosvm" => {
  16. Build::new()
  17. .file("entry.S")
  18. .file("exceptions.S")
  19. .file("idmap_crosvm.S")
  20. .compile("empty");
  21. println!("cargo:rustc-link-arg=-Tcrosvm.ld");
  22. }
  23. _ => {
  24. panic!("Unexpected platform name \"{}\"", platform);
  25. }
  26. }
  27. println!("cargo:rustc-link-arg=-Timage.ld");
  28. }