kernel: precise trigger timing of post-fs-data (#118)

* kernel: add report_event cmd

* ksud: report event

* kernel: trigger on_post_fs_data

* ksud: comment unused code

* [skip ci] run clang-format

Signed-off-by: Ylarod <me@ylarod.cn>

* ci: use custom key to sign official bootimgs

* format ksud

* reject non root

* remove

Signed-off-by: Ylarod <me@ylarod.cn>
This commit is contained in:
Ylarod
2023-01-26 11:29:02 +08:00
committed by GitHub
parent 22b66b6672
commit db600d5ea0
19 changed files with 170 additions and 37 deletions

View File

@@ -109,7 +109,11 @@ fn check_image(img: &str) -> Result<()> {
// 0: no error
// 1: file system errors corrected
// https://man7.org/linux/man-pages/man8/e2fsck.8.html
ensure!(code == Some(0) || code == Some(1), "check image e2fsck exec failed: {}", code.unwrap_or(-1));
ensure!(
code == Some(0) || code == Some(1),
"check image e2fsck exec failed: {}",
code.unwrap_or(-1)
);
Ok(())
}
@@ -120,7 +124,10 @@ fn grow_image_size(img: &str, extra_size: u64) -> Result<()> {
// check image
check_image(img)?;
println!("- Target image size: {}", humansize::format_size(target_size, humansize::DECIMAL));
println!(
"- Target image size: {}",
humansize::format_size(target_size, humansize::DECIMAL)
);
let target_size = target_size / 1024 + 1;
let result = Exec::shell(format!("resize2fs {} {}K", img, target_size))
@@ -331,7 +338,10 @@ pub fn install_module(zip: String) -> Result<()> {
let grow_size_per_m = grow_size / 1024 / 1024 + 1;
println!("- Preparing image");
println!("- Module size: {}", humansize::format_size(zip_uncompressed_size, humansize::DECIMAL));
println!(
"- Module size: {}",
humansize::format_size(zip_uncompressed_size, humansize::DECIMAL)
);
if !modules_img_exist && !modules_update_img_exist {
// if no modules and modules_update, it is brand new installation, we should create a new img