:: commit 97394ff601eff673c4519eaec833a2ea0b291aa4

mintsuki <mintsuki@protonmail.com> — 2020-09-06 06:52

parents: 8760c0b3d6

Fix limine-install issue where it did not copy over MBR timestamp and disk signature

diff --git a/limine-install.c b/limine-install.c
index b32e895a..4441373a 100644
--- a/limine-install.c
+++ b/limine-install.c
@@ -22,10 +22,15 @@ int main(int argc, char *argv[]) {
     if (argc >= 3)
         sscanf(argv[2], "%" SCNu32, &stage2_sect);
 
+    // Save original timestamp
+    uint8_t timestamp[6];
+    fseek(device, 218, SEEK_SET);
+    fread(timestamp, 1, 6, device);
+
     // Save the original partition table of the device
-    char orig_mbr[64];
-    fseek(device, 446, SEEK_SET);
-    fread(orig_mbr, 1, 64, device);
+    uint8_t orig_mbr[70];
+    fseek(device, 440, SEEK_SET);
+    fread(orig_mbr, 1, 70, device);
 
     // Write the bootsector from the bootloader to the device
     fseek(device, 0, SEEK_SET);
@@ -39,9 +44,13 @@ int main(int argc, char *argv[]) {
     fseek(device, 0x1b0, SEEK_SET);
     fwrite(&stage2_sect, 1, sizeof(uint32_t), device);
 
+    // Write back timestamp
+    fseek(device, 218, SEEK_SET);
+    fwrite(timestamp, 1, 6, device);
+
     // Write back the saved partition table to the device
-    fseek(device, 446, SEEK_SET);
-    fwrite(orig_mbr, 1, 64, device);
+    fseek(device, 440, SEEK_SET);
+    fwrite(orig_mbr, 1, 70, device);
 
     fclose(device);
 
tab: 248 wrap: offon