From 7fc762dac1eafee252ff597b544e878179b62b82 Mon Sep 17 00:00:00 2001 From: Brian Palmer Date: Fri, 28 Jun 2002 00:50:16 +0000 Subject: [PATCH] Changes in v1.4 (6/27/2002) - Added separate configuration for a SETUPLDR version svn path=/trunk/; revision=3158 --- freeldr/{ => freeldr}/CHANGELOG | 4 + freeldr/freeldr/Makefile | 32 ++++- freeldr/freeldr/bootmgr.c | 195 +++++++++++++++++++++++++++++ freeldr/freeldr/freeldr.c | 166 +----------------------- freeldr/freeldr/include/bootmgr.h | 29 +++++ freeldr/freeldr/include/reactos.h | 6 + freeldr/freeldr/include/version.h | 6 +- freeldr/freeldr/reactos/setupldr.c | 37 ++++++ 8 files changed, 308 insertions(+), 167 deletions(-) rename freeldr/{ => freeldr}/CHANGELOG (95%) create mode 100644 freeldr/freeldr/bootmgr.c create mode 100644 freeldr/freeldr/include/bootmgr.h create mode 100644 freeldr/freeldr/reactos/setupldr.c diff --git a/freeldr/CHANGELOG b/freeldr/freeldr/CHANGELOG similarity index 95% rename from freeldr/CHANGELOG rename to freeldr/freeldr/CHANGELOG index 57bf86faa4d..e30a71a6b18 100644 --- a/freeldr/CHANGELOG +++ b/freeldr/freeldr/CHANGELOG @@ -1,3 +1,7 @@ +Changes in v1.4 (6/27/2002) + +- Added separate configuration for a SETUPLDR version + Changes in v1.3.1 (6/8/2002) - Implemented MmAllocateMemoryAtAddress() diff --git a/freeldr/freeldr/Makefile b/freeldr/freeldr/Makefile index f77550540e8..56b0817e139 100644 --- a/freeldr/freeldr/Makefile +++ b/freeldr/freeldr/Makefile @@ -69,7 +69,7 @@ MAKETARGET = $(MAKE) --no-print-directory -C $(OUTPUT_DIR) \ -f ../../Makefile SRCDIR=$(CURDIR) $(MAKECMDGOALS) .PHONY: CHANGE_TO_TARGET -CHANGE_TO_TARGET: BUILD_TOOLS $(OBJDIR) $(OBJDIR)/$(TARGET) +CHANGE_TO_TARGET setupldr : BUILD_TOOLS $(OBJDIR) $(OBJDIR)/$(TARGET) @echo Calculating source file dependencies... +@$(MAKETARGET) @@ -118,11 +118,19 @@ COMPILER_OPTIONS = -Wall -nostdlib -nostdinc -fno-builtin -O1 -MD # COMPILER DEFINES # ifeq ($(DEBUG),yes) -COMPILER_DEFINES = -DDEBUG +COMPILER_DEBUG_DEFINES = -DDEBUG else -COMPILER_DEFINES = +COMPILER_DEBUG_DEFINES = endif +ifeq ($(MAKECMDGOALS),setupldr) +COMPILER_SETUPLDR_DEFINES = -D__SETUPLDR__ +else +COMPILER_SETUPLDR_DEFINES = +endif + +COMPILER_DEFINES = -D__$(TARGET)__ $(COMPILER_DEBUG_DEFINES) $(COMPILER_SETUPLDR_DEFINES) + ############################################# # INCLUDE DIRECTORY OPTIONS # @@ -195,7 +203,8 @@ REACTOS_OBJS= reactos.o \ arcname.o \ hwdetect.o \ reghive.o \ - registry.o + registry.o \ + setupldr.o COMM_OBJS = rs232.o \ portio.o @@ -224,6 +233,7 @@ FREELDR_OBJS= freeldr.o \ multiboot.o \ debug.o \ oslist.o \ + bootmgr.o \ version.o ############################################# @@ -275,6 +285,20 @@ freeldr.sys : $(OBJS) ############################################# +setupldr : setupldr.sys + @echo Make SETUPLDR done. + +############################################# + +setupldr.sys : $(OBJS) + @echo ===================================================== LINKING $@ +# @$(LD) -N -Ttext=0x8000 --oformat=binary -s -o setupldr.sys $(OBJS) + @$(LD) $(LFLAGS) -Map setupldr.map -o setupldr.exe $(OBJS) + @$(NM) --numeric-sort setupldr.exe > setupldr.sym + @$(OBJCOPY) -O binary setupldr.exe setupldr.sys + +############################################# + %.o :: %.c @echo ===================================================== Compiling $* @$(CC) $(CFLAGS) -o $@ -c $< diff --git a/freeldr/freeldr/bootmgr.c b/freeldr/freeldr/bootmgr.c new file mode 100644 index 00000000000..99345499437 --- /dev/null +++ b/freeldr/freeldr/bootmgr.c @@ -0,0 +1,195 @@ +/* + * FreeLoader + * Copyright (C) 1998-2002 Brian Palmer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +VOID RunBootManager(VOID) +{ + UCHAR SettingName[80]; + UCHAR SettingValue[80]; + ULONG SectionId; + ULONG OperatingSystemCount; + PUCHAR *OperatingSystemSectionNames; + PUCHAR *OperatingSystemDisplayNames; + ULONG DefaultOperatingSystem; + LONG TimeOut; + ULONG SelectedOperatingSystem; + + if (!IniFileInitialize()) + { + printf("Press any key to reboot.\n"); + getch(); + return; + } + + if (!IniOpenSection("FreeLoader", &SectionId)) + { + printf("Section [FreeLoader] not found in freeldr.ini.\n"); + getch(); + return; + } + + if (!UiInitialize()) + { + printf("Press any key to reboot.\n"); + getch(); + return; + } + + if (!InitOperatingSystemList(&OperatingSystemSectionNames, &OperatingSystemDisplayNames, &OperatingSystemCount)) + { + UiMessageBox("Press ENTER to reboot.\n"); + goto reboot; + } + + if (OperatingSystemCount == 0) + { + UiMessageBox("There were no operating systems listed in freeldr.ini.\nPress ENTER to reboot."); + goto reboot; + } + + DefaultOperatingSystem = GetDefaultOperatingSystem(OperatingSystemSectionNames, OperatingSystemCount); + TimeOut = GetTimeOut(); + + // + // Find all the message box settings and run them + // + UiShowMessageBoxesInSection("FreeLoader"); + + for (;;) + { + // Redraw the backdrop + UiDrawBackdrop(); + + // Show the operating system list menu + if (!UiDisplayMenu(OperatingSystemDisplayNames, OperatingSystemCount, DefaultOperatingSystem, TimeOut, &SelectedOperatingSystem)) + { + UiMessageBox("Press ENTER to reboot.\n"); + goto reboot; + } + TimeOut = -1; + DefaultOperatingSystem = SelectedOperatingSystem; + + // Try to open the operating system section in the .ini file + if (!IniOpenSection(OperatingSystemSectionNames[SelectedOperatingSystem], &SectionId)) + { + sprintf(SettingName, "Section [%s] not found in freeldr.ini.\n", OperatingSystemSectionNames[SelectedOperatingSystem]); + UiMessageBox(SettingName); + continue; + } + + // Try to read the boot type + if (!IniReadSettingByName(SectionId, "BootType", SettingValue, 80)) + { + sprintf(SettingName, "BootType= line not found in section [%s] in freeldr.ini.\n", OperatingSystemSectionNames[SelectedOperatingSystem]); + UiMessageBox(SettingName); + continue; + } + + if (stricmp(SettingValue, "ReactOS") == 0) + { + LoadAndBootReactOS(OperatingSystemSectionNames[SelectedOperatingSystem]); + } + else if (stricmp(SettingValue, "Linux") == 0) + { + LoadAndBootLinux(OperatingSystemSectionNames[SelectedOperatingSystem]); + } + else if (stricmp(SettingValue, "BootSector") == 0) + { + LoadAndBootBootSector(OperatingSystemSectionNames[SelectedOperatingSystem]); + } + else if (stricmp(SettingValue, "Partition") == 0) + { + LoadAndBootPartition(OperatingSystemSectionNames[SelectedOperatingSystem]); + } + else if (stricmp(SettingValue, "Drive") == 0) + { + LoadAndBootDrive(OperatingSystemSectionNames[SelectedOperatingSystem]); + } + } + + +reboot: + VideoClearScreen(); + VideoShowTextCursor(); + return; +} + +ULONG GetDefaultOperatingSystem(PUCHAR OperatingSystemList[], ULONG OperatingSystemCount) +{ + UCHAR DefaultOSText[80]; + ULONG SectionId; + ULONG DefaultOS = 0; + ULONG Idx; + + if (!IniOpenSection("FreeLoader", &SectionId)) + { + return 0; + } + + if (IniReadSettingByName(SectionId, "DefaultOS", DefaultOSText, 80)) + { + for (Idx=0; Idx #include #include +#include // Variable BootDrive moved to asmcode.S //ULONG BootDrive = 0; // BIOS boot drive, 0-A:, 1-B:, 0x80-C:, 0x81-D:, etc. ULONG BootPartition = 0; // Boot Partition, 1-4 -ULONG GetDefaultOperatingSystem(PUCHAR OperatingSystemList[], ULONG OperatingSystemCount); -LONG GetTimeOut(VOID); - VOID BootMain(VOID) { - UCHAR SettingName[80]; - UCHAR SettingValue[80]; - ULONG SectionId; - ULONG OperatingSystemCount; - PUCHAR *OperatingSystemSectionNames; - PUCHAR *OperatingSystemDisplayNames; - ULONG DefaultOperatingSystem; - LONG TimeOut; - ULONG SelectedOperatingSystem; EnableA20(); @@ -63,152 +52,9 @@ VOID BootMain(VOID) return; } - if (!IniFileInitialize()) - { - printf("Press any key to reboot.\n"); - getch(); - return; - } - - if (!IniOpenSection("FreeLoader", &SectionId)) - { - printf("Section [FreeLoader] not found in freeldr.ini.\n"); - getch(); - return; - } - - if (!UiInitialize()) - { - printf("Press any key to reboot.\n"); - getch(); - return; - } - - if (!InitOperatingSystemList(&OperatingSystemSectionNames, &OperatingSystemDisplayNames, &OperatingSystemCount)) - { - UiMessageBox("Press ENTER to reboot.\n"); - goto reboot; - } - - if (OperatingSystemCount == 0) - { - UiMessageBox("There were no operating systems listed in freeldr.ini.\nPress ENTER to reboot."); - goto reboot; - } - - DefaultOperatingSystem = GetDefaultOperatingSystem(OperatingSystemSectionNames, OperatingSystemCount); - TimeOut = GetTimeOut(); - - // - // Find all the message box settings and run them - // - UiShowMessageBoxesInSection("FreeLoader"); - - for (;;) - { - // Redraw the backdrop - UiDrawBackdrop(); - - // Show the operating system list menu - if (!UiDisplayMenu(OperatingSystemDisplayNames, OperatingSystemCount, DefaultOperatingSystem, TimeOut, &SelectedOperatingSystem)) - { - UiMessageBox("Press ENTER to reboot.\n"); - goto reboot; - } - TimeOut = -1; - DefaultOperatingSystem = SelectedOperatingSystem; - - // Try to open the operating system section in the .ini file - if (!IniOpenSection(OperatingSystemSectionNames[SelectedOperatingSystem], &SectionId)) - { - sprintf(SettingName, "Section [%s] not found in freeldr.ini.\n", OperatingSystemSectionNames[SelectedOperatingSystem]); - UiMessageBox(SettingName); - continue; - } - - // Try to read the boot type - if (!IniReadSettingByName(SectionId, "BootType", SettingValue, 80)) - { - sprintf(SettingName, "BootType= line not found in section [%s] in freeldr.ini.\n", OperatingSystemSectionNames[SelectedOperatingSystem]); - UiMessageBox(SettingName); - continue; - } - - if (stricmp(SettingValue, "ReactOS") == 0) - { - LoadAndBootReactOS(OperatingSystemSectionNames[SelectedOperatingSystem]); - } - else if (stricmp(SettingValue, "Linux") == 0) - { - LoadAndBootLinux(OperatingSystemSectionNames[SelectedOperatingSystem]); - } - else if (stricmp(SettingValue, "BootSector") == 0) - { - LoadAndBootBootSector(OperatingSystemSectionNames[SelectedOperatingSystem]); - } - else if (stricmp(SettingValue, "Partition") == 0) - { - LoadAndBootPartition(OperatingSystemSectionNames[SelectedOperatingSystem]); - } - else if (stricmp(SettingValue, "Drive") == 0) - { - LoadAndBootDrive(OperatingSystemSectionNames[SelectedOperatingSystem]); - } - } - - -reboot: - VideoClearScreen(); - VideoShowTextCursor(); - return; -} - -ULONG GetDefaultOperatingSystem(PUCHAR OperatingSystemList[], ULONG OperatingSystemCount) -{ - UCHAR DefaultOSText[80]; - ULONG SectionId; - ULONG DefaultOS = 0; - ULONG Idx; - - if (!IniOpenSection("FreeLoader", &SectionId)) - { - return 0; - } - - if (IniReadSettingByName(SectionId, "DefaultOS", DefaultOSText, 80)) - { - for (Idx=0; Idx + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __BOOTMGR_H +#define __BOOTMGR_H + + +VOID RunBootManager(VOID); +ULONG GetDefaultOperatingSystem(PUCHAR OperatingSystemList[], ULONG OperatingSystemCount); +LONG GetTimeOut(VOID); + + +#endif // #defined __BOOTMGR_H diff --git a/freeldr/freeldr/include/reactos.h b/freeldr/freeldr/include/reactos.h index dd39618474f..60ce41e6644 100644 --- a/freeldr/freeldr/include/reactos.h +++ b/freeldr/freeldr/include/reactos.h @@ -28,6 +28,12 @@ /////////////////////////////////////////////////////////////////////////////////////// void LoadAndBootReactOS(PUCHAR OperatingSystemName); +/////////////////////////////////////////////////////////////////////////////////////// +// +// ReactOS Setup Loader Functions +// +/////////////////////////////////////////////////////////////////////////////////////// +VOID ReactOSRunSetupLoader(VOID); /////////////////////////////////////////////////////////////////////////////////////// // diff --git a/freeldr/freeldr/include/version.h b/freeldr/freeldr/include/version.h index f12ced86ab8..2cdd7070ebd 100644 --- a/freeldr/freeldr/include/version.h +++ b/freeldr/freeldr/include/version.h @@ -22,7 +22,7 @@ /* just some stuff */ -#define VERSION "FreeLoader v1.3.1" +#define VERSION "FreeLoader v1.4" #define COPYRIGHT "Copyright (C) 1998-2002 Brian Palmer " #define AUTHOR_EMAIL "" #define BY_AUTHOR "by Brian Palmer" @@ -35,8 +35,8 @@ // If you add major functionality then you increment the major version and zero the minor & patch versions // #define FREELOADER_MAJOR_VERSION 1 -#define FREELOADER_MINOR_VERSION 3 -#define FREELOADER_PATCH_VERSION 1 +#define FREELOADER_MINOR_VERSION 4 +#define FREELOADER_PATCH_VERSION 0 PUCHAR GetFreeLoaderVersionString(VOID); diff --git a/freeldr/freeldr/reactos/setupldr.c b/freeldr/freeldr/reactos/setupldr.c new file mode 100644 index 00000000000..b3df3e7f4c9 --- /dev/null +++ b/freeldr/freeldr/reactos/setupldr.c @@ -0,0 +1,37 @@ +/* + * FreeLoader + * + * Copyright (C) 1998-2002 Brian Palmer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "registry.h" +#include "hwdetect.h" + +VOID ReactOSRunSetupLoader(VOID) +{ +}