fix: bootloader UEFI alloc panic + pkgar staging fallback

Bootloader: alloc_zeroed_page_aligned no longer panics on OVMF
AllocatePages failure. Returns null on error.

Cookbook: pkgar falls back to repo/ dir when target pkgar missing.
Resolves KDE build chain failure.

redbear-full: builds 4.0GB image+ISO, boots without crash.
This commit is contained in:
2026-05-03 14:23:54 +01:00
parent a4e18e242a
commit 2e4c09a6b6
4 changed files with 27 additions and 1 deletions
@@ -0,0 +1,23 @@
--- a/src/os/uefi/mod.rs 2026-05-03 14:17:35.198125412 +0100
+++ b/src/os/uefi/mod.rs 2026-05-03 14:17:35.205312393 +0100
@@ -53,12 +53,16 @@
pages,
&mut ptr,
))
- .unwrap();
- ptr as *mut u8
+ .unwrap_or_else(|_| {
+ ptr = 0;
+ 0
+ });
+ if ptr == 0 { ptr::null_mut() } else { ptr as *mut u8 }
};
- assert!(!ptr.is_null());
- unsafe { ptr::write_bytes(ptr, 0, pages * page_size) };
+ if !ptr.is_null() {
+ unsafe { ptr::write_bytes(ptr, 0, pages * page_size) };
+ }
ptr
}
+1
View File
@@ -0,0 +1 @@
../../../local/patches/bootloader/fix-uefi-alloc-panic.patch
+1 -1
View File
@@ -1,6 +1,6 @@
[source]
git = "https://gitlab.redox-os.org/redox-os/bootloader.git"
patches = ["redox.patch", "P2-live-preload-guard.patch", "P3-uefi-live-image-safe-read.patch", "P4-live-large-iso-boot.patch", "P5-live-preload-cap-1gib.patch"]
patches = ["redox.patch", "fix-uefi-alloc-panic.patch"]
[build]
template = "custom"
+2
View File
@@ -503,6 +503,7 @@ pub fn build(
.map_err(|e| format!("Unable to move {e:?}"))?;
// Move stage.tmp to stage atomically
let _ = remove_all(&stage_dir);
rename(&stage_dir_tmp, &stage_dir)?;
}
@@ -711,6 +712,7 @@ pub fn build_remote(
)
})?;
// Move stage.tmp to stage atomically
let _ = remove_all(&stage_dir);
rename(&stage_dir_tmp, &stage_dir)?;
}
}