Jump to content











Photo
- - - - -

FreeDOS bootsectors


  • Please log in to reply
6 replies to this topic

#1 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 10,092 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 02 August 2011 - 10:52 AM

Thanks to a pointer given by Icecube :worship: :

http://www.ultimateb...php?f=13&t=4077

(and not without many troubles :)) I managed to carry out a few experiments with FreeDOS SYS.COM.

Note:
The ONLY version of SYS.COM that actually behaves like it's doc page suggests:
http://www.freedos.org/kernel/sys.txt

is the one you can access by following EXACTLY Icecube's instructions:

Attach the FreeDOS base ISO (fdbasecd.iso)

In FreeDOS, select "Continue to boot FreeDOS from CD-ROM" (press [ENTER] or type "1" [ENTER])

Then select:
2. FreeDOS Safe Mode (don't load any drivers)


On the actual fdbasecd.iso you can get from here:
http://www.freedos.org/freedos/files/
http://mirrors.bbnx.....0/fdbasecd.iso

if you look hard enough, you will find 3 (THREE) different versions of SYS.COM (ALL obviously named SYS.COM to help disambiguate :ranting2:) :
  • \fdbasecd.iso\freedos\setup\odin\sys.com (10021 bytes 2006-07-13) <- NO GOOD, it misses two options, marked in red in #3
  • \fdbasecd.iso\freedos\packages\base\sysx.zip\bin\sys.com (14561 bytes 2006-08-18) <- NO GOOD, it is a COMPLETELY different tool, and it is the one that will be installed to hard disk
  • \fdbasecd.iso\isolinux\data\fdboot.img\image\freedos\sys.com (11459 bytes 2006-08-11) <- the actual GOOD one :ranting2:
#1 (running SYS without parameters):

FreeDOS System Installer v3.4, Nov 12 2004

Usage:
SYS [source] drive: [bootsect [BOTH]] [/BOOTONLY] [/OEM] [/K name] [/L segm]
source = A:,B:,C:\KERNEL\BIN\,etc., or current directory if not given
drive = A,B,etc.
bootsect = name of 512-byte boot sector file image for drive:
to write to *instead* of real boot sector
BOTH : write to *both* the real boot sector and the image file
/BOOTONLY: do *not* copy kernel / shell, only update boot sector or image
/OEM : indicates kernel is IBMBIO.COM/IBMDOS.COM loaded at 0x70
/OEM:DR use IBMBIO.COM/IBMDOS.COM and FD boot sector (default)
/OEM:PC use PC-DOS compatible boot sector
/OEM:MS use PC-DOS compatible boot sector with IO.SYS/MSDOS.SYS
/K name : name of kernel to use instead of KERNEL.SYS
/L segm : hex load segment to use instead of 60
/B btdrv : hex BIOS # of boot drive, FF=BIOS provided, 0=A:, 80=1st hd,...
SYS CONFIG /help

#2 (running SYS without parameters):

FreeDOS System Installer v3.2, Aug 18 2006

Usage: SYS [source] drive: [bootsect [BOTH]] [BOOTONLY] [/K name] [/L segm]
source = A:,B:,C:\KERNEL\BIN\,etc., or current directory if not given
drive = A,B,etc.
bootsect = name of 512-byte boot sector file image for drive:
to write to *instead* of real boot sector
BOTH : write to *both* the real boot sector and the image file
BOOTONLY : do *not* copy kernel / shell, only update boot sector or image
/K name : name of kernel to use instead of KERNEL.SYS
/L segm : hex load segment to use instead of 60
SYS CONFIG /help

#3 (running SYS without parameters):

FreeDOS System Installer v3.6, Aug 04 2005
Usage:
SYS [source] drive: [bootsect] [{option}]
source = A:,B:,C:\DOS\,etc., or current directory if not given
drive = A,B,etc.
bootsect = name of 512-byte boot sector file image for drive:
to write to *instead* of real boot sector
{option} is one or more of the following:
/BOTH : write to *both* the real boot sector and the image file
/BOOTONLY: do *not* copy kernel / shell, only update boot sector or image
/UPDATE : copy kernel and update boot sector (do *not* copy shell)
/OEM : indicates boot sector, filenames, and load segment to use
/OEM:FD use FreeDOS compatible settings
/OEM:EDR use Enhanced DR DOS 7+ compatible settings

/OEM:DR use DR DOS 7+ compatible settings
/OEM:PC use PC-DOS compatible settings
/OEM:MS use MS-DOS compatible settings
/OEM:W9x use MS Win9x DOS compatible settings
default is /OEM[:AUTO], select DOS based on existing files
/K name : name of kernel to use in boot sector instead of KERNEL.SYS
/L segm : hex load segment to use in boot sector instead of 60
/B btdrv : hex BIOS # of boot drive set in bs, 0=A:, 80=1st hd,...
/FORCEDRV: force use of drive # set in bs instead of BIOS boot value
/NOBAKBS : skips copying boot sector to backup bs, FAT32 only else ignored
SYS CONFIG /help


OT :cheers:, but not much ;), if you compare output with file dates and version numbering, you will understand how past (and current AND future :cheers: ) versioning nightmare we have on Winbuilder is nothing compared to what the good FreeDOS guys managed to put together :w00t::
  • FreeDOS System Installer v3.4, Nov 12 2004 (10021 bytes 2006-07-13)
  • FreeDOS System Installer v3.2, Aug 18 2006 (14561 bytes 2006-08-18)
  • FreeDOS System Installer v3.6, Aug 04 2005 (11459 bytes 2006-08-11)

:angry7:

Anyway, once got hold of the "good" file, (BTW please note how if you use the way suggested by Icecube you need an already formatted floppy image, since in the "2. FreeDOS Safe Mode (don't load any drivers)" seemingly there is NO FORMAT command available :unsure:)
I ran:
  • SYS B: /BOOTONLY /OEM:FD
  • SYS B: /BOOTONLY /OEM:EDR
  • SYS B: /BOOTONLY /OEM:DR
  • SYS B: /BOOTONLY /OEM:PC
  • SYS B: /BOOTONLY /OEM:MS
  • SYS B: /BOOTONLY /OEM:W9x
and saved the bootsector after each command to:
  • FRDOS41FD.bin
  • FRDOS41EDR.bin
  • FRDOS41DR.bin
  • FRDOS41PC.bin
  • FRDOS41MS.bin
  • FRDOS41W9x.bin
Then proceeded to do some comparison/differences:
FRDOS41FD.bin<->FRDOS41EDR.bin SAME boot code; Byte at Offset 0x5C respectively 0x60 and 0x70; system file invoked KERNEL.SYS and DRBIO.SYS
FRDOS41FD.bin<->FRDOS41DR.bin SAME boot code; Byte at Offset 0x5C respectively 0x60 and 0x70; system file invoked KERNEL.SYS and IBMBIO.COM

FRDOS41FD.bin<->FRDOS41PC.bin completely different boot code.
FRDOS41FD.bin<->FRDOS41MS.bin completely different boot code.
FRDOS41FD.bin<->FRDOS41W9x.bin completely different boot code.

FRDOS41MS.bin<->FRDOS41PC.bin SAME boot code; system file invoked IO.SYS and IBMBIO.COM
FRDOS41MS.bin<->FRDOS41W9x.bin SAME boot code; system file invoked IO.SYS and IO.SYS ;); Byte at Offset 0x11D respectively 0x00 and 0x02 :w00t:

If anyone could contribute explaining WHAT :w00t: is the reason of the byte change at offset 0x11D it would be appreciated. :)

:cheers:
Wonko

#2 Icecube

Icecube

    Gold Member

  • Team Reboot
  • 1,045 posts
  •  
    Belgium

Posted 03 August 2011 - 07:41 AM

FRDOS41MS.bin<->FRDOS41W9x.bin SAME boot code; system file invoked IO.SYS and IO.SYS :dubbio:; Byte at Offset 0x11D respectively 0x00 and 0x02 :)

If anyone could contribute explaining WHAT :cheers: is the reason of the byte change at offset 0x11D it would be appreciated. :whistling:

It means that for IO.SYS of W9x-DOS, the bootsector code loads IO.SYS and jumps 0x200 bytes into it, before transfering the control to IO.SYS.

The other differences that you found (not the actual offsets), can also be deducted from this part of the sys.c source code file:
typedef struct DOSBootFiles {

  const char * kernel;   /* filename boot sector loads and chains to */

  const char * dos;      /* optional secondary file for OS */

  WORD         loadaddr; /* segment kernel file expects to start at for stdbs */

                         /* or offset to jump into kernel for oem compat bs */

  BOOL         stdbs;    /* use FD boot sector (T) or oem compat one (F) */

  LONG         minsize;  /* smallest dos file can be and be valid, 0=existance optional */

} DOSBootFiles;

#define FREEDOS_FILES      { "KERNEL.SYS", NULL, 0x60/*:0*/, 1, 0 },

DOSBootFiles bootFiles[] = {

  /* Note: This order is the order OEM:AUTO uses to determine DOS flavor. */

#ifndef DRSYS

  /* FreeDOS */   FREEDOS_FILES

#endif

  /* DR-DOS  */ { "DRBIO.SYS", "DRDOS.SYS", 0x70/*:0*/, 1, 1 },

  /* DR-DOS  */ { "IBMBIO.COM", "IBMDOS.COM", 0x70/*:0*/, 1, 1 },

#ifdef DRSYS

  /* FreeDOS */   FREEDOS_FILES

#endif

#ifdef WITHOEMCOMPATBS

  /* PC-DOS  */ { "IBMBIO.COM", "IBMDOS.COM", /*0x70:*/0x0, 0, 6138 },  /* pre v7 DR ??? */

  /* MS-DOS  */ { "IO.SYS", "MSDOS.SYS", /*0x70:*/0x0, 0, 10240 },

  /* W9x-DOS */ { "IO.SYS", "MSDOS.SYS", /*0x70:*/0x0200, 0, 0 },

  /* Rx-DOS  */ { "RXDOSBIO.SYS", "RXDOS.SYS", /*0x70:*/0x0, 0, 1 },

#endif

};


#3 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 10,092 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 03 August 2011 - 08:25 AM

It means that for IO.SYS of W9x-DOS, the bootsector code loads IO.SYS and jumps 0x200 bytes into it, before transfering the control to IO.SYS.

Thanks :cheers: , so that means that the:

/OEM:MS use PC-DOS compatible boot sector with IO.SYS/MSDOS.SYS

should actually mean:

/OEM:MS use PC-DOS compatible boot sector with IO.SYS/MSDOS.SYS up to MSDOS 6.22

and that:

/OEM:W9x use MS Win9x DOS compatible settings

should actually mean:

/OEM:W9x use MS Win9x DOS compatible settings (MSDOS >=7.x)

:dubbio:


The other differences that you found (not the actual offsets), can also be deducted from this part of the sys.c source code file:

Yes :) that is an otherwise documented field and corresponds to the option:

/L segm : hex load segment to use instead of 60

in practice "normal" FreeDOS loads at 0x60 whilst DRDOS loads at 0x70 (but with the SAME boot code) whilst PCDOS and MSODS load at 0x70 (but with a SAME boot code that is different from the previously mentioned one).

You may notice how the snippet you posted also has a provision for RX-DOS (that does not appear in the tested compiled version). :whistling:

:cheers:
Wonko

#4 Icecube

Icecube

    Gold Member

  • Team Reboot
  • 1,045 posts
  •  
    Belgium

Posted 05 August 2011 - 07:51 AM

sys.com of 2011-08-03 should have all options enabled now:
http://www.fdos.org/kernel/sys/

#5 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 10,092 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 05 August 2011 - 09:19 AM

;) :whistling:

:cheers:
Wonko

#6 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 10,092 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 12 August 2011 - 04:33 PM

New version 10 August 2011 :yahoo::

/OEM : indicates boot sector, filenames, and load segment to use
/OEM:FD use FreeDOS compatible settings
/OEM:DR use DR DOS 7+ compatible settings (same as /OEM)
/OEM:PC use PC-DOS compatible settings
/OEM:MS use MS-DOS compatible settings (up to 6.x)
/OEM:W9x use MS Win9x DOS compatible settings (7.x+)
/OEM:Rx use RxDOS compatible settings
/OEM:DE use DEll Real Mode Kernel settings
default is /OEM:AUTO, select DOS based on existing files


http://www.fdos.org/kernel/sys/

:cheers:
Wonko

#7 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 10,092 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 12 August 2011 - 04:33 PM

New version 10 August 2011 :yahoo::

/OEM : indicates boot sector, filenames, and load segment to use
/OEM:FD use FreeDOS compatible settings
/OEM:DR use DR DOS 7+ compatible settings (same as /OEM)
/OEM:PC use PC-DOS compatible settings
/OEM:MS use MS-DOS compatible settings (up to 6.x)
/OEM:W9x use MS Win9x DOS compatible settings (7.x+)
/OEM:Rx use RxDOS compatible settings
/OEM:DE use DEll Real Mode Kernel settings
default is /OEM:AUTO, select DOS based on existing files


http://www.fdos.org/kernel/sys/

:cheers:
Wonko




4 user(s) are reading this topic

0 members, 4 guests, 0 anonymous users