diff --git a/reactos/boot/freeldr/freeldr/arch/arm/stubs.c b/reactos/boot/freeldr/freeldr/arch/arm/stubs.c index 37aa9daf6e2..c2f64a1845c 100644 --- a/reactos/boot/freeldr/freeldr/arch/arm/stubs.c +++ b/reactos/boot/freeldr/freeldr/arch/arm/stubs.c @@ -30,8 +30,16 @@ ArmDiskGetBootVolume(IN PULONG DriveNumber, IN PULONGLONG SectorCount, OUT PINT FsType) { - while (TRUE); - return FALSE; + // + // We only support RAM disk for now -- add support for NAND later + // + ASSERT(gRamDiskBase); + ASSERT(gRamDiskSize); + *DriveNumber = 0x49; + *StartSector = 0; + *SectorCount = gRamDiskSize * 512; + *FsType = FS_FAT; + return TRUE; } VOID @@ -183,4 +191,5 @@ MachInit(IN PCCH CommandLine) // We can now print to the console // TuiPrintf("%s for ARM\n", GetFreeLoaderVersionString()); + TuiPrintf("Bootargs: %s\n", CommandLine); } diff --git a/reactos/boot/freeldr/freeldr/cmdline.c b/reactos/boot/freeldr/freeldr/cmdline.c index 6f0dd6d1629..9a5e4597ea5 100644 --- a/reactos/boot/freeldr/freeldr/cmdline.c +++ b/reactos/boot/freeldr/freeldr/cmdline.c @@ -1,120 +1,91 @@ -/* $Id$ - * - * FreeLoader - * Copyright (C) 1998-2003 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. +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: GPL - See COPYING in the top level directory + * FILE: boot/freeldr/cmdline.c + * PURPOSE: FreeLDR Command Line Parsing + * PROGRAMMERS: ReactOS Portable Systems Group */ +/* INCLUDES *******************************************************************/ + #include -static CMDLINEINFO CmdLineInfo; +/* GLOBALS ********************************************************************/ -static char * -SkipWhitespace(char *s) +CCHAR DefaultOs[256]; +CMDLINEINFO CmdLineInfo; + +/* FUNCTIONS ******************************************************************/ + +VOID +CmdLineParse(IN PCHAR CmdLine) { - while ('\0' != *s && isspace(*s)) - { - s++; - } + PCHAR End, Setting; + ULONG Length; - return s; + // + // Set defaults + // + CmdLineInfo.DefaultOperatingSystem = NULL; + CmdLineInfo.TimeOut = -1; + + // + // Get timeout + // + Setting = strstr(CmdLine, "timeout="); + if (Setting) CmdLineInfo.TimeOut = atoi(Setting + + sizeof("timeout=") + + sizeof(ANSI_NULL)); + + // + // Get default OS + // + Setting = strstr(CmdLine, "defaultos="); + if (Setting) + { + // + // Check if there's more command-line parameters following + // + Setting += sizeof("defaultos=") + sizeof(ANSI_NULL); + End = strstr(Setting, " "); + if (End) Length = End - Setting; else Length = sizeof(DefaultOs); + + // + // Copy the default OS + // + strncpy(DefaultOs, Setting, Length); + CmdLineInfo.DefaultOperatingSystem = DefaultOs; + } + + // + // Get ramdisk base address + // + Setting = strstr(CmdLine, "rdbase="); + if (Setting) gRamDiskBase = (PVOID)strtoul(Setting + + sizeof("rdbase=") - + sizeof(ANSI_NULL), + NULL, + 0); + + // + // Get ramdisk size + // + Setting = strstr(CmdLine, "rdsize="); + if (Setting) gRamDiskSize = strtoul(Setting + + sizeof("rdsize=") - + sizeof(ANSI_NULL), + NULL, + 0); } -void -CmdLineParse(char *CmdLine) +PCCH +CmdLineGetDefaultOS(VOID) { - char *s; - char *Name; - char *Value; - char *End; - - CmdLineInfo.DefaultOperatingSystem = NULL; - CmdLineInfo.TimeOut = -1; - - if (NULL == CmdLine) - { - return; - } - - /* Skip over "kernel name" */ - s = CmdLine; - while ('\0' != *s && ! isspace(*s)) - { - s++; - } - s = SkipWhitespace(s); - - while ('\0' != *s) - { - Name = s; - while (! isspace(*s) && '=' != *s && '\0' != *s) - { - s++; - } - End = s; - s = SkipWhitespace(s); - if ('=' == *s) - { - s++; - *End = '\0'; - s = SkipWhitespace(s); - if ('"' == *s) - { - s++; - Value = s; - while ('"' != *s && '\0' != *s) - { - s++; - } - } - else - { - Value = s; - while (! isspace(*s) && '\0' != *s) - { - s++; - } - } - if ('\0' != *s) - { - *s++ = '\0'; - } - if (0 == _stricmp(Name, "defaultos")) - { - CmdLineInfo.DefaultOperatingSystem = Value; - } - else if (0 == _stricmp(Name, "timeout")) - { - CmdLineInfo.TimeOut = atoi(Value); - } - } - } -} - -const char * -CmdLineGetDefaultOS(void) -{ - return CmdLineInfo.DefaultOperatingSystem; + return CmdLineInfo.DefaultOperatingSystem; } LONG -CmdLineGetTimeOut(void) +CmdLineGetTimeOut(VOID) { - return CmdLineInfo.TimeOut; + return CmdLineInfo.TimeOut; } - -/* EOF */ - diff --git a/reactos/boot/freeldr/freeldr/disk/ramdisk.c b/reactos/boot/freeldr/freeldr/disk/ramdisk.c index fa1fcd26157..3dddb5a92bf 100644 --- a/reactos/boot/freeldr/freeldr/disk/ramdisk.c +++ b/reactos/boot/freeldr/freeldr/disk/ramdisk.c @@ -163,18 +163,3 @@ RamDiskSwitchFromBios(VOID) gCacheEnabled = FALSE; } } - -VOID -NTAPI -RamDiskInit(IN PCHAR CmdLine) -{ - PCHAR Setting; - - // - // Get RAM disk parameters - // - Setting = strstr(CmdLine, "rdbase="); - if (Setting) gRamDiskBase = (PVOID)atoi(Setting); - Setting = strstr(CmdLine, "rdsize="); - if (Setting) gRamDiskSize = atoi(Setting); -} diff --git a/reactos/boot/freeldr/freeldr/freeldr.c b/reactos/boot/freeldr/freeldr/freeldr.c index 2af6cc19c89..278e31af93b 100644 --- a/reactos/boot/freeldr/freeldr/freeldr.c +++ b/reactos/boot/freeldr/freeldr/freeldr.c @@ -26,8 +26,6 @@ VOID BootMain(LPSTR CmdLine) MachInit(CmdLine); - RamDiskInit(CmdLine); - DebugInit(); DbgPrint((DPRINT_WARNING, "BootMain() called.\n")); diff --git a/reactos/boot/freeldr/freeldr/include/ramdisk.h b/reactos/boot/freeldr/freeldr/include/ramdisk.h index 12d1b356bec..d1e69aabcc5 100644 --- a/reactos/boot/freeldr/freeldr/include/ramdisk.h +++ b/reactos/boot/freeldr/freeldr/include/ramdisk.h @@ -12,12 +12,6 @@ // // Ramdisk Routines // -VOID -NTAPI -RamDiskInit( - IN PCHAR CmdLine -); - VOID NTAPI RamDiskSwitchFromBios( @@ -30,4 +24,7 @@ RamDiskCheckForVirtualFile( VOID ); +extern PVOID gRamDiskBase; +extern ULONG gRamDiskSize; + #endif