diff --git a/src/kernel/boot/loader/loader.h b/src/kernel/boot/loader/loader.h new file mode 100644 index 0000000000..ed8f66be07 --- /dev/null +++ b/src/kernel/boot/loader/loader.h @@ -0,0 +1,17 @@ +/* +** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the OpenBeOS License. +*/ +#ifndef LOADER_H +#define LOADER_H + + +#include + + +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 */ diff --git a/src/kernel/boot/loader/menu.cpp b/src/kernel/boot/loader/menu.cpp new file mode 100644 index 0000000000..37c4360953 --- /dev/null +++ b/src/kernel/boot/loader/menu.cpp @@ -0,0 +1,45 @@ +/* +** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the OpenBeOS License. +*/ + + +#include "menu.h" +#include "loader.h" + +#include + +#include +#include +#include +#include + + +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; +} + diff --git a/src/kernel/boot/loader/menu.h b/src/kernel/boot/loader/menu.h new file mode 100644 index 0000000000..b6343e21ff --- /dev/null +++ b/src/kernel/boot/loader/menu.h @@ -0,0 +1,14 @@ +/* +** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the OpenBeOS License. +*/ +#ifndef MENU_H +#define MENU_H + + +#include + + +extern status_t user_menu(Directory **_bootVolume); + +#endif /* MENU_H */