Chameleon

Chameleon Commit Details

Date:2010-10-09 08:27:25 (8 years 9 months ago)
Author:Evan Lojewski
Commit:577
Parents: 576
Message:Reenabled multiboot code (ramdisk support)
Changes:
M/branches/meklort/i386/boot2/mboot.c
M/branches/meklort/i386/boot2/boot2.s
M/branches/meklort/i386/boot2/ramdisk.c
M/branches/meklort/i386/boot2/drivers.c

File differences

branches/meklort/i386/boot2/boot2.s
129129
130130
131131
132
132
133133
134134
135135
......
343343
344344
345345
346
346
data32
ljmp $0, $0x7c00 # Jump to boot code already in memory
/*if 0
/**/
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Multiboot support added by David F. Elliott <dfe@cox.net> on 2007/06/26
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
.word GDTLIMIT
.long vtop(_Gdt + OFFSET_1MEG)
endif */
/**/
branches/meklort/i386/boot2/drivers.c
151151
152152
153153
154
155
156
157
158
159
160
161
162
163
164
154
155
156
157
158
159
160
165161
166162
167163
{
// First try to load Extra extensions from the ramdisk if isn't aliased as bt(0,0).
#ifndef OPTION_ROM
if (gRAMDiskVolume && !gRAMDiskBTAliased)
{
// First try a specfic OS version folder ie 10.5
sprintf(dirSpecExtra, "rd(0,0)/Extra/%s/", &gMacOSVersion);
if (FileLoadDrivers(dirSpecExtra, 0) != 0)
{
// Next we'll try the base
strcpy(dirSpecExtra, "rd(0,0)/Extra/");
FileLoadDrivers(dirSpecExtra, 0);
}
// First try a specfic OS version folder ie 10.5
sprintf(dirSpecExtra, "rd(0,0)/Extra/%s/", &gMacOSVersion);
if (FileLoadDrivers(dirSpecExtra, 0) != 0)
{
// Next we'll try the base
strcpy(dirSpecExtra, "rd(0,0)/Extra/");
FileLoadDrivers(dirSpecExtra, 0);
}
#endif
// Next try to load Extra extensions from the selected root partition.
branches/meklort/i386/boot2/mboot.c
1111
1212
1313
14
1415
15
16
1617
1718
1819
......
2021
2122
2223
23
2424
2525
2626
......
349349
350350
351351
352
353
354
355
356
357
358
359352
360353
361354
......
431424
432425
433426
427
434428
435429
436430
437431
432
438433
439434
440435
......
507502
508503
509504
510
505
#define OFFSET_1MEG 0x100000
#define BAD_BOOT_DEVICE 0xffffffff
struct multiboot_info *gMI;
#ifdef UNUSED
//#ifdef UNUSED
int multiboot_timeout=0;
int multiboot_timeout_set=0;
int multiboot_partition_set=0;
// Global multiboot info, if using multiboot.
struct multiboot_info *gMI;
extern void continue_at_low_address(void);
return bootdevice;
}
enum {
kReturnKey = 0x0d,
kEscapeKey = 0x1b,
kBackspaceKey = 0x08,
kASCIIKeyMask = 0x7f
};
// This is the meat of our implementation. It grabs the boot device from
// the multiboot_info and returns it as is. If it fails it returns
// BAD_BOOT_DEVICE. We can call an awful lot of libsa and libsaio but
}
}
}
#if UNUSED
if(doSelectDevice)
{
bootdevice = selectAlternateBootDevice(bootdevice);
}
#endif
if(bootdevice == BAD_BOOT_DEVICE)
sleep(2); // pause for a second before halting
return bootdevice;
}
return 0;
}
#endif
//#endif
branches/meklort/i386/boot2/ramdisk.c
111111
112112
113113
114
115
116
117114
115
116
117
118
118119
119120
120121
......
136137
137138
138139
139
140
140141
141142
142143
......
159160
160161
161162
162
163
164
165163
164
165
166
166167
167168
168169
......
173174
174175
175176
176
177
177178
178179
179180
180
181
181182
182183
183184
184185
185186
186187
187
188
189
190
188191
189192
190193
......
199202
200203
201204
202
205
203206
204207
205
208
206209
207210
208211
209
210212
211213
212214
if (gRAMDiskMI != NULL) free(gRAMDiskMI);
// Reset multiboot structures.
#ifdef UNUSED
gMI =
#endif
gRAMDiskMI = NULL;
//#ifdef UNUSED
gMI = gRAMDiskMI;
//#endif
*gRAMDiskFile = '\0';
// Release ramdisk driver hooks.
fh = open(param, 0);
if (fh != -1)
{
printf("\nreading ramdisk image: %s", param);
verbose("\nreading ramdisk image: %s", param);
ramDiskSize = file_size(fh);
if (ramDiskSize > 0)
strcpy(gRAMDiskFile, param);
// Set gMI as well for the multiboot ramdisk driver hook.
#ifdef UNUSED
gMI =
#endif
gRAMDiskMI = malloc(sizeof(multiboot_info));
//#ifdef UNUSED
gMI = gRAMDiskMI;
//#endif
struct multiboot_module * ramdisk_module = malloc(sizeof(multiboot_module));
// Fill in multiboot info and module structures.
ramdisk_module->mm_mod_start = PREBOOT_DATA;
ramdisk_module->mm_mod_end = PREBOOT_DATA + ramDiskSize;
#ifdef UNUSED
//#ifdef UNUSED
// Set ramdisk driver hooks.
p_get_ramdisk_info = &multiboot_get_ramdisk_info;
p_ramdiskReadBytes = &multibootRamdiskReadBytes;
#endif
//#endif
int partCount; // unused
// Save bvr of the mounted image.
gRAMDiskVolume = diskScanBootVolumes(0x100, &partCount);
if(gRAMDiskVolume == NULL)
{
umountRAMDisk();
printf("\nRamdisk contains no partitions.");
printf("\nRamdisk contains no partitions.\n");
pause();
}
else
{
}
else
{
printf("\nno ramdisk config...\n");
verbose("\nno ramdisk config...\n");
}
printf("\nmounting: done");
verbose("\nmounting: done");
}
}
}
return error;
}

Archive Download the corresponding diff file

Revision: 577