From 6072286af6dd8a9ef17462d681fdf6298d04608a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 1 Oct 2003 01:20:21 +0000 Subject: [PATCH] Dunno why, but CVS didn't pick that up (see CVS comment in loader.h). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4885 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/boot/loader/loader.cpp | 75 +++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 src/kernel/boot/loader/loader.cpp diff --git a/src/kernel/boot/loader/loader.cpp b/src/kernel/boot/loader/loader.cpp new file mode 100644 index 0000000000..cb5b5db1b6 --- /dev/null +++ b/src/kernel/boot/loader/loader.cpp @@ -0,0 +1,75 @@ +/* +** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the OpenBeOS License. +*/ + + +#include "loader.h" + +#include +#include +#include +#include +#include + +#include + +#ifndef BOOT_ARCH +# error BOOT_ARCH has to be defined to differentiate the kernel per platform +#endif + +#define KERNEL_IMAGE "kernel_" BOOT_ARCH + + +bool +is_bootable(Directory *volume) +{ + if (volume->IsEmpty()) + return false; + + // check for the existance of a kernel (for our platform) + int fd = open_from(volume, "beos/system/" KERNEL_IMAGE, O_RDONLY); + if (fd < B_OK) + return false; + + close(fd); + + return true; +} + + +status_t +load_kernel(stage2_args *args, Directory *volume) +{ + if (!is_bootable(volume)) + return B_ENTRY_NOT_FOUND; + + puts("load kernel..."); + + // ToDo: really load that thing :) + + void *cookie; + if (volume->Open(&cookie, O_RDONLY) == B_OK) { + char name[B_FILE_NAME_LENGTH]; + while (volume->GetNextEntry(cookie, name, sizeof(name)) == B_OK) + printf("\t%s\n", name); + + volume->Close(cookie); + } + return B_OK; +} + + +status_t +load_modules(stage2_args *args, Directory *volume) +{ + return B_OK; +} + + +void +start_kernel() +{ + // shouldn't return... +} +