tests: Rehabilitate bootloader test.

Now builds and starts again, at least.
This commit is contained in:
Augustin Cavalier
2025-11-18 17:39:16 -05:00
parent 43f178372c
commit f4415c8657
11 changed files with 105 additions and 19 deletions
+21 -6
View File
@@ -2,7 +2,7 @@ SubDir HAIKU_TOP src tests system boot loader ;
UsePrivateHeaders [ FDirName kernel disk_device_manager ] ;
UsePrivateHeaders [ FDirName kernel util ] ;
UsePrivateHeaders kernel shared storage system ;
UsePrivateHeaders kernel shared storage system libroot ;
SubDirSysHdrs $(HAIKU_TOP) headers private kernel arch $(TARGET_KERNEL_ARCH_DIR) ;
SubDirSysHdrs $(HAIKU_TOP) headers private system arch $(TARGET_ARCH) ;
SubDirSysHdrs $(HAIKU_TOP) src tests system boot loader ;
@@ -16,7 +16,7 @@ SubDirHdrs $(HAIKU_TOP) src add-ons kernel partitioning_systems intel ;
# they will really be used instead of their POSIX counterparts
# in libroot.so
ObjectDefines
ObjectC++Flags
# boot loader
main.cpp
vfs.cpp
@@ -46,11 +46,17 @@ ObjectDefines
PartitionMap.cpp
PartitionMapParser.cpp
:
read_pos=boot_read_pos fstat=boot_fstat open=boot_open close=boot_close main=boot_main
-fvisibility=hidden
[ FDefines
open=boot_open close=boot_close
read_pos=boot_read_pos write_pos=boot_write_pos fstat=boot_fstat
main=boot_main
get_haiku_revision=__get_haiku_revision __dso_handle=unused_dso_handle ]
;
{
local defines =
_KERNEL_MODE _BOOT_MODE
BOOT_ARCH=\\\"$(TARGET_ARCH)\\\"
# the boot loader test application will try to load the BeOS kernel
# from a supported partition/file system
@@ -85,15 +91,18 @@ SimpleTest BootLoaderTest :
platform_menu.cpp
platform_misc.cpp
platform_mmu.cpp
platform_stubs.cpp
Handle.cpp
# boot loader
PathBlocklist.cpp
main.cpp
vfs.cpp
partitions.cpp
RootFileSystem.cpp
elf.cpp
menu.cpp
package_support.cpp
loader.cpp
kernel_args.cpp
load_driver_settings.cpp
@@ -117,10 +126,11 @@ SimpleTest BootLoaderTest :
driver_settings.cpp
ring_buffer.cpp
KMessage.cpp
Referenceable.cpp
:
boottest_bfs.a boottest_amiga_ffs.a boottest_tarfs.a libz.a
kernelland_emu
boottest_bfs.a boottest_amiga_ffs.a boottest_tarfs.a
libkernelland_emu.so
[ BuildFeatureAttribute zlib : library ] [ TargetLibstdc++ ]
;
# Tell Jam where to find the utility sources
@@ -134,10 +144,15 @@ SEARCH on [ FGristFiles KMessage.cpp ]
SEARCH on [ FGristFiles driver_settings.cpp ]
= [ FDirName $(HAIKU_TOP) src system libroot os ] ;
SEARCH on [ FGristFiles Referenceable.cpp ]
= [ FDirName $(HAIKU_TOP) src kits support ] ;
SEARCH on [ FGristFiles
PathBlocklist.cpp
main.cpp vfs.cpp partitions.cpp
heap.cpp RootFileSystem.cpp
elf.cpp menu.cpp loader.cpp
package_support.cpp
kernel_args.cpp load_driver_settings.cpp pager.cpp
] = [ FDirName $(HAIKU_TOP) src system boot loader ] ;
@@ -13,10 +13,11 @@ ObjectDefines
Directory.cpp
File.cpp
:
_KERNEL_MODE _BOOT_MODE
read_pos=boot_read_pos fstat=boot_fstat open=boot_open close=boot_close
;
KernelStaticLibrary boottest_amiga_ffs :
StaticLibrary boottest_amiga_ffs :
amiga_ffs.cpp
Volume.cpp
Directory.cpp
@@ -15,23 +15,33 @@ ObjectDefines
Link.cpp
Stream.cpp
BPlusTree.cpp
QueryParserUtils.cpp
:
_KERNEL_MODE _BOOT_MODE
read_pos=boot_read_pos fstat=boot_fstat open=boot_open close=boot_close
#BFS_BIG_ENDIAN_ONLY
;
KernelStaticLibrary boottest_bfs.a :
StaticLibrary boottest_bfs.a :
bfs.cpp
Directory.cpp
File.cpp
Link.cpp
Stream.cpp
BPlusTree.cpp
QueryParserUtils.cpp
;
# Tell Jam where to find the sources
SEARCH on [ FGristFiles
bfs.cpp Directory.cpp File.cpp Link.cpp Stream.cpp BPlusTree.cpp
bfs.cpp Directory.cpp File.cpp Link.cpp Stream.cpp
] = [ FDirName $(HAIKU_TOP) src system boot loader file_systems bfs ] ;
SEARCH on [ FGristFiles
BPlusTree.cpp
] = [ FDirName $(HAIKU_TOP) src add-ons kernel file_systems bfs ] ;
SEARCH on [ FGristFiles
QueryParserUtils.cpp
] = [ FDirName $(HAIKU_TOP) src add-ons kernel file_systems shared ] ;
@@ -8,24 +8,28 @@ SubDirSysHdrs $(HAIKU_TOP) src tests system boot loader ;
SubDirSysHdrs $(HAIKU_TOP) headers libs zlib ;
SubDirHdrs $(HAIKU_TOP) src system boot loader file_systems tarfs ;
UseBuildFeatureHeaders zlib ;
Includes [ FGristFiles tarfs.cpp ]
: [ BuildFeatureAttribute zlib : headers ] ;
ObjectDefines
tarfs.cpp
:
_KERNEL_MODE _BOOT_MODE
read_pos=boot_read_pos fstat=boot_fstat open=boot_open close=boot_close
BOOT_ARCHIVE_IMAGE_OFFSET=$(HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET)
;
#SubDirCcFlags -DGUNZIP=1 ;
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src libs zlib ] ;
KernelStaticLibrary boottest_tarfs :
StaticLibrary boottest_tarfs :
tarfs.cpp
inflate.c
: #-fcheck-memory-usage -D_NO_INLINE_ASM
;
# Tell Jam where to find the sources
SEARCH on [ FGristFiles
tarfs.cpp
] = [ FDirName $(HAIKU_TOP) src system boot loader file_systems tarfs ] ;
@@ -18,6 +18,7 @@ panic(const char *format, ...)
puts("*** PANIC ***");
va_start(args, format);
vprintf(format, args);
fflush(stdout);
va_end(args);
}
@@ -29,6 +30,7 @@ dprintf(const char *format, ...)
va_start(args, format);
vprintf(format, args);
fflush(stdout);
va_end(args);
}
@@ -6,6 +6,7 @@
#include "Handle.h"
#include <boot/partitions.h>
#include <boot/platform.h>
#include <util/kernel_cpp.h>
@@ -217,3 +218,9 @@ platform_register_boot_device(Node *device)
{
return B_OK;
}
void
platform_cleanup_devices()
{
}
@@ -15,6 +15,6 @@ heap_init(struct stage2_args *args)
extern "C" void
heap_release(struct stage2_args *args)
heap_release()
{
}
@@ -6,6 +6,8 @@
#include <boot/platform.h>
#include <arch/elf.h>
extern bool gShowMenu;
+19 -5
View File
@@ -10,12 +10,11 @@
#include <stdio.h>
status_t
platform_allocate_region(void **_address, size_t size, uint8 protection,
bool exactAddress)
extern "C" status_t
platform_allocate_region(void **_address, size_t size, uint8 protection)
{
printf("platform_allocate_region(address = %p, size = %lu, protection = %u, exactAdress = %d)\n",
*_address, size, protection, exactAddress);
*_address, size, protection);
void *address = malloc(size);
if (address == NULL)
@@ -26,10 +25,25 @@ platform_allocate_region(void **_address, size_t size, uint8 protection,
}
status_t
extern "C" status_t
platform_free_region(void *address, size_t size)
{
free(address);
return B_OK;
}
extern "C" status_t
platform_bootloader_address_to_kernel_address(void *address, addr_t *_result)
{
*_result = (addr_t)address;
return B_OK;
}
extern "C" status_t
platform_kernel_address_to_bootloader_address(addr_t address, void **_result)
{
*_result = (void*)address;
return B_OK;
}
@@ -8,6 +8,7 @@
#include <boot/kernel_args.h>
#include <stdio.h>
#include <stdlib.h>
extern "C" int boot_main(struct stage2_args *args);
@@ -0,0 +1,30 @@
/*
* Copyright 2025, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#include <boot/platform.h>
#include <boot/vfs.h>
#include <boot/PathBlocklist.h>
extern "C" void
platform_load_ucode(BootVolume& volume)
{
}
status_t
packagefs_mount_file(int fd, ::Directory* systemDirectory,
::Directory*& _mountedDirectory)
{
return B_NOT_SUPPORTED;
}
void
packagefs_apply_path_blocklist(::Directory* systemDirectory,
const PathBlocklist& pathBlocklist)
{
}