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:
@@ -9,12 +9,15 @@ SubDirHdrs $(OBOS_TOP) headers private kernel arch $(OBOS_ARCH) ;
|
||||
# they will really be used instead of their POSIX counterparts
|
||||
# in libroot.so
|
||||
|
||||
ObjectsDefines
|
||||
ObjectsDefines
|
||||
# boot loader
|
||||
main.cpp
|
||||
vfs.cpp
|
||||
partitions.cpp
|
||||
RootFileSystem.cpp
|
||||
elf.cpp
|
||||
menu.cpp
|
||||
loader.cpp
|
||||
|
||||
# partitions
|
||||
amiga_rdb.cpp
|
||||
@@ -22,12 +25,16 @@ ObjectsDefines
|
||||
intel.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 =
|
||||
_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_APPLE
|
||||
BOOT_SUPPORT_PARTITION_INTEL
|
||||
@@ -52,6 +59,7 @@ SimpleTest BootLoaderTest :
|
||||
platform_debug.cpp
|
||||
platform_devices.cpp
|
||||
platform_heap.cpp
|
||||
platform_misc.cpp
|
||||
Handle.cpp
|
||||
|
||||
# boot loader
|
||||
@@ -59,6 +67,9 @@ SimpleTest BootLoaderTest :
|
||||
vfs.cpp
|
||||
partitions.cpp
|
||||
RootFileSystem.cpp
|
||||
#elf.cpp
|
||||
menu.cpp
|
||||
loader.cpp
|
||||
|
||||
# partitioning systems
|
||||
amiga_rdb.cpp
|
||||
@@ -84,6 +95,7 @@ SEARCH on [ FGristFiles strlcpy.c ]
|
||||
SEARCH on [ FGristFiles
|
||||
main.cpp vfs.cpp partitions.cpp
|
||||
heap.cpp RootFileSystem.cpp
|
||||
elf.cpp menu.cpp loader.cpp
|
||||
] = [ FDirName $(OBOS_TOP) src kernel boot loader ] ;
|
||||
|
||||
# partitioning system modules
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
|
||||
static status_t
|
||||
add_device(const char *path, struct list *list)
|
||||
get_device(const char *path, Node **_device)
|
||||
{
|
||||
Handle *device = new Handle(path);
|
||||
if (device == NULL)
|
||||
@@ -29,6 +29,19 @@ add_device(const char *path, struct list *list)
|
||||
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);
|
||||
list_add_item(list, device);
|
||||
|
||||
@@ -67,10 +80,34 @@ recursive_add_device(const char *path, struct list *list)
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
platform_get_boot_devices(struct stage2_args *args, struct list *list)
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
status_t
|
||||
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/scsi", list);
|
||||
recursive_add_device("/dev/disk/virtual", list);
|
||||
|
||||
@@ -7,12 +7,14 @@
|
||||
#include <boot/platform.h>
|
||||
|
||||
|
||||
extern "C" int boot(struct stage2_args *args);
|
||||
extern "C" int boot_main(struct stage2_args *args);
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
boot(NULL);
|
||||
boot_main(NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user