Author: evb
Date: Thu Feb 4 20:49:25 2010
New Revision: 45423
URL:
http://svn.reactos.org/svn/reactos?rev=45423&view=rev
Log:
- Change NANDFlash again for Versatile support. Now the LLB and OS Loader are created in
one binary blob (loaded with -kernel), while the RAMDISK is loaded with -initrd.
- Now the only complication is that RAMDISK loaded at 0x80000 which will conflict with the
0x800000 range where kernel loads. Could move RAMDISK in code through LLB, but that would
be very expensive (shift by 16MB up). Instead, NANDflash creates ramdisk image starting at
offset 16MB. This way, emulator thinks it's loading at 0x80000, but actually loads at
0x1800000. Would be better if QEMU not hardcoded the INITRD_LOAD_ADDR...
Modified:
trunk/reactos/tools/nandflash/main.c
Modified: trunk/reactos/tools/nandflash/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/nandflash/main.c?rev…
==============================================================================
--- trunk/reactos/tools/nandflash/main.c [iso-8859-1] (original)
+++ trunk/reactos/tools/nandflash/main.c [iso-8859-1] Thu Feb 4 20:49:25 2010
@@ -16,7 +16,8 @@
PCHAR NandImageName = "reactos.bin";
PCHAR LlbImageName = "./output-arm/boot/armllb/armllb.bin";
PCHAR BootLdrImageName = "./output-arm/boot/freeldr/freeldr/freeldr.sys";
-PCHAR FsImageName = "ReactOS.img";
+PCHAR FsImageName = "ramdisk.img";
+PCHAR RamImageName = "ramdisk.bin";
/* NAND On-Disk Memory Map */
ULONG LlbStart = 0x00000000, LlbEnd = 0x00010000; // 64 KB
@@ -135,11 +136,23 @@
close(FileDescriptor);
}
+VOID
+NTAPI
+WriteRamDisk(IN INT RamDiskFile)
+{
+ INT FileDescriptor;
+
+ /* Open FS image and write it 16MB later */
+ FileDescriptor = open(FsImageName, O_RDWR);
+ WriteToFlash(RamDiskFile, FileDescriptor, 16 * 1024 * 1024, (32 + 16) * 1024 *
1024);
+ close(FileDescriptor);
+}
+
int
main(ULONG argc,
char **argv)
{
- INT NandImageFile;
+ INT NandImageFile, RamDiskFile;
/* Flat NAND, no OOB */
if (argc == 2) NeedsOob = FALSE;
@@ -151,7 +164,24 @@
/* Write components */
WriteLlb(NandImageFile);
WriteBootLdr(NandImageFile);
- WriteFileSystem(NandImageFile);
+ if (NeedsOob)
+ {
+ /* Write the ramdisk normaly */
+ WriteFileSystem(NandImageFile);
+ }
+ else
+ {
+ /* Open a new file for the ramdisk */
+ RamDiskFile = open(RamImageName, O_RDWR | O_CREAT);
+ if (!RamDiskFile) exit(-1);
+
+ /* Write it */
+ WriteRamDisk(RamDiskFile);
+
+ /* Close */
+ close(RamDiskFile);
+ }
+
/* Close and return */
close(NandImageFile);