代码拉取完成,页面将自动刷新
// Copyright (c) 2023 Beihang University, Huawei Technologies Co.,Ltd. All rights reserved.
// Rust-Shyper is licensed under Mulan PSL v2.
// You can use this software according to the terms and conditions of the Mulan PSL v2.
// You may obtain a copy of Mulan PSL v2 at:
// http://license.coscl.org.cn/MulanPSL2
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
// EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
// MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
// See the Mulan PSL v2 for more details.
use std::env::var;
use std::process::Command;
// get text_start by arch and platform
fn get_text_start() -> u64 {
let target_arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
if target_arch == "aarch64" {
if cfg!(feature = "tx2") {
0x83000000_u64
} else if cfg!(feature = "pi4") {
0xf0080000_u64
} else if cfg!(feature = "qemu") {
0x40080000_u64
} else if cfg!(feature = "rk3588") {
0x00400000_u64
} else {
panic!("Unsupported platform!");
}
} else if target_arch == "riscv64" {
0x80200000_u64
} else {
panic!("Unsupported arch {}!", target_arch);
}
}
fn main() {
let arch = var("CARGO_CFG_TARGET_ARCH").unwrap();
let text_start = get_text_start();
println!("cargo:rustc-link-arg=-Tlinkers/{arch}.ld");
println!("cargo:rustc-link-arg=--defsym=TEXT_START={text_start}");
let commit_hash = Command::new("git").args(["rev-parse", "HEAD"]).output().unwrap();
let commit_hash = String::from_utf8(commit_hash.stdout).unwrap();
println!("cargo:rustc-env=GIT_COMMIT={}", commit_hash.trim());
// note: add error checking yourself.
let build_time = chrono::offset::Local::now().format("%Y-%m-%d %H:%M:%S %Z");
println!("cargo:rustc-env=BUILD_TIME={}", build_time);
let hostname = gethostname::gethostname();
println!("cargo:rustc-env=HOSTNAME={}", hostname.into_string().unwrap());
built::write_built_file().expect("Failed to acquire build-time information");
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。