stub: rename sections for UKI compatibility

systemd 255 is stricter in what it considers UKIs. It demands .linux
and .initrd sections. Rename our sections that contain the respective
filenames to match these names.
This commit is contained in:
Julian Stecklina 2024-02-10 20:53:15 +01:00
parent 14afe7ce9b
commit 5de0b3e54a
3 changed files with 8 additions and 8 deletions

View File

@ -47,10 +47,10 @@ pub fn lanzaboote_image(
let sections = vec![
s(".osrel", os_release, os_release_offs),
s(".cmdline", kernel_cmdline_file, kernel_cmdline_offs),
s(".initrdp", initrd_path_file, initrd_path_offs),
s(".kernelp", kernel_path_file, kernel_path_offs),
s(".initrd", initrd_path_file, initrd_path_offs),
s(".linux", kernel_path_file, kernel_path_offs),
s(".initrdh", initrd_hash_file, initrd_hash_offs),
s(".kernelh", kernel_hash_file, kernel_hash_offs),
s(".linuxh", kernel_hash_file, kernel_hash_offs),
];
let image_path = tempdir.path().join(tmpname());

View File

@ -271,11 +271,11 @@ impl Installer {
let stub = fs::read(&stub_target)?;
let kernel_path = resolve_efi_path(
&self.esp_paths.esp,
pe::read_section_data(&stub, ".kernelp").context("Missing kernel path.")?,
pe::read_section_data(&stub, ".linux").context("Missing kernel path.")?,
)?;
let initrd_path = resolve_efi_path(
&self.esp_paths.esp,
pe::read_section_data(&stub, ".initrdp").context("Missing initrd path.")?,
pe::read_section_data(&stub, ".initrd").context("Missing initrd path.")?,
)?;
if !kernel_path.exists() && !initrd_path.exists() {

View File

@ -46,10 +46,10 @@ fn extract_hash(pe_data: &[u8], section: &str) -> Result<Hash> {
impl EmbeddedConfiguration {
fn new(file_data: &[u8]) -> Result<Self> {
Ok(Self {
kernel_filename: extract_string(file_data, ".kernelp")?,
kernel_hash: extract_hash(file_data, ".kernelh")?,
kernel_filename: extract_string(file_data, ".linux")?,
kernel_hash: extract_hash(file_data, ".linuxh")?,
initrd_filename: extract_string(file_data, ".initrdp")?,
initrd_filename: extract_string(file_data, ".initrd")?,
initrd_hash: extract_hash(file_data, ".initrdh")?,
cmdline: extract_string(file_data, ".cmdline")?,