Implement old MBR saving in LimineMHDIns.

This commit is contained in:
TomAwezome 2022-11-02 15:30:08 -04:00
parent f02a3c844f
commit 572c36509b

View file

@ -100,9 +100,11 @@ Bool LimineMHDIns(U8 drv_let)
BlkDevLock(bd); BlkDevLock(bd);
AHCIAtaBlksRead(bd, &old_mbr, 0, 1); // read old MBR currently on disk AHCIAtaBlksRead(bd, &old_mbr, 0, 1); // read old MBR currently on disk
MemCopy(new_mbr->p, old_mbr.p, sizeof(CMasterBoot.p)); // copy old MBR partition table to new Limine MBR MemCopy(new_mbr->p, old_mbr.p, sizeof(CMasterBoot.p)); // copy old MBR partition table to new Limine MBR
// read the whole MBR + post-MBR-gap that Limine wants to overwrite, save all of that as an OldMBR.BIN
BootMHDOldRead(drv_let, drv_let, 1 + (limine_stage2_size_aligned / BLK_SIZE));
AHCIAtaBlksWrite(bd, limine, 0, 1 + (limine_stage2_size_aligned / BLK_SIZE)); // write Limine to MBR and post-MBR gap AHCIAtaBlksWrite(bd, limine, 0, 1 + (limine_stage2_size_aligned / BLK_SIZE)); // write Limine to MBR and post-MBR gap
BlkDevUnlock(bd); BlkDevUnlock(bd);