Fixed the EXT2/3 boot sector code so that it only uses the boot drive in the boot sector if it exists (i.e. not 0xff)

Otherwise it uses the boot drive passed in the DL register.
Updated the EXT2/3 installer to reflect the changes in the boot sector code for EXT2/3.

svn path=/trunk/; revision=4540
This commit is contained in:
Brian Palmer 2003-04-15 22:48:06 +00:00
parent b4d0aca25a
commit 273b6dd69f
3 changed files with 23 additions and 9 deletions

View file

@ -1,6 +1,6 @@
; EXT2.ASM
; EXT2 Boot Sector
; Copyright (c) 2002 Brian Palmer
; Copyright (c) 2002, 2003 Brian Palmer
; [bp-0x04] Here we will store the number of sectors per track
; [bp-0x08] Here we will store the number of heads
@ -62,8 +62,14 @@ main:
mov sp,7b00h ; Setup a stack
cmp BYTE [BYTE bp+BootDrive],BYTE 0xff ; If they have specified a boot drive then use it
jne GetDriveParameters
mov [BYTE bp+BootDrive],dl ; Save the boot drive
GetDriveParameters:
mov ax,0800h
mov ah,08h
mov dl,[BYTE bp+BootDrive] ; Get boot drive in dl
int 13h ; Request drive parameters from the bios
jnc CalcDriveSize ; If the call succeeded then calculate the drive size
@ -334,7 +340,9 @@ Done:
msgDiskError db 'Disk error',0
msgAnyKey db 'Press any key to restart',0
; Sorry, need the space...
;msgAnyKey db 'Press any key to restart',0
msgAnyKey db 'Press any key',0
times 509-($-$$) db 0 ; Pad to 509 bytes
@ -628,19 +636,19 @@ Ext2ReadDirectBlocksLoop:
; And reboots
PrintFileNotFound:
mov si,msgFreeLdr ; FreeLdr not found message
jmp short DisplayAndRebootIt
jmp short DisplayItAndReboot
; Displays a file size is 0 error
; And reboots
PrintFileSizeError:
mov si,msgFileSize ; Error message
jmp short DisplayAndRebootIt
jmp short DisplayItAndReboot
; Displays a file is not a regular file error
; And reboots
PrintRegFileError:
mov si,msgRegFile ; Error message
DisplayAndRebootIt:
DisplayItAndReboot:
call PutChars ; Display it
jmp Reboot

View file

@ -111,8 +111,8 @@ int main(int argc, char *argv[])
printf("Cylinders: %d\n", Ext2DriveGeometry.cylinders);
printf("Start: %d\n", Ext2DriveGeometry.start);
Ext2BootCode->BootDrive = 0x80;
Ext2BootCode->BootPartition = 0x05;
Ext2BootCode->BootDrive = 0xff;
Ext2BootCode->BootPartition = 0x00;
//Ext2BootCode->SectorsPerTrack = Ext2DriveGeometry.sectors;
//Ext2BootCode->NumberOfHeads = Ext2DriveGeometry.heads;
Ext2BootCode->Ext2VolumeStartSector = Ext2DriveGeometry.start;

View file

@ -8,7 +8,7 @@ typedef struct
{
unsigned char JmpBoot[3];
unsigned char BootDrive;
unsigned char BootPartition;
//unsigned char BootPartition;
//unsigned char SectorsPerTrack;
//unsigned short NumberOfHeads;
//unsigned long Reserved1;
@ -22,6 +22,12 @@ typedef struct
unsigned long Ext2FirstDataBlock; // First data block (1 for 1024-byte blocks, 0 for bigger sizes)
unsigned long Ext2InodesPerGroup; // Number of inodes per group
unsigned long Ext2InodesPerBlock; // Number of inodes per block
unsigned char BootCodeAndData[459];
unsigned char BootPartition;
unsigned short BootSignature;
} PACKED EXT2_BOOTCODE, *PEXT2_BOOTCODE;