Hi, I wrote a Perl script which is able to SYS a diskimage. Well, actually it only selects a proper boot sector (depending on detected FAT type and on whether you have given the --lba option, that is), compiles it with nasm (so you need nasm!), merges it with the existing boot sector and finally writes the result back into the filesystem.
Because in Linux filesystems can be reached through devices, sys-freedos.pl --disk=test.img and sys-freedos.pl --disk=/dev/fd0 should both work equally nice :-). > perl sys-freedos.pl --help FreeDOS boot sector SYS for Linux, v0.1, public domain, 2004. Puts a FreeDOS boot sector on a FAT (12/16/32) filesystem. You have to copy the kernel.sys and command.com file, too. Usage: sys-freedos.pl --disk=file [--lba] Options: --disk=file_or_device target filesystem --lba selects LBA boot sectors The download contains the source code for all FreeDOS 2035 boot sectors, but no further documentation. Feel free to write some and / or improve the Perl script itself. Note that the --lba option only matters for FAT32: For FAT12 and FAT16, we have boot sectors which can handle BOTH LBA and CHS, autodetecting the LBA BIOS support at boot time. For FAT32, I recommend using the LBA boot sector. You can get the files at: http://www.coli.uni-sb.de/~eric/stuff/soft/specials/ sys-freedos-linux.zip (without the space in the URL of course) Special dosfstools mkdosfs caveats: Take care: mkdosfs does NOT initialize the LBA partition position ("hidden sectors") field in the boot sector, so you have to fix that manually for partitioned drives. EVEN all FreeDOS CHS boot sectors need proper "heads", "sectPertrack" AND "nHidden" values in the boot sector! (Win9x boot sectors are able to read those values from the MBR, but they are actually 2 sectors big...). The FAT12 and FAT16 boot sectors of FreeDOS need proper values, too, but at least for most FAT12 cases you will usually have no problems: mkdosfs should set the proper geometry for diskettes automatically, and they are not partitioned either. For harddisks, mkdosfs uses HDIO_GETGEO for heads and secs_track, but nHidden will default to 0: Only correct if there is no MBR. For the first partition on ??x??x63 disks, 63 (0x3f) is often the correct nHidden value: Patch the bytes at offset 0x1c to 0x3f, 0. Special dosemu caveats: DOSEMU disk images have a special file format. First you have 128 bytes of header, starting with the string DOSEMU, next is a MBR (without code, only the partition table data is used), and then on a position which depends on the MBR contents you have the actual disk image of the partition. So you have to add one sysseek (do not use "seek", use sysseek!) before the boot sector reading code and adjust the existing sysseek (the one before the updated boot sector is written) to skip over the header and MBR etc. ... Luckily sys-freedos.pl detects that DOSEMU disk images are no plain partition images, so unless you fix the sysseeks, sys-freedos.pl will simply refuse to change the disk image contents. Enjoy and take care - you could render partitions unbootable or even destroy data, but in NORMAL cases everything should work out okay. Do not forget that sys-freedos.pl alone does not make drives bootable. You also have to COPY THE FILES (kernel, shell) to the disk or image, e.g. by using mtools or mounting or loopback- mounting the disk or image on your system and then simply using cp. Eric. ------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 _______________________________________________ Freedos-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freedos-user