[ros-diffs] [evb] 45405: - Add support for ram disk offset (.IMG file is a RAW image, partition starts later...) - Fix ram disk support in FreeLDR, ARC changes had broken support for booting FreeLDR (not just the Windows) from a ram disk. ARM port now initializes ramdisk as an FS device. - Fix hardcoded DISKREADBUFFER and FILESYSBUFFER values. On ARM these will be dynamically selected for each board (need to improve this through LLB). - Now FreeLDR.ini is read, and crash happens because UI routines are all NULL.

evb at svn.reactos.org evb at svn.reactos.org
Thu Feb 4 02:24:45 CET 2010


Author: evb
Date: Thu Feb  4 02:24:45 2010
New Revision: 45405

URL: http://svn.reactos.org/svn/reactos?rev=45405&view=rev
Log:
- Add support for ram disk offset (.IMG file is a RAW image, partition starts later...)
- Fix ram disk support in FreeLDR, ARC changes had broken support for booting FreeLDR (not just the Windows) from a ram disk. ARM port now initializes ramdisk as an FS device.
- Fix hardcoded DISKREADBUFFER and FILESYSBUFFER values. On ARM these will be dynamically selected for each board (need to improve this through LLB).
- Now FreeLDR.ini is read, and crash happens because UI routines are all NULL.


Modified:
    trunk/reactos/boot/armllb/hw/versatile/hwinit.c
    trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c
    trunk/reactos/boot/freeldr/freeldr/cmdline.c
    trunk/reactos/boot/freeldr/freeldr/disk/ramdisk.c
    trunk/reactos/boot/freeldr/freeldr/include/arch.h
    trunk/reactos/boot/freeldr/freeldr/include/ramdisk.h

Modified: trunk/reactos/boot/armllb/hw/versatile/hwinit.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/armllb/hw/versatile/hwinit.c?rev=45405&r1=45404&r2=45405&view=diff
==============================================================================
--- trunk/reactos/boot/armllb/hw/versatile/hwinit.c [iso-8859-1] (original)
+++ trunk/reactos/boot/armllb/hw/versatile/hwinit.c [iso-8859-1] Thu Feb  4 02:24:45 2010
@@ -40,9 +40,9 @@
     
     /* The OS loader is next, followed by the root file system */
     RootFs = Base + 0x80000; // 512 KB (see nandflash)
-    
+        
     /* Set parameters for the OS loader */
-    sprintf(CommandLine, "rdbase=0x%x rdsize=0x%x", RootFs, Size);
+    sprintf(CommandLine, "rdbase=0x%x rdsize=0x%x rdoffset=%d", RootFs, Size, 32256);
     LlbSetCommandLine(CommandLine);
     
     /* Return the OS loader base address */

Modified: trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c?rev=45405&r1=45404&r2=45405&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c [iso-8859-1] Thu Feb  4 02:24:45 2010
@@ -20,6 +20,7 @@
 VOID ArmPrepareForReactOS(IN BOOLEAN Setup);
 ADDRESS_RANGE ArmBoardMemoryMap[16];
 ULONG ArmBoardMemoryMapRangeCount;
+ULONG gDiskReadBuffer, gFileSysBuffer;
 
 /* FUNCTIONS ******************************************************************/
 
@@ -69,25 +70,26 @@
 }
 
 BOOLEAN
-ArmDiskGetDriveGeometry(IN ULONG DriveNumber,
-                        OUT PGEOMETRY Geometry)
+ArmDiskNormalizeSystemPath(IN OUT PCHAR SystemPath,
+                           IN unsigned Size)
 {
-    return FALSE;
+    TuiPrintf("Called: %s\n", SystemPath);
+    while (TRUE);
+    return TRUE;
 }
 
 BOOLEAN
-ArmDiskReadLogicalSectors(IN ULONG DriveNumber,
-                          IN ULONGLONG SectorNumber,
-                          IN ULONG SectorCount,
-                          IN PVOID Buffer)
+ArmDiskGetBootPath(OUT PCHAR BootPath,
+                   IN unsigned Size)
 {
-    return FALSE;
-}
-
-ULONG
-ArmDiskGetCacheableBlockCount(IN ULONG DriveNumber)
-{
-    return 0;
+    PCCH Path = "ramdisk(0)";
+    
+    /* Make sure enough space exists */
+    if (Size < sizeof(Path)) return FALSE;
+    
+    /* On ARM platforms, the loader is always in RAM */
+    strcpy(BootPath, Path);
+    return TRUE;
 }
 
 PCONFIGURATION_COMPONENT_DATA
@@ -106,6 +108,11 @@
     // The boot loader will send us a device tree, similar to ACPI
     // or OpenFirmware device trees, and we will convert it to ARC.
     //
+    
+    //
+    // Register RAMDISK Device
+    //
+    RamDiskInitialize();
     
     //
     // Return the root node
@@ -138,6 +145,8 @@
         // Check for Feroceon-base boards
         //
         case MACH_TYPE_FEROCEON:
+            TuiPrintf("Not implemented\n");
+            while (TRUE);
             break;
             
         //
@@ -149,6 +158,10 @@
             MachVtbl.ConsPutChar = ArmBoardBlock->ConsPutChar;
             MachVtbl.ConsKbHit = ArmBoardBlock->ConsKbHit;
             MachVtbl.ConsGetCh = ArmBoardBlock->ConsGetCh;
+            
+            /* Setup the disk and file system buffers */
+            gDiskReadBuffer = 0x00090000;
+            gFileSysBuffer = 0x00090000;
             break;
             
         //
@@ -156,6 +169,8 @@
         // For now that means only Beagle, but ZOOM and others should be ok too
         //
         case MACH_TYPE_OMAP3_BEAGLE:
+            TuiPrintf("Not implemented\n");
+            while (TRUE);
             break;
             
         default:
@@ -172,15 +187,8 @@
     //
     // Setup disk I/O routines
     //
-    MachVtbl.DiskReadLogicalSectors = ArmDiskReadLogicalSectors;
-    MachVtbl.DiskGetDriveGeometry = ArmDiskGetDriveGeometry;
-    MachVtbl.DiskGetCacheableBlockCount = ArmDiskGetCacheableBlockCount;
-    
-    //
-    // Now set default disk handling routines -- we don't need to override
-    //
-    MachVtbl.DiskGetBootPath = DiskGetBootPath;
-    MachVtbl.DiskNormalizeSystemPath = DiskNormalizeSystemPath;
+    MachVtbl.DiskGetBootPath = ArmDiskGetBootPath;
+    MachVtbl.DiskNormalizeSystemPath = ArmDiskNormalizeSystemPath;
     
     //
     // We can now print to the console

Modified: trunk/reactos/boot/freeldr/freeldr/cmdline.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/cmdline.c?rev=45405&r1=45404&r2=45405&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/cmdline.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/cmdline.c [iso-8859-1] Thu Feb  4 02:24:45 2010
@@ -21,7 +21,7 @@
 CmdLineParse(IN PCHAR CmdLine)
 {
     PCHAR End, Setting;
-    ULONG Length;
+    ULONG Length, Offset = 0;
 
     //
     // Set defaults
@@ -76,6 +76,21 @@
                                         sizeof(ANSI_NULL),
                                         NULL,
                                         0);
+
+    //
+    // Get ramdisk offset
+    //
+    Setting = strstr(CmdLine, "rdoffset=");
+    if (Setting) Offset = strtoul(Setting +
+                                  sizeof("rdoffset=") -
+                                  sizeof(ANSI_NULL),
+                                  NULL,
+                                  0);
+
+    //
+    // Fix it up
+    //
+    gRamDiskBase = (PVOID)((ULONG_PTR)gRamDiskBase + Offset);
 }
 
 PCCH

Modified: trunk/reactos/boot/freeldr/freeldr/disk/ramdisk.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/disk/ramdisk.c?rev=45405&r1=45404&r2=45405&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/disk/ramdisk.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/disk/ramdisk.c [iso-8859-1] Thu Feb  4 02:24:45 2010
@@ -107,6 +107,14 @@
     RamDiskRead,
     RamDiskSeek,
 };
+
+VOID
+NTAPI
+RamDiskInitialize(VOID)
+{
+    /* Setup the RAMDISK device */
+    FsRegisterDevice("ramdisk(0)", &RamDiskVtbl);
+}
 
 VOID
 NTAPI

Modified: trunk/reactos/boot/freeldr/freeldr/include/arch.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/include/arch.h?rev=45405&r1=45404&r2=45405&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/arch.h [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/include/arch.h [iso-8859-1] Thu Feb  4 02:24:45 2010
@@ -47,9 +47,13 @@
 #define FILESYSBUFFER		0x80000	/* Buffer to store file system data (e.g. cluster buffer for FAT) */
 #define DISKREADBUFFER		0x90000	/* Buffer to store data read in from the disk via the BIOS */
 #define DISKREADBUFFER_SIZE 512
-#elif defined(_M_PPC) || defined(_M_MIPS) || defined(_M_ARM)
+#elif defined(_M_PPC) || defined(_M_MIPS)
 #define DISKREADBUFFER		    0x80000000
 #define FILESYSBUFFER           0x80000000
+#elif defined(_M_ARM)
+extern ULONG gDiskReadBuffer, gFileSysBuffer;
+#define DISKREADBUFFER gDiskReadBuffer
+#define FILESYSBUFFER  gFileSysBuffer
 #endif
 
 /* Makes "x" a global variable or label */

Modified: trunk/reactos/boot/freeldr/freeldr/include/ramdisk.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/include/ramdisk.h?rev=45405&r1=45404&r2=45405&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/ramdisk.h [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/include/ramdisk.h [iso-8859-1] Thu Feb  4 02:24:45 2010
@@ -18,6 +18,12 @@
     IN PCHAR FileName
 );
 
+VOID
+NTAPI
+RamDiskInitialize(
+    VOID
+);
+
 extern PVOID gRamDiskBase;
 extern ULONG gRamDiskSize;
 




More information about the Ros-diffs mailing list