Merge pull request #123 from Andy-Python-Programmer/patch-1

stivale+stivale2: default to file path as the module string if NULL
This commit is contained in:
mint 2021-11-06 04:56:06 +01:00 committed by GitHub
commit 4a3fa76a51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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.