mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-26 19:03:27 +00:00
Enhance OSDK performance by using hard link instead of copy
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
7601509e6e
commit
9d82ac8958
@ -17,7 +17,7 @@ use crate::{
|
||||
bin::{AsterBin, AsterBinType, AsterBzImageMeta, AsterElfMeta},
|
||||
file::BundleFile,
|
||||
},
|
||||
util::get_current_crate_info,
|
||||
util::{get_current_crate_info, hard_link_or_copy},
|
||||
};
|
||||
|
||||
pub fn make_install_bzimage(
|
||||
@ -115,7 +115,7 @@ pub fn make_elf_for_qemu(install_dir: impl AsRef<Path>, elf: &AsterBin, strip: b
|
||||
}
|
||||
} else {
|
||||
// Copy the ELF file.
|
||||
std::fs::copy(elf.path(), &result_elf_path).unwrap();
|
||||
hard_link_or_copy(elf.path(), &result_elf_path).unwrap();
|
||||
}
|
||||
|
||||
if elf.arch() == Arch::X86_64 {
|
||||
|
@ -16,7 +16,7 @@ use crate::{
|
||||
scheme::{ActionChoice, BootProtocol},
|
||||
Config,
|
||||
},
|
||||
util::get_current_crate_info,
|
||||
util::{get_current_crate_info, hard_link_or_copy},
|
||||
};
|
||||
|
||||
pub fn create_bootdev_image(
|
||||
@ -42,7 +42,7 @@ pub fn create_bootdev_image(
|
||||
|
||||
// Copy the initramfs to the boot directory.
|
||||
if let Some(init_path) = &initramfs_path {
|
||||
fs::copy(
|
||||
hard_link_or_copy(
|
||||
init_path.as_ref().to_str().unwrap(),
|
||||
iso_root.join("boot").join("initramfs.cpio.gz"),
|
||||
)
|
||||
@ -63,7 +63,7 @@ pub fn create_bootdev_image(
|
||||
_ => {
|
||||
// Copy the kernel image to the boot directory.
|
||||
let target_path = iso_root.join("boot").join(&target_name);
|
||||
fs::copy(aster_bin.path(), target_path).unwrap();
|
||||
hard_link_or_copy(aster_bin.path(), target_path).unwrap();
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user