Now accepts only "block" devices as boot device (we do not support
network booting (for R1), and if we will, it will be done using another mechanism anyway). If it runs under Apple's OF implementation, it now adds ":0" as parameter to the opened block device to bypass the disk-label package - that part is obviously implementation specific (and took me some time to figure out, even if it's just two characters ;-). Added a commented block of code that could be used in combination with MOL and it's (in the meantime fixed) broken device access via OF. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5206 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
d3b44eeac9
commit
c3efd542cd
@ -6,6 +6,7 @@
|
||||
|
||||
#include "Handle.h"
|
||||
#include "openfirmware.h"
|
||||
#include "machine.h"
|
||||
|
||||
#include <boot/platform.h>
|
||||
#include <boot/vfs.h>
|
||||
@ -95,9 +96,22 @@ platform_get_boot_device(struct stage2_args *args, Node **_device)
|
||||
char type[16];
|
||||
of_getprop(node, "device_type", type, sizeof(type));
|
||||
printf("boot type = %s\n", type);
|
||||
if (strcmp("block", type)) {
|
||||
printf("boot device is not a block device!\n");
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
}
|
||||
} else
|
||||
printf("could not open boot path.\n");
|
||||
|
||||
/* char name[256];
|
||||
strcpy(name, sBootPath);
|
||||
strcat(name, ":kernel_ppc");
|
||||
int kernel = of_open(name);
|
||||
if (kernel == OF_FAILED) {
|
||||
puts("open kernel failed");
|
||||
} else
|
||||
puts("open kernel succeeded");
|
||||
*/
|
||||
int handle = of_open(sBootPath);
|
||||
if (handle == OF_FAILED) {
|
||||
puts("\t\t(open failed)");
|
||||
@ -129,6 +143,44 @@ platform_get_boot_partition(struct stage2_args *args, NodeList *list,
|
||||
}
|
||||
|
||||
|
||||
#define DUMPED_BLOCK_SIZE 16
|
||||
|
||||
void
|
||||
dumpBlock(const char *buffer, int size, const char *prefix)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < size;) {
|
||||
int start = i;
|
||||
|
||||
printf(prefix);
|
||||
for (; i < start+DUMPED_BLOCK_SIZE; i++) {
|
||||
if (!(i % 4))
|
||||
printf(" ");
|
||||
|
||||
if (i >= size)
|
||||
printf(" ");
|
||||
else
|
||||
printf("%02x", *(unsigned char *)(buffer + i));
|
||||
}
|
||||
printf(" ");
|
||||
|
||||
for (i = start; i < start + DUMPED_BLOCK_SIZE; i++) {
|
||||
if (i < size) {
|
||||
char c = buffer[i];
|
||||
|
||||
if (c < 30)
|
||||
printf(".");
|
||||
else
|
||||
printf("%c", c);
|
||||
} else
|
||||
break;
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
platform_add_block_devices(stage2_args *args, NodeList *devicesList)
|
||||
{
|
||||
@ -143,7 +195,19 @@ platform_add_block_devices(stage2_args *args, NodeList *devicesList)
|
||||
continue;
|
||||
}
|
||||
|
||||
// Adjust the arguments passed to the open command so that
|
||||
// the disk-label package is by-passed - unfortunately,
|
||||
// this is implementation specific (and I found no docs
|
||||
// for the Apple OF disk-label usage, of course)
|
||||
|
||||
// SUN's OpenBoot:
|
||||
//strcpy(path + strlen(path), ":nolabel");
|
||||
// Apple:
|
||||
if (gMachine & MACHINE_MAC)
|
||||
strcpy(path + strlen(path), ":0");
|
||||
|
||||
printf("\t%s\n", path);
|
||||
|
||||
int handle = of_open(path);
|
||||
if (handle == OF_FAILED) {
|
||||
puts("\t\t(failed)");
|
||||
|
Loading…
Reference in New Issue
Block a user