When the boot loader goes to load its settings files, it will now also prepend the "kernel" settings file to the safe mode settings if it exists. This allows settings from kernel/drivers/kernel to be respected early in the boot process as well, which allows us to do things like disable_smp permanently instead of having to pick from the safe mode menu every single boot. Review welcome.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26937 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent 2008-08-11 23:03:36 +00:00
parent afbd081a6f
commit 3734bee77d
2 changed files with 42 additions and 0 deletions

View File

@ -1,3 +1,6 @@
#disable_smp true
# disables multiprocessor support, default is enabled
#serial_debug_output false
# disables serial debug output, default is enabled

View File

@ -1,5 +1,6 @@
/*
* Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Copyright 2008, Rene Gollent, rene@gollent.com. All rights reserved.
* Distributed under the terms of the MIT License.
*/
@ -17,6 +18,16 @@
#include <string.h>
#include <unistd.h>
static driver_settings_file *
find_driver_settings_file(const char *name)
{
for (driver_settings_file *file = gKernelArgs.driver_settings; file != NULL; file = file->next)
if (!strcmp(file->name, name))
return file;
return NULL;
}
static status_t
load_driver_settings_file(Directory *directory, const char *name)
@ -82,6 +93,34 @@ load_driver_settings(stage2_args */*args*/, Directory *volume)
settings->Close(cookie);
}
// check if a kernel settings file exists
// if it does, prepend it to the safe mode settings. This allows the
// settings from the kernel file to take effect while still allowing
// overrides by safe mode since the settings are searched
// in reverse order. This allows us to permanently set things like
// disable_smp
driver_settings_file *kern_file = find_driver_settings_file("kernel");
if (kern_file != NULL) {
driver_settings_file *safemode_file =
find_driver_settings_file(B_SAFEMODE_DRIVER_SETTINGS);
if (safemode_file != NULL) {
char *tmp_buffer = (char *)kernel_args_malloc(
safemode_file->size + kern_file->size + 1);
if (tmp_buffer != NULL) {
memcpy(tmp_buffer, kern_file->buffer,
kern_file->size);
memcpy(tmp_buffer + kern_file->size,
safemode_file->buffer,
safemode_file->size);
tmp_buffer[safemode_file->size +
kern_file->size] = '\0';
kernel_args_free(safemode_file->buffer);
safemode_file->buffer = tmp_buffer;
}
} else
add_safe_mode_settings(kern_file->buffer);
}
return B_OK;
}