Author: ros-arm-bringup
Date: Wed Feb 6 23:38:59 2008
New Revision: 32170
URL: http://svn.reactos.org/svn/reactos?rev=32170&view=rev
Log:
We now report the correct sector start for the ramdisk -- the actual volume boot sector is at 0x63, not 0x00 which is the MBR.
FreeLDR now reads freeldr.ini correctly and continues all the way to hardware detection (ArmHwDetect)
Modified:
trunk/reactos/boot/freeldr/freeldr/arch/arm/stubs.c
trunk/reactos/boot/freeldr/freeldr/ui/noui.c
Modified: trunk/reactos/boot/freeldr/freeldr/arch/arm/stubs.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/arm/stubs.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/arm/stubs.c Wed Feb 6 23:38:59 2008
@@ -40,7 +40,7 @@
// Use magic ramdisk drive number and count the number of 512-byte sectors
//
*DriveNumber = 0x49;
- *StartSector = 0;
+ *StartSector = 63;
*SectorCount = gRamDiskSize * 512;
//
Modified: trunk/reactos/boot/freeldr/freeldr/ui/noui.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/ui/no…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/ui/noui.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/ui/noui.c Wed Feb 6 23:38:59 2008
@@ -43,6 +43,7 @@
VOID NoUiDrawStatusText(PCSTR StatusText)
{
+ printf("%s\n", StatusText);
}
VOID NoUiUpdateDateTime(VOID)
Author: ros-arm-bringup
Date: Wed Feb 6 22:15:46 2008
New Revision: 32169
URL: http://svn.reactos.org/svn/reactos?rev=32169&view=rev
Log:
We now enable ramdisk support by calling RamDiskSwitchFromBios() to allow the ramdisk routines to take control of disk r/w.
Unlike the x86 virtual-ramdisk, the ramdisk here is also used as boot device, not only system device.
Current FreeLDR output:
Booting FreeLDR...
FreeLoader v3.0 for ARM
Bootargs: rdbase=0x2000000 rdsize=0x1400000
This file system has cluster sizes bigger than 64k.
FreeLoader does not support this.
Press any key
Modified:
trunk/reactos/boot/freeldr/freeldr/arch/arm/stubs.c
Modified: trunk/reactos/boot/freeldr/freeldr/arch/arm/stubs.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/arm/stubs.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/arm/stubs.c Wed Feb 6 22:15:46 2008
@@ -35,10 +35,23 @@
//
ASSERT(gRamDiskBase);
ASSERT(gRamDiskSize);
+
+ //
+ // Use magic ramdisk drive number and count the number of 512-byte sectors
+ //
*DriveNumber = 0x49;
*StartSector = 0;
*SectorCount = gRamDiskSize * 512;
+
+ //
+ // Ramdisk support is FAT-only for now
+ //
*FsType = FS_FAT;
+
+ //
+ // Now that ramdisk is enabled, use ramdisk routines
+ //
+ RamDiskSwitchFromBios();
return TRUE;
}
@@ -88,7 +101,7 @@
ArmDiskGetDriveGeometry(IN ULONG DriveNumber,
OUT PGEOMETRY Geometry)
{
- while (TRUE);
+ ASSERT(FALSE);
return FALSE;
}
@@ -107,14 +120,14 @@
IN ULONG SectorCount,
IN PVOID Buffer)
{
- while (TRUE);
+ ASSERT(FALSE);
return FALSE;
}
ULONG
ArmDiskGetCacheableBlockCount(IN ULONG DriveNumber)
{
- while (TRUE);
+ ASSERT(FALSE);
return FALSE;
}
Author: ros-arm-bringup
Date: Wed Feb 6 21:27:53 2008
New Revision: 32164
URL: http://svn.reactos.org/svn/reactos?rev=32164&view=rev
Log:
We now support ArmDiskGetBootVolume for ramdisk only, later revisions will support NAND boot as well.
The ramdisk parameter parsing had several bugs which were fixed, including support for hex parameters and using proper return values from strstr.
We also rewrote command line parsing to be much simpler. It was very broken, modifying the memory contents of the command line -- this wouldn't work on systems where the command line is stored in ROM unless a copy is first made. It also broke ram disk parameters by modifying whitespaces to NULL chars for purposes of reading its own parameters, but did not put the whitespace back, terminating the command line early.
Finally, we now have an integrated ramdisk parameter parsing with the new command line code.
Modified:
trunk/reactos/boot/freeldr/freeldr/arch/arm/stubs.c
trunk/reactos/boot/freeldr/freeldr/cmdline.c
trunk/reactos/boot/freeldr/freeldr/disk/ramdisk.c
trunk/reactos/boot/freeldr/freeldr/freeldr.c
trunk/reactos/boot/freeldr/freeldr/include/ramdisk.h
Modified: trunk/reactos/boot/freeldr/freeldr/arch/arm/stubs.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/arm/stubs.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/arm/stubs.c Wed Feb 6 21:27:53 2008
@@ -30,8 +30,16 @@
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 @@
// We can now print to the console
//
TuiPrintf("%s for ARM\n", GetFreeLoaderVersionString());
+ TuiPrintf("Bootargs: %s\n", CommandLine);
}
Modified: trunk/reactos/boot/freeldr/freeldr/cmdline.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/cmdli…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/cmdline.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/cmdline.c Wed Feb 6 21:27:53 2008
@@ -1,120 +1,91 @@
-/* $Id$
- *
- * FreeLoader
- * Copyright (C) 1998-2003 Brian Palmer <brianp(a)sginet.com>
- *
- * 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 <freeldr.h>
-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))
+ PCHAR End, Setting;
+ ULONG Length;
+
+ //
+ // 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)
{
- s++;
+ //
+ // 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;
}
-
- return s;
+
+ //
+ // 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 */
-
Modified: trunk/reactos/boot/freeldr/freeldr/disk/ramdisk.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/disk/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/disk/ramdisk.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/disk/ramdisk.c Wed Feb 6 21:27:53 2008
@@ -163,18 +163,3 @@
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);
-}
Modified: trunk/reactos/boot/freeldr/freeldr/freeldr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/freel…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/freeldr.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/freeldr.c Wed Feb 6 21:27:53 2008
@@ -26,8 +26,6 @@
MachInit(CmdLine);
- RamDiskInit(CmdLine);
-
DebugInit();
DbgPrint((DPRINT_WARNING, "BootMain() called.\n"));
Modified: trunk/reactos/boot/freeldr/freeldr/include/ramdisk.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/ramdisk.h (original)
+++ trunk/reactos/boot/freeldr/freeldr/include/ramdisk.h Wed Feb 6 21:27:53 2008
@@ -14,12 +14,6 @@
//
VOID
NTAPI
-RamDiskInit(
- IN PCHAR CmdLine
-);
-
-VOID
-NTAPI
RamDiskSwitchFromBios(
VOID
);
@@ -30,4 +24,7 @@
VOID
);
+extern PVOID gRamDiskBase;
+extern ULONG gRamDiskSize;
+
#endif