I will try to add the Windows parts too, when I have the time.
Download mtools compiled for Windows:
http://ubcdcreator.stopspazzing.com/mto ... 7-win32.7z
mtools manual page:
http://www.gnu.org/software/mtools/manual/mtools.html
Extract /ubcd/images/fdubcd.iso.gz.
Extract fdubcd.img out of the fdubcd.iso.
Make a copy of the existing floppy (just in case you mess up):
Code: Select all
cp fdubcd.img fdubcd-original.img
Code: Select all
mformat -C -f 2880 -v FDUBCD141 -i fdubcd-clean-filesystem.img ::
Code: Select all
mformat -C -f 2880 -v FDUBCD141 -d 1 -r 6 -L 9 -i fdubcd-clean-filesystem.img ::
Code: Select all
-C : Create a the image file (use it when you don't have an existing image file)
-f 2880 : Specifies the size of the DOS filesystem to format.
2880 kb, double-sided, 36 sectors per track, 80 cylinders (for 3 1/2 ED)
-v FDUBCD141 : Set volume label of floppy image to "FDUBCD141".
-d 1 : Sets the number of FAT copies. Default is 2.
Setting this to 1, gives use a bit more space ( = number of sectors set as length of FAT)
-r 6 : Sets the size of the root directory (in sectors) (default value = 15 for 3 1/2 ED floppy)
A value of 6 will give us a limit of 96 ROOT files and/or directories.
(512 bytes per sector) / (32 bytes per entry) = (16 entries per sector)
In the subdirectories, there is no limit in the number of subdirectories or files, except that the
total number of files and directories can't be more than the total number of data clusters available.
-L 9 : Sets the length of the FAT (in sectors)
Each entry in the FAT12 table is 1.5 bytes long.
512 bytes per sector / 1.5 bytes per entry * 9 sectors = 3072 entries
In FAT12, the first 2 entries are reserved, so a value of 9 will give use 3070 allocatable clusters.
One cluster in a 3 1/2 ED FAT12 floppy is 2 sectors long by default ==> 1 cluster is 1 KB.
A 2880KB floppy has more than enough with a FAT table with 3070 entries.
-i fdubcd-clean-filesystem.img : Filename of our new floppy image
Download the FreeDOS base iso (fdbasecd.iso) from: http://www.freedos.org/freedos/files/
Open your virtual machine software (qemu, VirtualBox, ..) and attach:
- fdubcd-clean-filesystem.img as floppy image
- fdbasecd.iso as CD image
Qemu:
Code: Select all
qemu -boot d -cdrom fdbasecd.iso -fda fdubcd-clean-filesystem.img
VirtualBox doesn't seem to like to attach 2880 kb floppies, but there is a workaround.
- Move fdubcd-clean-filesystem.img to fdubcd-clean-filesystem-2880.img
- Create a 1440 kb floppy with the same name:
Code: Select all
mformat -C -f 1440 -v FDUBCD141 -i fdubcd-clean-filesystem.img ::
- Attach this floppy image to VirtualBox
- Close VirtualBox
- Remove the 1440 kb fdubcd-clean-filesystem.img
- Move fdubcd-clean-filesystem-2880.img to fdubcd-clean-filesystem.img
- Start VirtualBOX and see your 2880 kb floppy image attached
- Attach the FreeDOS base ISO (fdbasecd.iso)
Then select:
2. FreeDOS Safe Mode (don't load any drivers)
Code: Select all
���������������������������������������������������������������������
� FreeDOS 1.0 Final (2006-July-30) INSTALLATION/LIVE CD �
���������������������������������������������������������������������
� 1. Install to harddisk using FreeDOS SETUP (default) �
� �
� 2. FreeDOS Safe Mode (don't load any drivers) �
� �
� FreeDOS is a trademark of Jim Hall 1994-2006 �
���������������������������������������������������������������������
Select from Menu [12], or press [ENTER] (Selection=2) 9
Singlestepping (F8) is: OFF
Because the FreeDOS CD boots a floppy image with MEMDISK, our attached floppy image is now B: instead of the normal A: drive.
- We install the FreeDOS boot sector code (/OEM:FD)
- And we don't copy the FreeDOS files like KERNEL.SYS at this time (/BOOTONLY)
Code: Select all
sys B: /BOOTONLY /OEM:FD
Code: Select all
FreeCom version 0.84-pre2 XMS_Swap [Aug 28 2006 00:29:00]
Welcome to the command prompt. No drivers were loaded.
A:\>sys B: /BOOTONLY /OEM:FD
FreeDOS System Installer v3.6, Aug 04 2005
Processing boot sector...
Reading old bootsector from drive B:
FAT type: FAT12
Root dir entries = 96
FAT starts at sector (0 + 1)
Root directory starts at sector (PREVIOUS + 9 * 1)
Boot sector kernel name set to KERNEL SYS
Boot sector kernel load segment set to 60:0h
writing new bootsector to drive B:
System transferred.
A:\>
You only need to create the fdubcd-clean-filesystem.img file once. The next time you want to make a modified FDUBCD floppy image, you can start from that image file, copy the needed files inside the image and get a nice fresh floppy image with all files defragmented and with all unused sectors zeroed out (will give a smaller compressed size).
Copy the clean 2880k floppy image with the FreeDOS boot sector installed fdubcd-clean-filesystem.img to a new file on which we can work further (fdubcd-fresh-files.img)
Code: Select all
cp fdubcd-clean-filesystem.img fdubcd-fresh-files.img
Code: Select all
mlabel -i fdubcd-fresh-files.img ::FDUBCD141
Code: Select all
rm -rf /tmp/fdubcd
mkdir /tmp/fdubcd
Code: Select all
mcopy -s -m -p -v -i fdubcd-original.img :: /tmp/fdubcd
Code: Select all
- s Recursive copy. Also copies directories and their contents
- p Preserves the attributes of the copied files
- m Preserve the file modification time.
- v Verbose. Displays the name of each file as it is copied.
Sometimes the files in the temporary directory aren't all uppercase, so lets fix this.
FreeDOS can work with them, but it looks nicer if all the filenames look similar.
Convert all lowercase filenames to uppercase:
Code: Select all
cd /tmp/fdubcd/
find . -exec bash -c 'file={}; mv -v "${file}" "${file^^}"' \;
cd -
Code: Select all
mcopy -s -m -p -v -i fdubcd-fresh-files.img /tmp/fdubcd/* ::
The FDUBCD image in UBCD is always loaded with MEMDISK, so no changes are written to the fdubcd.img file. Therefore, we load our new image with MEMDISK too, so to test it in a Virtual Machine. Only qemu supports direct booting of MEMDISK (linux kernel format).
Code: Select all
qemu -kernel memdisk -initrd fdubcd-fresh-files.img -append 'raw'
With this method, I have now 9 kb more space than in the original FDUBCD141 floppy image (due the parameters given to mformat).
FAT info for the new floppy image created with mformat (custom values):
Code: Select all
$ minfo -i fdubcd-fresh-files.img ::
filename="fdubcd-fresh-files.img"
sectors per track: 36
heads: 2
cylinders: 80
mformat command line: mformat -t 80 -h 2 -s 36 ::
bootsector information
======================
banner:"FRDOS4.1"
sector size: 512 bytes
cluster size: 2 sectors
reserved (boot) sectors: 1
fats: 1
max available root directory slots: 96
small size: 5760 sectors
media descriptor byte: 0xf0
sectors per fat: 9
sectors per track: 36
heads: 2
hidden sectors: 0
big size: 0 sectors
physical drive id: 0x0
reserved=0x0
dos4=0x29
serial number: 34D977A2
disk label="FDUBCD141 "
disk type="FAT12 "
Code: Select all
$ minfo -i fdubcd-original.img ::
device information:
===================
filename="fdubcd-original.img"
sectors per track: 36
heads: 2
cylinders: 80
mformat command line: mformat -t 80 -h 2 -s 36 ::
bootsector information
======================
banner:" "
sector size: 512 bytes
cluster size: 2 sectors
reserved (boot) sectors: 1
fats: 2
max available root directory slots: 240
small size: 5760 sectors
media descriptor byte: 0xf0
sectors per fat: 9
sectors per track: 36
heads: 2
hidden sectors: 0
big size: 0 sectors
physical drive id: 0x0
reserved=0x0
dos4=0x29
serial number: 00000000
disk label=" "
disk type="FAT12 "
Code: Select all
$ minfo -i fdubcd-fresh-files.img ::
filename="fdubcd-fresh-files.img"
sectors per track: 36
heads: 2
cylinders: 80
mformat command line: mformat -t 80 -h 2 -s 36 ::
bootsector information
======================
banner:"FRDOS4.1"
sector size: 512 bytes
cluster size: 2 sectors
reserved (boot) sectors: 1
fats: 2
max available root directory slots: 240
small size: 5760 sectors
media descriptor byte: 0xf0
sectors per fat: 9
sectors per track: 36
heads: 2
hidden sectors: 0
big size: 0 sectors
physical drive id: 0x0
reserved=0x0
dos4=0x29
serial number: 06A479B7
disk label="FDUBCD141 "
disk type="FAT12 "