Skip to content

Commit 538f218

Browse files
committed
add /NOIPL argument to prevent writing IPL on MBR initialization
IPL area is filled with zero instead. Some BIOSes contain heuristics which allow them to skip the device upon boot if they detect the first bytes of the IPL being zero. FreeDOS 1.3 installation under VMware accidentally works because of this, because FDISK 1.3 fails to write proper boot code when initializing the MBR. The INT 18 method introduced to the boot code via 301ba27 should render this obsolete.
1 parent 301ba27 commit 538f218

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

source/fdisk/main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,13 @@ int main( int argc, char *argv[] )
726726
command_ok = TRUE;
727727
}
728728

729+
if ( 0 == strcmp( arg[0].choice, "NOIPL" ) ) {
730+
/* prevent writing IPL upon MBR initialisation */
731+
flags.no_ipl = TRUE;
732+
Shift_Command_Line_Options( 1 );
733+
command_ok = TRUE;
734+
}
735+
729736
if ( 0 == strcmp( arg[0].choice, "PRI" ) ) {
730737
flags.use_iui = FALSE;
731738
Command_Line_Create_Primary_Partition();

source/fdisk/main.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ typedef struct flags_structure {
163163
int monochrome;
164164
int maximum_drive_number;
165165
int more_than_one_drive;
166+
int no_ipl;
166167
int partitions_have_changed;
167168
int partition_type_lookup_table;
168169
int reboot;

source/fdisk/pdiskio.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1330,7 +1330,8 @@ int Write_Partition_Tables( void )
13301330
goto drive_error;
13311331
}
13321332

1333-
if ( *(unsigned short *)( sector_buffer + 510 ) != 0xAA55 ) {
1333+
if ( ( *(unsigned short *)( sector_buffer + 510 ) != 0xAA55 ) &&
1334+
( flags.no_ipl != TRUE ) ) {
13341335
/* install MBR code if we install a new MBR */
13351336
memcpy( sector_buffer, bootnormal_code, SIZE_OF_IPL );
13361337
}

0 commit comments

Comments
 (0)