Chameleon

Chameleon Commit Details

Date:2010-07-26 01:12:35 (4 years 1 month ago)
Author:Evan Lojewski
Commit:251
Parents: 250
Message:Make md0 image user selectable. Falls back to Postboot.img
Changes:
M/branches/meklort/i386/boot2/boot.h
M/branches/meklort/i386/boot2/ramdisk.c

File differences

branches/meklort/i386/boot2/boot.h
9494
9595
9696
97
9798
9899
99100
#define kRecoveryFolder"RecoveryFolder"/* drivers.h */
#define kMD0Image"md0"/* ramdisk.h */
/*
* Flags to the booter or kernel
branches/meklort/i386/boot2/ramdisk.c
2121
2222
2323
24
25
24
25
26
27
2628
27
28
29
29
30
3031
31
32
33
3234
33
35
36
37
38
39
40
41
42
43
44
45
3446
3547
3648
37
49
3850
51
52
53
54
55
56
57
58
59
60
61
62
63
3964
4065
4166
......
6085
6186
6287
63
88
6489
6590
6691
67
92
6893
6994
7095
7196
7297
7398
74
75
76
7799
78100
79101
void md0Ramdisk()
{
RAMDiskParam ramdiskPtr;
char* filename = 0;
int fh = 0;
char filename[512];
const char* override_filename = 0;
int fh = -1;
int len;
// Look for a ramdisk at Postboot.img (TODO: make configurable)
filename = "rd(0,0)/Extra/Postboot.img";
if((fh = open(filename, 0)) == -1)
if(getValueForKey(kMD0Image, &override_filename, &len,
&bootInfo->bootConfig))
{
filename = "/Extra/Postboot.img";// Check /Extra if not in rd(0,0)
// Use user specified md0 file
sprintf(filename, "%s", override_filename);
fh = open(filename, 0);
if(fh < 0)
{
sprintf(filename, "rd(0,0)/Extra/%s");
if((fh = open(filename, 0)) < 0)
{
sprintf(filename, "/Extra/%s");
fh = open(filename, 0);
}
}
}
if (fh != -1)
if(fh < 0)
{
// Fallback to Postboot.img
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);
}
else {
verbose("Unable to read ramdisk %s\n", filename);
verbose("Unable to read md0 image %s.\n", filename);
}
} else {
verbose("Ramdisk %s is empty.\n", filename);
verbose("md0 image %s is empty.\n", filename);
}
close(fh);
}
else {
verbose("Unable to open %s\n", filename);
}
}

Archive Download the corresponding diff file

Revision: 251