diff --git a/src/tests/kernel/boot/loader/Jamfile b/src/tests/kernel/boot/loader/Jamfile index 05f1203cb8..664de6cd45 100644 --- a/src/tests/kernel/boot/loader/Jamfile +++ b/src/tests/kernel/boot/loader/Jamfile @@ -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 diff --git a/src/tests/kernel/boot/loader/platform_devices.cpp b/src/tests/kernel/boot/loader/platform_devices.cpp index 259b74a144..3588241440 100644 --- a/src/tests/kernel/boot/loader/platform_devices.cpp +++ b/src/tests/kernel/boot/loader/platform_devices.cpp @@ -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); diff --git a/src/tests/kernel/boot/loader/platform_start.cpp b/src/tests/kernel/boot/loader/platform_start.cpp index f1af620dbf..9ee359d0a4 100644 --- a/src/tests/kernel/boot/loader/platform_start.cpp +++ b/src/tests/kernel/boot/loader/platform_start.cpp @@ -7,12 +7,14 @@ #include -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; }