Some new "barebones" for enhanced boot loader functions for the user menu

and the kernel/module loading.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4881 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2003-10-01 01:06:52 +00:00
parent 1f0aeec0f0
commit 8df661e6f8
3 changed files with 76 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
/*
** Copyright 2003, Axel Dörfler, [email protected]. All rights reserved.
** Distributed under the terms of the OpenBeOS License.
*/
#ifndef LOADER_H
#define LOADER_H
#include <boot/vfs.h>
extern bool is_bootable(Directory *volume);
extern status_t load_kernel(stage2_args *args, Directory *volume);
extern status_t load_modules(stage2_args *args, Directory *volume);
extern void start_kernel();
#endif /* LOADER_H */
+45
View File
@@ -0,0 +1,45 @@
/*
** Copyright 2003, Axel Dörfler, [email protected]. All rights reserved.
** Distributed under the terms of the OpenBeOS License.
*/
#include "menu.h"
#include "loader.h"
#include <OS.h>
#include <boot/stage2.h>
#include <boot/vfs.h>
#include <boot/platform.h>
#include <boot/stdio.h>
status_t
user_menu(Directory **_bootVolume)
{
int32 index = 1;
void *cookie;
if (gRoot->Open(&cookie, O_RDONLY) == B_OK) {
Directory *volume;
while (gRoot->GetNextNode(cookie, (Node **)&volume) == B_OK) {
// only list bootable volumes
if (!is_bootable(volume))
continue;
char name[B_FILE_NAME_LENGTH];
if (volume->GetName(name, sizeof(name)) == B_OK)
printf("%ld) /%s\n", index++, name);
// ToDo: for now, just choose the first volume as boot volume
if (*_bootVolume == NULL)
*_bootVolume = volume;
}
gRoot->Close(cookie);
}
puts("(it always tries to boot from the first for now...)");
return B_OK;
}
+14
View File
@@ -0,0 +1,14 @@
/*
** Copyright 2003, Axel Dörfler, [email protected]. All rights reserved.
** Distributed under the terms of the OpenBeOS License.
*/
#ifndef MENU_H
#define MENU_H
#include <boot/vfs.h>
extern status_t user_menu(Directory **_bootVolume);
#endif /* MENU_H */