Updated to search for kernel and init in the right place(s)
This commit is contained in:
parent
235627da93
commit
5a3bf75c36
@ -37,27 +37,23 @@ fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn find_init() -> Option<PathBuf> {
|
fn find_init() -> Option<PathBuf> {
|
||||||
match find_kernel_base() {
|
|
||||||
Some(buf) => Some(buf.join("init/init")),
|
|
||||||
None => None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fn find_kernel() -> Option<PathBuf> {
|
|
||||||
match find_kernel_base() {
|
|
||||||
Some(buf) => Some(buf.join("build/linux-4.9.56/vmlinux")),
|
|
||||||
None => None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn find_kernel_base() -> Option<PathBuf> {
|
|
||||||
let mut cwd = env::current_dir().unwrap();
|
let mut cwd = env::current_dir().unwrap();
|
||||||
if try_kernel_base(&cwd) {
|
if cwd.join("rust/target/release/ph-init").exists() {
|
||||||
cwd.push("kernel");
|
cwd.push("rust/target/release/ph-init");
|
||||||
return Some(cwd);
|
return Some(cwd)
|
||||||
|
}
|
||||||
|
if cwd.join("rust/target/debug/ph-init").exists() {
|
||||||
|
cwd.push("rust/target/debug/ph-init");
|
||||||
|
return Some(cwd)
|
||||||
}
|
}
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn try_kernel_base(path: &Path) -> bool {
|
fn find_kernel() -> Option<PathBuf> {
|
||||||
path.join("kernel/build/linux-4.9.56/vmlinux").exists()
|
let mut cwd = env::current_dir().unwrap();
|
||||||
|
if cwd.join("kernel/ph_linux").exists() {
|
||||||
|
cwd.push("kernel/ph_linux");
|
||||||
|
return Some(cwd)
|
||||||
|
}
|
||||||
|
None
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user