vga: fix bochs lfb size display
[seabios.git] / src / ramdisk.c
index be1de56c2152d9486e69c5d248d00bbed932ac1e..bae30e213d419f25bb36aee6a938341512ef9ee5 100644 (file)
@@ -9,6 +9,7 @@
 #include "memmap.h" // add_e820
 #include "biosvar.h" // GET_GLOBAL
 #include "bregs.h" // struct bregs
+#include "boot.h" // boot_add_floppy
 
 void
 ramdisk_setup(void)
@@ -20,8 +21,9 @@ ramdisk_setup(void)
     struct cbfs_file *file = cbfs_findprefix("floppyimg/", NULL);
     if (!file)
         return;
+    const char *filename = cbfs_filename(file);
     u32 size = cbfs_datasize(file);
-    dprintf(3, "Found floppy file %s of size %d\n", cbfs_filename(file), size);
+    dprintf(3, "Found floppy file %s of size %d\n", filename, size);
     int ftype = find_floppy_type(size);
     if (ftype < 0) {
         dprintf(3, "No floppy type found for ramdisk size\n");
@@ -40,10 +42,13 @@ ramdisk_setup(void)
     cbfs_copyfile(file, pos, size);
 
     // Setup driver.
-    dprintf(1, "Mapping CBFS floppy %s to addr %p\n", cbfs_filename(file), pos);
-    struct drive_s *drive_g = addFloppy((u32)pos, ftype, DTYPE_RAMDISK);
+    struct drive_s *drive_g = init_floppy((u32)pos, ftype);
     if (!drive_g)
-        strtcpy(drive_g->desc, cbfs_filename(file), MAXDESCSIZE);
+        return;
+    drive_g->type = DTYPE_RAMDISK;
+    dprintf(1, "Mapping CBFS floppy %s to addr %p\n", filename, pos);
+    char *desc = znprintf(MAXDESCSIZE, "Ramdisk [%s]", &filename[10]);
+    boot_add_floppy(drive_g, desc, bootprio_find_named_rom(filename, 0));
 }
 
 static int