Create a Floppy Disk Image with VBScript
Posted: Sun Jul 17, 2011 2:37 pm
I just finished writing a VB script that can create a floppy image ready to be either written to a floppy using RawWrite or selected by Bochs. I expect that other people might find this useful if they are developing under Windows and plan on using GRUB to load their kernel.
The floppy image is formatted in FAT12 and GRUB is optionally loaded into the boot sector to boot your kernel. Once formatted, files are recursively copied from the "contents" directory of the CWD (directory that you ran the script from) onto the floppy image.
I've attached the script as a text file so that you don't accidentally run it upon download. Be sure to read the comments I wrote at the top of the script for its intended usage. I've tried to make it easy to configure. Rename its file extension to VBS in order to execute it. Below is the layout of my working directory for this script. I simply double-click the script to execute it.
contents\
->boot\
-->kernel.bin ; My kernel
-->grub\
--->menu.lst ; title My Kernel ; root (fd0) ; kernel /boot/kernel.bin
--->stage1 ; GRUB stage1
--->stage2 ; GRUB stage2
grubdir\
->stage1 ; GRUB stage1
->stage2 ; GRUB stage2
floppyimage.vbs
Notes:
I got GRUB stage1 and stage2 precompiled from ftp://alpha.gnu.org/gnu/grub/. I have not tried GRUB 2 with this, just GRUB 0.97-i386-pc.
I'm aware that the file times are incorrectly set. I haven't bothered looking into why this is so and I figure its not too important.
I've tried to keep the script clean and commented, but by no means is it efficient. Floppy images that this script creates are small (1.44MB max) and they typically take less than a minute to make.
I'm new to this site so if I'm posting on the wrong board, not following stated procedures, or offending anyone then please educate me. I'm not familiar with posting on boards and will not be offended if I am corrected.
Feel free to comment or make suggestions.
The floppy image is formatted in FAT12 and GRUB is optionally loaded into the boot sector to boot your kernel. Once formatted, files are recursively copied from the "contents" directory of the CWD (directory that you ran the script from) onto the floppy image.
I've attached the script as a text file so that you don't accidentally run it upon download. Be sure to read the comments I wrote at the top of the script for its intended usage. I've tried to make it easy to configure. Rename its file extension to VBS in order to execute it. Below is the layout of my working directory for this script. I simply double-click the script to execute it.
contents\
->boot\
-->kernel.bin ; My kernel
-->grub\
--->menu.lst ; title My Kernel ; root (fd0) ; kernel /boot/kernel.bin
--->stage1 ; GRUB stage1
--->stage2 ; GRUB stage2
grubdir\
->stage1 ; GRUB stage1
->stage2 ; GRUB stage2
floppyimage.vbs
Notes:
I got GRUB stage1 and stage2 precompiled from ftp://alpha.gnu.org/gnu/grub/. I have not tried GRUB 2 with this, just GRUB 0.97-i386-pc.
I'm aware that the file times are incorrectly set. I haven't bothered looking into why this is so and I figure its not too important.
I've tried to keep the script clean and commented, but by no means is it efficient. Floppy images that this script creates are small (1.44MB max) and they typically take less than a minute to make.
I'm new to this site so if I'm posting on the wrong board, not following stated procedures, or offending anyone then please educate me. I'm not familiar with posting on boards and will not be offended if I am corrected.
Feel free to comment or make suggestions.