Creating a floppy disk image

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Puffy
Member
Member
Posts: 26
Joined: Mon May 26, 2008 7:00 am

Creating a floppy disk image

Post by Puffy »

Hi,

I was wondering if there is a way to create a bootable floppy disk image without first writing your bootloader/kernel to an actual floppy disk (I don't have access to a floppy drive unfortunatley!).

Thanks,

Puff
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

Hi,

If you are using Windows, see Virtual Floppy Drive. I am not very familiar with Linux, but believe the dd command combined with a loopback device is what you would want there.

Cheers,
Adam
User avatar
Stevo14
Member
Member
Posts: 179
Joined: Fri Mar 07, 2008 3:40 am
Location: Arad, Romania

Post by Stevo14 »

Yea, under Linux use something like

Code: Select all

dd if=/dev/zero of=./floppy.img bs=1024 count=1440
to make a blank 1.44mb floppy image called "floppy.img".
Puffy
Member
Member
Posts: 26
Joined: Mon May 26, 2008 7:00 am

Post by Puffy »

Thanks for the tips!

As a side note, using the Linux method specified above, how do you actually get your bootloader/kernel data in there as well, since the image produced is blank?
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Post by Solar »

Mount per loopback device.

It's in the Wiki, really.
Every good solution is obvious once you've found it.
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: Creating a floppy disk image

Post by egos »

Puffy wrote:Hi,

I was wondering if there is a way to create a bootable floppy disk image without first writing your bootloader/kernel to an actual floppy disk (I don't have access to a floppy drive unfortunatley!).

Thanks,

Puff
I wrote: For quick making and changing a floppy image you can use fasm and special include file. For example,

Code: Select all

include "mkfloppy.inc"

file "bootcode.bin", 512

; fat1
db 0F0h, 0FFh, 0FFh, 9*512-3 dup 0

; fat2
db 0F0h, 0FFh, 0FFh, 9*512-3 dup 0

; root
dent io,        "IO      SYS", FA_RO or FA_HID or FA_SYS or FA_ARC
dent msdos,     "MSDOS   SYS", FA_RO or FA_HID or FA_SYS or FA_ARC
dent command,   "COMMAND COM", FA_ARC
dent drvspace,  "DRVSPACEBIN", FA_RO or FA_HID or FA_SYS or FA_ARC
dent autoexec,  "AUTOEXECBAT", FA_ARC
dent command2,  "COMMAND",     FA_DIR
rb 33*512-$

; data
stof io,        "content/IO.SYS"
stof msdos,     "content/MSDOS.SYS"
stof command,   "content/COMMAND.COM"
stof drvspace,  "content/DRVSPACE.BIN"
stof autoexec,  "content/AUTOEXEC.BAT"

defdir command2
{
dent fdisk,     "FDISK   EXE", FA_ARC
dent format,    "FORMAT  COM", FA_ARC
dent sys,       "SYS     COM", FA_ARC
dent defrag,    "DEFRAG  EXE", FA_ARC
dent scandisk1, "SCANDISKEXE", FA_ARC
dent scandisk2, "SCANDISKINI", FA_ARC
}

stod command2,  root
stof fdisk,     "content/COMMAND/FDISK.EXE"
stof format,    "content/COMMAND/FORMAT.COM"
stof sys,       "content/COMMAND/SYS.COM"
stof defrag,    "content/COMMAND/DEFRAG.EXE"
stof scandisk1, "content/COMMAND/SCANDISK.EXE"
stof scandisk2, "content/COMMAND/SCANDISK.INI"
rb 2*80*18*512-$
LFN not yet supported.
cg123
Member
Member
Posts: 41
Joined: Wed Sep 27, 2006 2:34 pm

Re: Creating a floppy disk image

Post by cg123 »

egos wrote:
Puffy wrote:Hi,

I was wondering if there is a way to create a bootable floppy disk image without first writing your bootloader/kernel to an actual floppy disk (I don't have access to a floppy drive unfortunatley!).

Thanks,

Puff
I wrote: For quick making and changing a floppy image you can use fasm and special include file. For example,

Code: Select all

include "mkfloppy.inc"

file "bootcode.bin", 512

; fat1
db 0F0h, 0FFh, 0FFh, 9*512-3 dup 0

; fat2
db 0F0h, 0FFh, 0FFh, 9*512-3 dup 0

; root
dent io,        "IO      SYS", FA_RO or FA_HID or FA_SYS or FA_ARC
dent msdos,     "MSDOS   SYS", FA_RO or FA_HID or FA_SYS or FA_ARC
dent command,   "COMMAND COM", FA_ARC
dent drvspace,  "DRVSPACEBIN", FA_RO or FA_HID or FA_SYS or FA_ARC
dent autoexec,  "AUTOEXECBAT", FA_ARC
dent command2,  "COMMAND",     FA_DIR
rb 33*512-$

; data
stof io,        "content/IO.SYS"
stof msdos,     "content/MSDOS.SYS"
stof command,   "content/COMMAND.COM"
stof drvspace,  "content/DRVSPACE.BIN"
stof autoexec,  "content/AUTOEXEC.BAT"

defdir command2
{
dent fdisk,     "FDISK   EXE", FA_ARC
dent format,    "FORMAT  COM", FA_ARC
dent sys,       "SYS     COM", FA_ARC
dent defrag,    "DEFRAG  EXE", FA_ARC
dent scandisk1, "SCANDISKEXE", FA_ARC
dent scandisk2, "SCANDISKINI", FA_ARC
}

stod command2,  root
stof fdisk,     "content/COMMAND/FDISK.EXE"
stof format,    "content/COMMAND/FORMAT.COM"
stof sys,       "content/COMMAND/SYS.COM"
stof defrag,    "content/COMMAND/DEFRAG.EXE"
stof scandisk1, "content/COMMAND/SCANDISK.EXE"
stof scandisk2, "content/COMMAND/SCANDISK.INI"
rb 2*80*18*512-$
LFN not yet supported.

Well, uh.. maybe I'm misinterpreting something, but where is said include file?
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: Creating a floppy disk image

Post by egos »

cg123 wrote:Well, uh.. maybe I'm misinterpreting something, but where is said include file?
mkfloppy.zip
If you have seen bad English in my words, tell me what's wrong, please.
Post Reply