load_modules() now actually load modules; it doesn't just print out their name any longer.
Now scans "/boot/home/config/add-ons/kernel/boot" as well as "/boot/beos/system/add-ons/kernel/boot". git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7506 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
38f5c6bbc4
commit
d15df01c72
@ -14,6 +14,7 @@
|
|||||||
#include <boot/stdio.h>
|
#include <boot/stdio.h>
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#ifndef BOOT_ARCH
|
#ifndef BOOT_ARCH
|
||||||
# error BOOT_ARCH has to be defined to differentiate the kernel per platform
|
# error BOOT_ARCH has to be defined to differentiate the kernel per platform
|
||||||
@ -88,12 +89,12 @@ load_kernel(stage2_args *args, Directory *volume)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
static status_t
|
||||||
load_modules(stage2_args *args, Directory *volume)
|
load_modules_from(Directory *volume, const char *path)
|
||||||
{
|
{
|
||||||
// we don't have readdir() & co. yet...
|
// we don't have readdir() & co. yet...
|
||||||
|
|
||||||
int fd = open_from(volume, "beos/system/add-ons/kernel/boot", O_RDONLY);
|
int fd = open_from(volume, path, O_RDONLY);
|
||||||
if (fd < B_OK)
|
if (fd < B_OK)
|
||||||
return fd;
|
return fd;
|
||||||
|
|
||||||
@ -104,8 +105,14 @@ load_modules(stage2_args *args, Directory *volume)
|
|||||||
void *cookie;
|
void *cookie;
|
||||||
if (modules->Open(&cookie, O_RDONLY) == B_OK) {
|
if (modules->Open(&cookie, O_RDONLY) == B_OK) {
|
||||||
char name[B_FILE_NAME_LENGTH];
|
char name[B_FILE_NAME_LENGTH];
|
||||||
while (modules->GetNextEntry(cookie, name, sizeof(name)) == B_OK)
|
while (modules->GetNextEntry(cookie, name, sizeof(name)) == B_OK) {
|
||||||
printf("\t%s\n", name);
|
if (!strcmp(name, ".") || !strcmp(name, ".."))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
status_t status = elf_load_image(modules, name);
|
||||||
|
if (status != B_OK)
|
||||||
|
dprintf("Could not load \"%s\" error %ld\n", name, status);
|
||||||
|
}
|
||||||
|
|
||||||
modules->Close(cookie);
|
modules->Close(cookie);
|
||||||
}
|
}
|
||||||
@ -113,3 +120,20 @@ load_modules(stage2_args *args, Directory *volume)
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
load_modules(stage2_args *args, Directory *volume)
|
||||||
|
{
|
||||||
|
const char *paths[] = {
|
||||||
|
"beos/system/add-ons/kernel/boot",
|
||||||
|
"home/config/add-ons/kernel/boot",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
for (int32 i = 0; paths[i]; i++) {
|
||||||
|
load_modules_from(volume, paths[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user