Updated to support the new platform API and bootloader features.

Note: it will try to load the "kernel_intel" file for now (it'll
be kernel_x86 or kernel_ppc in the real thing).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4892 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2003-10-01 01:32:51 +00:00
parent 85ee5b9e24
commit 2f72291d1b
3 changed files with 59 additions and 8 deletions
+13 -1
View File
@@ -15,6 +15,9 @@ ObjectsDefines
vfs.cpp vfs.cpp
partitions.cpp partitions.cpp
RootFileSystem.cpp RootFileSystem.cpp
elf.cpp
menu.cpp
loader.cpp
# partitions # partitions
amiga_rdb.cpp amiga_rdb.cpp
@@ -22,12 +25,16 @@ ObjectsDefines
intel.cpp intel.cpp
PartitionMap.cpp PartitionMap.cpp
: :
read_pos=boot_read_pos fstat=boot_fstat open=boot_open close=boot_close read_pos=boot_read_pos fstat=boot_fstat open=boot_open close=boot_close main=boot_main
; ;
{ {
local defines = local defines =
_BOOT_MODE _BOOT_MODE
BOOT_ARCH=\\\"intel\\\"
# the boot loader test application will try to load the BeOS kernel
# from a supported partition/file system
BOOT_SUPPORT_PARTITION_AMIGA BOOT_SUPPORT_PARTITION_AMIGA
BOOT_SUPPORT_PARTITION_APPLE BOOT_SUPPORT_PARTITION_APPLE
BOOT_SUPPORT_PARTITION_INTEL BOOT_SUPPORT_PARTITION_INTEL
@@ -52,6 +59,7 @@ SimpleTest BootLoaderTest :
platform_debug.cpp platform_debug.cpp
platform_devices.cpp platform_devices.cpp
platform_heap.cpp platform_heap.cpp
platform_misc.cpp
Handle.cpp Handle.cpp
# boot loader # boot loader
@@ -59,6 +67,9 @@ SimpleTest BootLoaderTest :
vfs.cpp vfs.cpp
partitions.cpp partitions.cpp
RootFileSystem.cpp RootFileSystem.cpp
#elf.cpp
menu.cpp
loader.cpp
# partitioning systems # partitioning systems
amiga_rdb.cpp amiga_rdb.cpp
@@ -84,6 +95,7 @@ SEARCH on [ FGristFiles strlcpy.c ]
SEARCH on [ FGristFiles SEARCH on [ FGristFiles
main.cpp vfs.cpp partitions.cpp main.cpp vfs.cpp partitions.cpp
heap.cpp RootFileSystem.cpp heap.cpp RootFileSystem.cpp
elf.cpp menu.cpp loader.cpp
] = [ FDirName $(OBOS_TOP) src kernel boot loader ] ; ] = [ FDirName $(OBOS_TOP) src kernel boot loader ] ;
# partitioning system modules # partitioning system modules
@@ -18,7 +18,7 @@
static status_t static status_t
add_device(const char *path, struct list *list) get_device(const char *path, Node **_device)
{ {
Handle *device = new Handle(path); Handle *device = new Handle(path);
if (device == NULL) if (device == NULL)
@@ -29,6 +29,19 @@ add_device(const char *path, struct list *list)
return B_ERROR; return B_ERROR;
} }
*_device = device;
return B_OK;
}
static status_t
add_device(const char *path, struct list *list)
{
Node *device;
status_t status = get_device(path, &device);
if (status < B_OK)
return status;
printf("add \"%s\" to list of boot devices\n", path); printf("add \"%s\" to list of boot devices\n", path);
list_add_item(list, device); list_add_item(list, device);
@@ -67,10 +80,34 @@ recursive_add_device(const char *path, struct list *list)
} }
// #pragma mark -
status_t status_t
platform_get_boot_devices(struct stage2_args *args, struct list *list) platform_get_boot_device(struct stage2_args *args, Node **_device)
{
return get_device("/boot/home/test-file-device", _device);
}
status_t
platform_get_boot_partition(struct stage2_args *args, struct list *list,
boot::Partition **_partition)
{
boot::Partition *partition = NULL;
while ((partition = (boot::Partition *)list_get_next_item(list, partition)) != NULL) {
// just take the first partition
*_partition = partition;
return B_OK;
}
return B_ENTRY_NOT_FOUND;
}
status_t
platform_add_block_devices(struct stage2_args *args, struct list *list)
{ {
add_device("/boot/home/test-file-device", list);
recursive_add_device("/dev/disk/ide", list); recursive_add_device("/dev/disk/ide", list);
recursive_add_device("/dev/disk/scsi", list); recursive_add_device("/dev/disk/scsi", list);
recursive_add_device("/dev/disk/virtual", list); recursive_add_device("/dev/disk/virtual", list);
@@ -7,12 +7,14 @@
#include <boot/platform.h> #include <boot/platform.h>
extern "C" int boot(struct stage2_args *args); extern "C" int boot_main(struct stage2_args *args);
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
boot(NULL); boot_main(NULL);
return 0; return 0;
} }