mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-18 20:36:31 +00:00
使得DragonOS kernel 能为riscv64编译通过(尚未能启动) (#457)
* 使得DragonOS kernel 能为riscv64编译通过(尚未能启动) * 修正了系统调用号声明不正确的问题,同时添加了编译配置文档
This commit is contained in:
@ -2,6 +2,7 @@ use crate::utils::cargo_handler::{CargoHandler, TargetArch};
|
||||
|
||||
use self::x86_64::X86_64BindgenArch;
|
||||
|
||||
pub mod riscv64;
|
||||
pub mod x86_64;
|
||||
|
||||
pub(super) trait BindgenArch {
|
||||
@ -13,6 +14,7 @@ pub(super) fn current_bindgenarch() -> &'static dyn BindgenArch {
|
||||
let arch = CargoHandler::target_arch();
|
||||
match arch {
|
||||
TargetArch::X86_64 => &X86_64BindgenArch,
|
||||
TargetArch::Riscv64 => &riscv64::RiscV64BindgenArch,
|
||||
_ => panic!("Unsupported arch: {:?}", arch),
|
||||
}
|
||||
}
|
||||
|
10
build-scripts/kernel_build/src/bindgen/arch/riscv64.rs
Normal file
10
build-scripts/kernel_build/src/bindgen/arch/riscv64.rs
Normal file
@ -0,0 +1,10 @@
|
||||
use super::BindgenArch;
|
||||
|
||||
pub struct RiscV64BindgenArch;
|
||||
impl BindgenArch for RiscV64BindgenArch {
|
||||
fn generate_bindings(&self, builder: bindgen::Builder) -> bindgen::Builder {
|
||||
builder
|
||||
.clang_arg("-I./src/arch/riscv64/include")
|
||||
.clang_arg("--target=riscv64-none-none-elf")
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user