From fb29fa8a10ea2ea25d575baf4b52ab0b32947d6e Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Fri, 6 Sep 2002 22:38:10 +0000 Subject: [PATCH] Added new 'bootcd' target. Removed/disabled debugging code. SetupLdr must not call BiosInt13ExtensionsSupported() to check extended int13 capabilities because they are already used to boot a CD and some BIOSes return incorrect results when a CD-ROM drive is checked. svn path=/trunk/; revision=3465 --- freeldr/bootsect/Makefile | 19 +++++++++++++- freeldr/bootsect/isoboot.asm | 10 +------ freeldr/freeldr/CHANGELOG | 9 +++++++ freeldr/freeldr/Makefile | 18 +++++++++++++ freeldr/freeldr/bootmgr.c | 2 ++ freeldr/freeldr/debug.c | 8 +++--- freeldr/freeldr/disk/disk.c | 2 +- freeldr/freeldr/disk/partition.c | 18 +++++-------- freeldr/freeldr/include/freeldr.h | 1 + freeldr/freeldr/include/version.h | 4 +-- freeldr/freeldr/reactos/registry.c | 11 ++++++++ freeldr/freeldr/reactos/setupldr.c | 42 ++++++++++++++---------------- 12 files changed, 93 insertions(+), 51 deletions(-) diff --git a/freeldr/bootsect/Makefile b/freeldr/bootsect/Makefile index 1bab842f7db..a542c60b7a4 100644 --- a/freeldr/bootsect/Makefile +++ b/freeldr/bootsect/Makefile @@ -18,14 +18,18 @@ # RM = cmd /C del +CP = copy /Y +MKDIR = md NASM_CMD = nasm BIN2C = ../tools/bin2c TOOLSDIR = ../tools +BOOTCD_DIR = ..\..\bootcd -.PHONY : clean +.PHONY : clean bootcd all: $(BIN2C) fat.bin fat32.bin isoboot.bin ext2.bin + $(BIN2C) : @$(MAKE) --no-print-directory -C $(TOOLSDIR) @@ -49,6 +53,19 @@ ext2.bin : ext2.asm @$(NASM_CMD) -o ext2.bin -f bin ext2.asm @$(BIN2C) ext2.bin ext2.h ext2_data + +.PHONY : bootcd +bootcd: bootcd_dirs isoboot.bin + $(CP) isoboot.bin $(BOOTCD_DIR) + +.PHONY : bootcd_dirs +bootcd_dirs: + $(MKDIR) $(BOOTCD_DIR) + $(MKDIR) $(BOOTCD_DIR)\disk + $(MKDIR) $(BOOTCD_DIR)\disk\reactos + $(MKDIR) $(BOOTCD_DIR)\disk\install + $(MKDIR) $(BOOTCD_DIR)\disk\bootdisk + clean: @-$(RM) *.bin @-$(RM) *.h diff --git a/freeldr/bootsect/isoboot.asm b/freeldr/bootsect/isoboot.asm index e3b5d6b7910..7dae2c1d647 100644 --- a/freeldr/bootsect/isoboot.asm +++ b/freeldr/bootsect/isoboot.asm @@ -31,7 +31,7 @@ ; **************************************************************************** ; Note: The Makefile builds one version with DEBUG_MESSAGES automatically. -%define DEBUG_MESSAGES ; Uncomment to get debugging messages +;%define DEBUG_MESSAGES ; Uncomment to get debugging messages @@ -342,14 +342,6 @@ get_fs_structures: call crlf %endif - mov eax, [di+file_sector] - call writehex8 - call crlf - - mov eax, [di+file_left] - call writehex8 - call crlf - mov bx, 0x8000 ; bx = load address mov si, di ; restore file pointer mov cx, 0xFFFF ; load the whole file diff --git a/freeldr/freeldr/CHANGELOG b/freeldr/freeldr/CHANGELOG index a3185f0a7e5..ee8542cf238 100644 --- a/freeldr/freeldr/CHANGELOG +++ b/freeldr/freeldr/CHANGELOG @@ -1,3 +1,12 @@ +Changes in v1.7.8 (9/7/2002) (ekohl) + +- Added new 'bootcd' target. +- Removed/disabled debugging code. +- SetupLdr must not call BiosInt13ExtensionsSupported to check + extended int13 capabilities because they are already used to + boot a CD and some BIOSes return incorrect results when a CD-ROM + drive is checked. + Changes in v1.7.7 (9/5/2002) (ekohl) - fs/iso.c: Got iso-fs working again. diff --git a/freeldr/freeldr/Makefile b/freeldr/freeldr/Makefile index ec230420a04..2fe9210b630 100644 --- a/freeldr/freeldr/Makefile +++ b/freeldr/freeldr/Makefile @@ -30,6 +30,8 @@ DEBUG = yes OBJDIR = obj OUTPUT_DIR = $(OBJDIR)/$(TARGET) +BOOTCD_DIR = ../../bootcd + ############################################# # COMPILER AND LINKER PROGRAMS # @@ -104,6 +106,22 @@ clean: ############################################# +.PHONY : bootcd +bootcd : bootcd_dirs $(OBJDIR)/$(TARGET)/setupldr.sys + $(CP) $(OBJDIR)/$(TARGET)/setupldr.sys $(BOOTCD_DIR)/disk/reactos/setupldr.sys + + +.PHONY : bootcd_dirs +bootcd_dirs: + $(MKDIR) $(BOOTCD_DIR) + $(MKDIR) $(BOOTCD_DIR)/disk + $(MKDIR) $(BOOTCD_DIR)/disk/reactos + $(MKDIR) $(BOOTCD_DIR)/disk/install + $(MKDIR) $(BOOTCD_DIR)/disk/bootdisk + + +############################################# + #----------------------------------------------------------------------------------------------------- # END MAGIC TARGET DIRECTORY CHANGE STUFF #----------------------------------------------------------------------------------------------------- diff --git a/freeldr/freeldr/bootmgr.c b/freeldr/freeldr/bootmgr.c index 8fc802cbce1..86726eeb445 100644 --- a/freeldr/freeldr/bootmgr.c +++ b/freeldr/freeldr/bootmgr.c @@ -33,6 +33,8 @@ #include #include +BOOL IsSetupLdr = FALSE; + VOID RunLoader(VOID) { UCHAR SettingName[80]; diff --git a/freeldr/freeldr/debug.c b/freeldr/freeldr/debug.c index db06c234521..ee8269966da 100644 --- a/freeldr/freeldr/debug.c +++ b/freeldr/freeldr/debug.c @@ -27,8 +27,8 @@ //#define DEBUG_ULTRA //#define DEBUG_INIFILE //#define DEBUG_REACTOS -#define DEBUG_CUSTOM -//#define DEBUG_NONE +//#define DEBUG_CUSTOM +#define DEBUG_NONE #if defined (DEBUG_ULTRA) U32 DebugPrintMask = DPRINT_WARNING | DPRINT_MEMORY | DPRINT_FILESYSTEM | @@ -56,8 +56,8 @@ U32 DebugPrintMask = 0; #define BOCHS_OUTPUT_PORT 0xe9 //U32 DebugPort = RS232; -//U32 DebugPort = SCREEN; -U32 DebugPort = BOCHS; +U32 DebugPort = SCREEN; +//U32 DebugPort = BOCHS; U32 ComPort = COM1; //U32 BaudRate = 19200; U32 BaudRate = 115200; diff --git a/freeldr/freeldr/disk/disk.c b/freeldr/freeldr/disk/disk.c index a5ed9e83a32..095a3d9ff4f 100644 --- a/freeldr/freeldr/disk/disk.c +++ b/freeldr/freeldr/disk/disk.c @@ -56,7 +56,7 @@ BOOL DiskReadLogicalSectors(U32 DriveNumber, U32 SectorNumber, U32 SectorCount, // If so then check to see if Int13 extensions work // If they do then use them, otherwise default back to BIOS calls // - if ((DriveNumber >= 0x80) && (BiosInt13ExtensionsSupported(DriveNumber))) + if ((DriveNumber >= 0x80) && (IsSetupLdr || BiosInt13ExtensionsSupported(DriveNumber))) { DbgPrint((DPRINT_DISK, "Using Int 13 Extensions for read. BiosInt13ExtensionsSupported(%d) = %s\n", DriveNumber, BiosInt13ExtensionsSupported(DriveNumber) ? "TRUE" : "FALSE")); diff --git a/freeldr/freeldr/disk/partition.c b/freeldr/freeldr/disk/partition.c index 11016ff2122..00ddb2c0292 100644 --- a/freeldr/freeldr/disk/partition.c +++ b/freeldr/freeldr/disk/partition.c @@ -44,29 +44,25 @@ BOOL DiskIsDriveRemovable(U32 DriveNumber) BOOL DiskIsDriveCdRom(U32 DriveNumber) { PUCHAR Sector = (PUCHAR)DISKREADBUFFER; - BOOL Result; // Hard disks use drive numbers >= 0x80 // So if the drive number indicates a hard disk // then return FALSE - if ((DriveNumber >= 0x80) && (BiosInt13ExtensionsSupported(DriveNumber))) + if ((DriveNumber >= 0x80) && (IsSetupLdr || BiosInt13ExtensionsSupported(DriveNumber))) { if (!BiosInt13ReadExtended(DriveNumber, 16, 1, Sector)) { DiskError("Disk read error."); - MmFreeMemory(Sector); return FALSE; } - Result = (Sector[0] == 1 && - Sector[1] == 'C' && - Sector[2] == 'D' && - Sector[3] == '0' && - Sector[4] == '0' && - Sector[5] == '1'); - - return Result; + return (Sector[0] == 1 && + Sector[1] == 'C' && + Sector[2] == 'D' && + Sector[3] == '0' && + Sector[4] == '0' && + Sector[5] == '1'); } // Drive is not CdRom so return FALSE diff --git a/freeldr/freeldr/include/freeldr.h b/freeldr/freeldr/include/freeldr.h index d3e8aeae97a..3773c95e6f1 100644 --- a/freeldr/freeldr/include/freeldr.h +++ b/freeldr/freeldr/include/freeldr.h @@ -68,6 +68,7 @@ typedef S64 __s64; extern U32 BootDrive; // BIOS boot drive, 0-A:, 1-B:, 0x80-C:, 0x81-D:, etc. extern U32 BootPartition; // Boot Partition, 1-4 extern BOOL UserInterfaceUp; // Tells us if the user interface is displayed +extern BOOL IsSetupLdr; void BootMain(void); VOID RunLoader(VOID); diff --git a/freeldr/freeldr/include/version.h b/freeldr/freeldr/include/version.h index e2c88fd19b4..d8c66cfd90b 100644 --- a/freeldr/freeldr/include/version.h +++ b/freeldr/freeldr/include/version.h @@ -22,7 +22,7 @@ /* just some stuff */ -#define VERSION "FreeLoader v1.7.7" +#define VERSION "FreeLoader v1.7.8" #define COPYRIGHT "Copyright (C) 1998-2002 Brian Palmer " #define AUTHOR_EMAIL "" #define BY_AUTHOR "by Brian Palmer" @@ -36,7 +36,7 @@ // #define FREELOADER_MAJOR_VERSION 1 #define FREELOADER_MINOR_VERSION 7 -#define FREELOADER_PATCH_VERSION 7 +#define FREELOADER_PATCH_VERSION 8 PUCHAR GetFreeLoaderVersionString(VOID); diff --git a/freeldr/freeldr/reactos/registry.c b/freeldr/freeldr/reactos/registry.c index 96bfc1d5ca1..cc923ab9a0f 100644 --- a/freeldr/freeldr/reactos/registry.c +++ b/freeldr/freeldr/reactos/registry.c @@ -39,6 +39,7 @@ static HKEY RootKey; VOID RegInitializeRegistry(VOID) { + /* Create root key */ RootKey = (HKEY)MmAllocateMemory(sizeof(KEY)); InitializeListHead(&RootKey->SubKeyList); @@ -52,6 +53,16 @@ RegInitializeRegistry(VOID) RootKey->DataType = 0; RootKey->DataSize = 0; RootKey->Data = NULL; + + /* Create SYSTEM key */ + RegCreateKey(RootKey, + "Registry\\Machine\\SYSTEM", + NULL); + + /* Create HARDWARE key */ + RegCreateKey(RootKey, + "Registry\\Machine\\HARDWARE", + NULL); } diff --git a/freeldr/freeldr/reactos/setupldr.c b/freeldr/freeldr/reactos/setupldr.c index d3ad672e6aa..f9df3dcbb06 100644 --- a/freeldr/freeldr/reactos/setupldr.c +++ b/freeldr/freeldr/reactos/setupldr.c @@ -30,6 +30,7 @@ #include "registry.h" #include "hwdetect.h" +BOOL IsSetupLdr = TRUE; static BOOL LoadKernel(PCHAR szFileName) @@ -98,7 +99,6 @@ LoadDriver(PCHAR szFileName) VOID RunLoader(VOID) { - printf("RunLoader() called!\n"); /* Setup multiboot information structure */ mb_info.flags = MB_INFO_FLAG_MEM_SIZE | MB_INFO_FLAG_BOOT_DEVICE | MB_INFO_FLAG_COMMAND_LINE | MB_INFO_FLAG_MODULES; @@ -124,16 +124,16 @@ VOID RunLoader(VOID) #endif } #if 0 - //printf("low_mem = %d\n", mb_info.mem_lower); - //printf("high_mem = %d\n", mb_info.mem_upper); - //getch(); +// printf("low_mem = %d\n", mb_info.mem_lower); +// printf("high_mem = %d\n", mb_info.mem_upper); +// getch(); #endif /* Initialize registry */ RegInitializeRegistry(); /* Detect hardware */ - printf("Detecting hardware..."); + printf("Detecting hardware...\n\n"); DetectHardware(); /* set boot drive and partition */ @@ -142,7 +142,7 @@ VOID RunLoader(VOID) /* Copy ARC path into kernel command line */ sprintf(multiboot_kernel_cmdline, - "multi(0)disk(0)cdrom(%u)\\reactos /DEBUGPORT=SCREEN", + "multi(0)disk(0)cdrom(%u)\\reactos /DEBUGPORT=COM1", (unsigned int)BootDrive); /* Open boot drive */ @@ -162,29 +162,25 @@ VOID RunLoader(VOID) return; - /* - * Export the system and hardware hives - */ -// Base = MultiBootCreateModule(SYSTEM.HIV); -// RegExportHive("\\Registry\\Machine\\SYSTEM", Base, &Size); -// MultiBootCloseModule(Base, Size); + /* Export the system and hardware hives */ +// Base = MultiBootCreateModule(SYSTEM.HIV); +// RegExportHive("\\Registry\\Machine\\SYSTEM", Base, &Size); +// MultiBootCloseModule(Base, Size); -// Base = MultiBootCreateModule(HARDWARE.HIV); -// RegExportHive("\\Registry\\Machine\\HARDWARE", Base, &Size); -// MultiBootCloseModule(Base, Size); +// Base = MultiBootCreateModule(HARDWARE.HIV); +// RegExportHive("\\Registry\\Machine\\HARDWARE", Base, &Size); +// MultiBootCloseModule(Base, Size); - /* - * Load NLS files - */ + /* Load NLS files */ #if 0 - if (!LoadNlsFiles(szBootPath)) - { - MessageBox("Failed to load NLS files\n"); - return; - } + if (!LoadNlsFiles(szBootPath)) + { + MessageBox("Failed to load NLS files\n"); + return; + } #endif