Chameleon

Chameleon Commit Details

Date:2010-10-12 04:07:55 (8 years 5 days ago)
Author:Azimutz
Commit:591
Parents: 590
Message:Simplify md0 ramdisk user override; just pass full path. Change /Extra to bt(0,0)/Extra.
Changes:
M/branches/azimutz/Chazi/i386/boot2/ramdisk.c

File differences

branches/azimutz/Chazi/i386/boot2/ramdisk.c
2525
2626
2727
28
28
2929
3030
3131
3232
3333
34
34
3535
36
36
3737
3838
39
39
4040
41
41
4242
4343
4444
45
46
47
48
49
50
51
52
53
54
55
56
5745
5846
5947
6048
6149
6250
63
51
6452
6553
66
54
6755
6856
6957
7058
7159
7260
73
61
7462
7563
7664
......
9078
9179
9280
93
9481
9582
9683
......
245232
246233
247234
248
249235
250236
251237
int fh = -1;
int len;
if(getValueForKey(kMD0ImageKey, &override_filename, &len, &bootInfo->bootConfig))
if (getValueForKey(kMD0ImageKey, &override_filename, &len, &bootInfo->bootConfig))
{
// Use user specified md0 file
sprintf(filename, "%s", override_filename);
fh = open(filename, 0);
if(fh < 0)
if (fh < 0)
{
sprintf(filename, "rd(0,0)/Extra/%s", override_filename);
sprintf(filename, "rd(0,0)/Extra/Postboot.img");
fh = open(filename, 0);
if(fh < 0)
if (fh < 0)
{
sprintf(filename, "/Extra/%s", override_filename);
sprintf(filename, "bt(0,0)/Extra/Postboot.img");// Check /Extra if not in rd(0,0)
fh = open(filename, 0);
}
}
}
if(fh < 0)
{
sprintf(filename, "rd(0,0)/Extra/Postboot.img");
fh = open(filename, 0);
if(fh < 0)
{
sprintf(filename, "/Extra/Postboot.img");// Check /Extra if not in rd(0,0)
fh = open(filename, 0);
}
}
if (fh >= 0)
{
verbose("Enabling ramdisk %s\n", filename);
ramdiskPtr.size = file_size(fh);
ramdiskPtr.size = file_size(fh);
ramdiskPtr.base = AllocateKernelMemory(ramdiskPtr.size);
if(ramdiskPtr.size && ramdiskPtr.base)
if (ramdiskPtr.size && ramdiskPtr.base)
{
// Read new ramdisk image contents in kernel memory.
if (read(fh, (char*) ramdiskPtr.base, ramdiskPtr.size) == ramdiskPtr.size)
{
AllocateMemoryRange("RAMDisk", ramdiskPtr.base, ramdiskPtr.size, kBootDriverTypeInvalid);
Node* node = DT__FindNode("/chosen/memory-map", false);
if(node != NULL)
if (node != NULL)
{
DT__AddProperty(node, "RAMDisk", sizeof(RAMDiskParam), (void*)&ramdiskPtr);
}
}
close(fh);
}
}
int loadPrebootRAMDisk()
{
mountRAMDisk("bt(0,0)/Extra/Preboot.dmg");
// change md0 to be handled with the menu below??
if (gRAMDiskMI != NULL)
{

Archive Download the corresponding diff file

Revision: 591