stivale+stivale2: default to file path as the module string if NULL

Signed-off-by: Andy-Python-Programmer <andypythonappdeveloper@gmail.com>
This commit is contained in:
Andy-Python-Programmer 2021-11-05 19:22:57 +11:00
parent c338f575d8
commit 1580669781
No known key found for this signature in database
GPG Key ID: 80E0357347554B89
3 changed files with 28 additions and 5 deletions

View File

@ -202,13 +202,24 @@ void stivale_load(char *config, char *cmdline) {
struct stivale_module *m = ext_mem_alloc(sizeof(struct stivale_module));
char *module_string = config_get_value(config, i, "MODULE_STRING");
// TODO: perhaps change the module string to to be a pointer.
//
// NOTE: By default, the module string is the file name.
if (module_string == NULL) {
m->string[0] = '\0';
size_t str_len = strlen(module_path);
if (str_len > 127)
str_len = 127;
memcpy(m->string, module_path, str_len);
} else {
// TODO perhaps change this to be a pointer
size_t str_len = strlen(module_string);
if (str_len > 127)
str_len = 127;
memcpy(m->string, module_string, str_len);
}

View File

@ -313,13 +313,23 @@ failed_to_load_header_section:
struct stivale2_module *m = &tag->modules[i];
char *module_string = config_get_value(config, i, "MODULE_STRING");
// TODO: perhaps change the module string to to be a pointer.
//
// NOTE: By default, the module string is the file name.
if (module_string == NULL) {
m->string[0] = '\0';
} else {
// TODO perhaps change this to be a pointer
size_t str_len = strlen(module_string);
size_t str_len = strlen(module_path);
if (str_len > 127)
str_len = 127;
memcpy(m->string, module_path, str_len);
} else {
size_t str_len = strlen(module_string);
if (str_len > 127)
str_len = 127;
memcpy(m->string, module_string, str_len);
}

View File

@ -21,6 +21,8 @@ KERNEL_CMDLINE=Woah! Another example!
MODULE_PATH=boot:///boot/bg.bmp
MODULE_STRING=yooooo
MODULE_PATH=boot:///boot/bg.bmp
:EFI Chainloading
COMMENT=Test EFI image chainloading.