Skip to content

Commit 64d6919

Browse files
committed
fix: Copy the GRUB hybrid boot image from outside the root before creating the ISO image
1 parent 679f1ed commit 64d6919

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/builder.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,14 @@ impl Bootloader {
174174

175175
fn cp_grub(&self, manifest: &Manifest, chroot: &Path) -> Result<()> {
176176
let imgd = chroot.parent().unwrap().join(ISO_TREE);
177+
let assets = chroot.parent().unwrap().join("assets");
178+
std::fs::create_dir_all(&assets)?;
177179
let cmd = &manifest.kernel_cmdline.as_ref().map_or("", |s| s);
178180
let volid = manifest.get_volid();
181+
if manifest.dnf.arch.as_deref().unwrap_or(std::env::consts::ARCH) == "x86_64" {
182+
let hybrid_img = chroot.join("usr/lib/grub/i386-pc/boot_hybrid.img");
183+
std::fs::copy(&hybrid_img, assets.join("boot_hybrid.img"))?;
184+
};
179185

180186
let (vmlinuz, initramfs) = self.cp_vmlinuz_initramfs(chroot, &imgd)?;
181187

@@ -742,9 +748,10 @@ impl IsoBuilder {
742748
let volid = manifest.get_volid();
743749
let (uefi_bin, bios_bin) = self.bootloader.get_bins();
744750
let tree = chroot.parent().unwrap().join(ISO_TREE);
751+
let assets = chroot.parent().unwrap().join("assets");
745752

746753
// TODO: refactor to new fn in Bootloader
747-
let grub2_mbr_hybrid = chroot.join("usr/lib/grub/i386-pc/boot_hybrid.img");
754+
let grub2_mbr_hybrid = assets.join("boot_hybrid.img");
748755
let efiboot = tree.join("boot/efiboot.img");
749756

750757
match self.bootloader {
@@ -880,7 +887,6 @@ impl ImageBuilder for IsoBuilder {
880887

881888
info!("Build process completed successfully for image: {:?}", image);
882889

883-
884890
Ok(())
885891
}
886892
}

0 commit comments

Comments
 (0)