boot_loader: rename gBootVolume to gBootParams
this will be used to hold other boot parameters, for instance smbios root pointers. Change-Id: I004a8abe553241816c0a004225e088bad1c11b47 Reviewed-on: https://review.haiku-os.org/c/haiku/+/9691 Tested-by: Commit checker robot <[email protected]> Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
fc746f4acf
commit
4719b3c5c3
@@ -13,7 +13,7 @@
|
|||||||
struct stage2_args;
|
struct stage2_args;
|
||||||
|
|
||||||
extern struct kernel_args gKernelArgs;
|
extern struct kernel_args gKernelArgs;
|
||||||
extern KMessage gBootVolume;
|
extern KMessage gBootParams;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@@ -734,7 +734,7 @@ TarFS::Volume::Init(boot::Partition* partition)
|
|||||||
return status;
|
return status;
|
||||||
|
|
||||||
regionDeleter.Detach();
|
regionDeleter.Detach();
|
||||||
int32 bootMethod = gBootVolume.GetInt32(BOOT_METHOD, BOOT_METHOD_DEFAULT);
|
int32 bootMethod = gBootParams.GetInt32(BOOT_METHOD, BOOT_METHOD_DEFAULT);
|
||||||
switch (bootMethod) {
|
switch (bootMethod) {
|
||||||
case BOOT_METHOD_CD:
|
case BOOT_METHOD_CD:
|
||||||
fName = "CD-ROM";
|
fName = "CD-ROM";
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
static const size_t kChunkSize = 16 * B_PAGE_SIZE;
|
static const size_t kChunkSize = 16 * B_PAGE_SIZE;
|
||||||
|
|
||||||
kernel_args gKernelArgs;
|
kernel_args gKernelArgs;
|
||||||
KMessage gBootVolume;
|
KMessage gBootParams;
|
||||||
|
|
||||||
static void* sFirstFree;
|
static void* sFirstFree;
|
||||||
static void* sLast;
|
static void* sLast;
|
||||||
|
|||||||
@@ -149,16 +149,16 @@ main(stage2_args *args)
|
|||||||
// clone the boot_volume KMessage into kernel accessible memory
|
// clone the boot_volume KMessage into kernel accessible memory
|
||||||
// note, that we need to 8-byte align the buffer and thus allocate
|
// note, that we need to 8-byte align the buffer and thus allocate
|
||||||
// 7 more bytes
|
// 7 more bytes
|
||||||
void* buffer = kernel_args_malloc(gBootVolume.ContentSize() + 7);
|
void* buffer = kernel_args_malloc(gBootParams.ContentSize() + 7);
|
||||||
if (!buffer) {
|
if (!buffer) {
|
||||||
panic("Could not allocate memory for the boot volume kernel "
|
panic("Could not allocate memory for the boot volume kernel "
|
||||||
"arguments");
|
"arguments");
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer = (void*)(((addr_t)buffer + 7) & ~(addr_t)0x7);
|
buffer = (void*)(((addr_t)buffer + 7) & ~(addr_t)0x7);
|
||||||
memcpy(buffer, gBootVolume.Buffer(), gBootVolume.ContentSize());
|
memcpy(buffer, gBootParams.Buffer(), gBootParams.ContentSize());
|
||||||
gKernelArgs.boot_volume = buffer;
|
gKernelArgs.boot_volume = buffer;
|
||||||
gKernelArgs.boot_volume_size = gBootVolume.ContentSize();
|
gKernelArgs.boot_volume_size = gBootParams.ContentSize();
|
||||||
|
|
||||||
platform_cleanup_devices();
|
platform_cleanup_devices();
|
||||||
// Further cleanup (e.g. heap_release) is the platform's responsibility.
|
// Further cleanup (e.g. heap_release) is the platform's responsibility.
|
||||||
|
|||||||
@@ -958,7 +958,7 @@ user_menu_boot_volume(Menu* menu, MenuItem* item)
|
|||||||
status_t status = sBootVolume->SetTo((Directory*)item->Data());
|
status_t status = sBootVolume->SetTo((Directory*)item->Data());
|
||||||
update_continue_booting_menu_item(status);
|
update_continue_booting_menu_item(status);
|
||||||
|
|
||||||
gBootVolume.SetBool(BOOT_VOLUME_USER_SELECTED, true);
|
gBootParams.SetBool(BOOT_VOLUME_USER_SELECTED, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -985,7 +985,7 @@ user_menu_boot_volume_state(Menu* menu, MenuItem* _item)
|
|||||||
item->VolumeInfo(), item->VolumeState());
|
item->VolumeInfo(), item->VolumeState());
|
||||||
update_continue_booting_menu_item(status);
|
update_continue_booting_menu_item(status);
|
||||||
|
|
||||||
gBootVolume.SetBool(BOOT_VOLUME_USER_SELECTED, true);
|
gBootParams.SetBool(BOOT_VOLUME_USER_SELECTED, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1294,8 +1294,8 @@ add_boot_volume_menu()
|
|||||||
menu->AddItem(item = new(nothrow) MenuItem("Return to main menu"));
|
menu->AddItem(item = new(nothrow) MenuItem("Return to main menu"));
|
||||||
item->SetType(MENU_ITEM_NO_CHOICE);
|
item->SetType(MENU_ITEM_NO_CHOICE);
|
||||||
|
|
||||||
if (gBootVolume.GetBool(BOOT_VOLUME_BOOTED_FROM_IMAGE, false)) {
|
if (gBootParams.GetBool(BOOT_VOLUME_BOOTED_FROM_IMAGE, false)) {
|
||||||
int32 bootMethod = gBootVolume.GetInt32(BOOT_METHOD, BOOT_METHOD_DEFAULT);
|
int32 bootMethod = gBootParams.GetInt32(BOOT_METHOD, BOOT_METHOD_DEFAULT);
|
||||||
switch (bootMethod) {
|
switch (bootMethod) {
|
||||||
case BOOT_METHOD_CD:
|
case BOOT_METHOD_CD:
|
||||||
menu->SetChoiceText("CD-ROM");
|
menu->SetChoiceText("CD-ROM");
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ Partition::_Mount(file_system_module_info *module, Directory **_fileSystem)
|
|||||||
status_t
|
status_t
|
||||||
Partition::Mount(Directory **_fileSystem, bool isBootDevice)
|
Partition::Mount(Directory **_fileSystem, bool isBootDevice)
|
||||||
{
|
{
|
||||||
if (isBootDevice && gBootVolume.GetBool(BOOT_VOLUME_BOOTED_FROM_IMAGE,
|
if (isBootDevice && gBootParams.GetBool(BOOT_VOLUME_BOOTED_FROM_IMAGE,
|
||||||
false)) {
|
false)) {
|
||||||
return _Mount(&gTarFileSystemModule, _fileSystem);
|
return _Mount(&gTarFileSystemModule, _fileSystem);
|
||||||
}
|
}
|
||||||
@@ -319,7 +319,7 @@ Partition::Scan(bool mountFileSystems, bool isBootDevice)
|
|||||||
// if we were not booted from the real boot device, we won't scan
|
// if we were not booted from the real boot device, we won't scan
|
||||||
// the device we were booted from (which is likely to be a slow
|
// the device we were booted from (which is likely to be a slow
|
||||||
// floppy or CD)
|
// floppy or CD)
|
||||||
if (isBootDevice && gBootVolume.GetBool(BOOT_VOLUME_BOOTED_FROM_IMAGE,
|
if (isBootDevice && gBootParams.GetBool(BOOT_VOLUME_BOOTED_FROM_IMAGE,
|
||||||
false)) {
|
false)) {
|
||||||
return B_ENTRY_NOT_FOUND;
|
return B_ENTRY_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -628,14 +628,14 @@ register_boot_file_system(BootVolume& bootVolume)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
gBootVolume.SetInt64(BOOT_VOLUME_PARTITION_OFFSET,
|
gBootParams.SetInt64(BOOT_VOLUME_PARTITION_OFFSET,
|
||||||
partition->offset);
|
partition->offset);
|
||||||
|
|
||||||
if (bootVolume.IsPackaged()) {
|
if (bootVolume.IsPackaged()) {
|
||||||
gBootVolume.SetBool(BOOT_VOLUME_PACKAGED, true);
|
gBootParams.SetBool(BOOT_VOLUME_PACKAGED, true);
|
||||||
PackageVolumeState* state = bootVolume.GetPackageVolumeState();
|
PackageVolumeState* state = bootVolume.GetPackageVolumeState();
|
||||||
if (state->Name() != NULL)
|
if (state->Name() != NULL)
|
||||||
gBootVolume.AddString(BOOT_VOLUME_PACKAGES_STATE, state->Name());
|
gBootParams.AddString(BOOT_VOLUME_PACKAGES_STATE, state->Name());
|
||||||
}
|
}
|
||||||
|
|
||||||
Node *device = get_node_from(partition->FD());
|
Node *device = get_node_from(partition->FD());
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ platform_add_boot_device(struct stage2_args *args, NodeList *devicesList)
|
|||||||
TRACE(("boot drive ID: %x\n", gBootDriveID));
|
TRACE(("boot drive ID: %x\n", gBootDriveID));
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
gBootVolume.SetBool(BOOT_VOLUME_BOOTED_FROM_IMAGE, gBootedFromImage);
|
gBootParams.SetBool(BOOT_VOLUME_BOOTED_FROM_IMAGE, gBootedFromImage);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1182,7 +1182,7 @@ platform_add_boot_device(struct stage2_args *args, NodeList *devicesList)
|
|||||||
}
|
}
|
||||||
|
|
||||||
TRACE(("boot drive size: %lld bytes\n", drive->Size()));
|
TRACE(("boot drive size: %lld bytes\n", drive->Size()));
|
||||||
gBootVolume.SetBool(BOOT_VOLUME_BOOTED_FROM_IMAGE, gBootedFromImage);
|
gBootParams.SetBool(BOOT_VOLUME_BOOTED_FROM_IMAGE, gBootedFromImage);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -1231,8 +1231,8 @@ platform_register_boot_device(Node *device)
|
|||||||
check_cd_boot(drive);
|
check_cd_boot(drive);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gBootVolume.SetInt64("boot drive number", drive->DriveID());
|
gBootParams.SetInt64("boot drive number", drive->DriveID());
|
||||||
gBootVolume.SetData(BOOT_VOLUME_DISK_IDENTIFIER, B_RAW_TYPE,
|
gBootParams.SetData(BOOT_VOLUME_DISK_IDENTIFIER, B_RAW_TYPE,
|
||||||
&drive->Identifier(), sizeof(disk_identifier));
|
&drive->Identifier(), sizeof(disk_identifier));
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ static bool sBlockDevicesAdded = false;
|
|||||||
static void
|
static void
|
||||||
check_cd_boot(BIOSDrive *drive)
|
check_cd_boot(BIOSDrive *drive)
|
||||||
{
|
{
|
||||||
gBootVolume.SetInt32(BOOT_METHOD, BOOT_METHOD_HARD_DISK);
|
gBootParams.SetInt32(BOOT_METHOD, BOOT_METHOD_HARD_DISK);
|
||||||
|
|
||||||
if (drive->DriveID() != 0)
|
if (drive->DriveID() != 0)
|
||||||
return;
|
return;
|
||||||
@@ -184,7 +184,7 @@ check_cd_boot(BIOSDrive *drive)
|
|||||||
|
|
||||||
specification_packet *packet = (specification_packet *)kDataSegmentScratch;
|
specification_packet *packet = (specification_packet *)kDataSegmentScratch;
|
||||||
if (packet->media_type != 0)
|
if (packet->media_type != 0)
|
||||||
gBootVolume.SetInt32(BOOT_METHOD, BOOT_METHOD_CD);
|
gBootParams.SetInt32(BOOT_METHOD, BOOT_METHOD_CD);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
dprintf("got CD boot spec:\n");
|
dprintf("got CD boot spec:\n");
|
||||||
@@ -872,7 +872,7 @@ platform_add_boot_device(struct stage2_args *args, NodeList *devicesList)
|
|||||||
}
|
}
|
||||||
|
|
||||||
TRACE(("boot drive size: %lld bytes\n", drive->Size()));
|
TRACE(("boot drive size: %lld bytes\n", drive->Size()));
|
||||||
gBootVolume.SetBool(BOOT_VOLUME_BOOTED_FROM_IMAGE, gBootedFromImage);
|
gBootParams.SetBool(BOOT_VOLUME_BOOTED_FROM_IMAGE, gBootedFromImage);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -918,8 +918,8 @@ platform_register_boot_device(Node *device)
|
|||||||
|
|
||||||
check_cd_boot(drive);
|
check_cd_boot(drive);
|
||||||
|
|
||||||
gBootVolume.SetInt64("boot drive number", drive->DriveID());
|
gBootParams.SetInt64("boot drive number", drive->DriveID());
|
||||||
gBootVolume.SetData(BOOT_VOLUME_DISK_IDENTIFIER, B_RAW_TYPE,
|
gBootParams.SetData(BOOT_VOLUME_DISK_IDENTIFIER, B_RAW_TYPE,
|
||||||
&drive->Identifier(), sizeof(disk_identifier));
|
&drive->Identifier(), sizeof(disk_identifier));
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|||||||
@@ -274,8 +274,8 @@ platform_register_boot_device(Node *device)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ...HARD_DISK, as we pick partition and have checksum (no need to use _CD)
|
// ...HARD_DISK, as we pick partition and have checksum (no need to use _CD)
|
||||||
gBootVolume.SetInt32(BOOT_METHOD, BOOT_METHOD_HARD_DISK);
|
gBootParams.SetInt32(BOOT_METHOD, BOOT_METHOD_HARD_DISK);
|
||||||
gBootVolume.SetData(BOOT_VOLUME_DISK_IDENTIFIER, B_RAW_TYPE,
|
gBootParams.SetData(BOOT_VOLUME_DISK_IDENTIFIER, B_RAW_TYPE,
|
||||||
&identifier, sizeof(disk_identifier));
|
&identifier, sizeof(disk_identifier));
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ platform_register_boot_device(Node *device)
|
|||||||
disk.device_type = UNKNOWN_DEVICE;
|
disk.device_type = UNKNOWN_DEVICE;
|
||||||
disk.device.unknown.size = device->Size();
|
disk.device.unknown.size = device->Size();
|
||||||
|
|
||||||
gBootVolume.SetData(BOOT_VOLUME_DISK_IDENTIFIER, B_RAW_TYPE, &disk,
|
gBootParams.SetData(BOOT_VOLUME_DISK_IDENTIFIER, B_RAW_TYPE, &disk,
|
||||||
sizeof(disk_identifier));
|
sizeof(disk_identifier));
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|||||||
@@ -77,8 +77,8 @@ platform_add_boot_device(struct stage2_args *args, NodeList *devicesList)
|
|||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
gBootVolume.SetBool(BOOT_VOLUME_BOOTED_FROM_IMAGE, true);
|
gBootParams.SetBool(BOOT_VOLUME_BOOTED_FROM_IMAGE, true);
|
||||||
gBootVolume.SetInt32(BOOT_METHOD, BOOT_METHOD_NET);
|
gBootParams.SetInt32(BOOT_METHOD, BOOT_METHOD_NET);
|
||||||
devicesList->Add(disk);
|
devicesList->Add(disk);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
} else {
|
} else {
|
||||||
@@ -155,14 +155,14 @@ platform_register_boot_device(Node *device)
|
|||||||
rootPath = fileNameEnd + 1;
|
rootPath = fileNameEnd + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gBootVolume.SetInt32(BOOT_METHOD, BOOT_METHOD_NET) != B_OK
|
if (gBootParams.SetInt32(BOOT_METHOD, BOOT_METHOD_NET) != B_OK
|
||||||
|| gBootVolume.AddInt64("client MAC",
|
|| gBootParams.AddInt64("client MAC",
|
||||||
sTFTP.MACAddress().ToUInt64()) != B_OK
|
sTFTP.MACAddress().ToUInt64()) != B_OK
|
||||||
|| gBootVolume.AddInt32("client IP", sTFTP.IPAddress()) != B_OK
|
|| gBootParams.AddInt32("client IP", sTFTP.IPAddress()) != B_OK
|
||||||
|| gBootVolume.AddInt32("server IP", sTFTP.ServerIPAddress()) != B_OK
|
|| gBootParams.AddInt32("server IP", sTFTP.ServerIPAddress()) != B_OK
|
||||||
|| gBootVolume.AddInt32("server port", sTFTP.ServerPort()) != B_OK
|
|| gBootParams.AddInt32("server port", sTFTP.ServerPort()) != B_OK
|
||||||
|| (sTFTP.RootPath()
|
|| (sTFTP.RootPath()
|
||||||
&& gBootVolume.AddString("net root path", rootPath)
|
&& gBootParams.AddString("net root path", rootPath)
|
||||||
!= B_OK)) {
|
!= B_OK)) {
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -214,9 +214,9 @@ platform_register_boot_device(Node* device)
|
|||||||
offset);
|
offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
gBootVolume.SetInt32(BOOT_METHOD, BOOT_METHOD_HARD_DISK);
|
gBootParams.SetInt32(BOOT_METHOD, BOOT_METHOD_HARD_DISK);
|
||||||
gBootVolume.SetBool(BOOT_VOLUME_BOOTED_FROM_IMAGE, false);
|
gBootParams.SetBool(BOOT_VOLUME_BOOTED_FROM_IMAGE, false);
|
||||||
gBootVolume.SetData(BOOT_VOLUME_DISK_IDENTIFIER, B_RAW_TYPE,
|
gBootParams.SetData(BOOT_VOLUME_DISK_IDENTIFIER, B_RAW_TYPE,
|
||||||
&identifier, sizeof(disk_identifier));
|
&identifier, sizeof(disk_identifier));
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ platform_register_boot_device(Node *device)
|
|||||||
disk_ident.device.unknown.check_sums[i].sum = 0;
|
disk_ident.device.unknown.check_sums[i].sum = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
gBootVolume.SetData(BOOT_VOLUME_DISK_IDENTIFIER, B_RAW_TYPE,
|
gBootParams.SetData(BOOT_VOLUME_DISK_IDENTIFIER, B_RAW_TYPE,
|
||||||
&disk_ident, sizeof(disk_ident));
|
&disk_ident, sizeof(disk_ident));
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|||||||
Reference in New Issue
Block a user