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:
commit
4a3fa76a51
|
@ -202,13 +202,24 @@ void stivale_load(char *config, char *cmdline) {
|
||||||
struct stivale_module *m = ext_mem_alloc(sizeof(struct stivale_module));
|
struct stivale_module *m = ext_mem_alloc(sizeof(struct stivale_module));
|
||||||
|
|
||||||
char *module_string = config_get_value(config, i, "MODULE_STRING");
|
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) {
|
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 {
|
} else {
|
||||||
// TODO perhaps change this to be a pointer
|
// TODO perhaps change this to be a pointer
|
||||||
size_t str_len = strlen(module_string);
|
size_t str_len = strlen(module_string);
|
||||||
|
|
||||||
if (str_len > 127)
|
if (str_len > 127)
|
||||||
str_len = 127;
|
str_len = 127;
|
||||||
|
|
||||||
memcpy(m->string, module_string, str_len);
|
memcpy(m->string, module_string, str_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -313,13 +313,23 @@ failed_to_load_header_section:
|
||||||
struct stivale2_module *m = &tag->modules[i];
|
struct stivale2_module *m = &tag->modules[i];
|
||||||
|
|
||||||
char *module_string = config_get_value(config, i, "MODULE_STRING");
|
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) {
|
if (module_string == NULL) {
|
||||||
m->string[0] = '\0';
|
size_t str_len = strlen(module_path);
|
||||||
} else {
|
|
||||||
// TODO perhaps change this to be a pointer
|
|
||||||
size_t str_len = strlen(module_string);
|
|
||||||
if (str_len > 127)
|
if (str_len > 127)
|
||||||
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);
|
memcpy(m->string, module_string, str_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,8 @@ KERNEL_CMDLINE=Woah! Another example!
|
||||||
MODULE_PATH=boot:///boot/bg.bmp
|
MODULE_PATH=boot:///boot/bg.bmp
|
||||||
MODULE_STRING=yooooo
|
MODULE_STRING=yooooo
|
||||||
|
|
||||||
|
MODULE_PATH=boot:///boot/bg.bmp
|
||||||
|
|
||||||
:EFI Chainloading
|
:EFI Chainloading
|
||||||
|
|
||||||
COMMENT=Test EFI image chainloading.
|
COMMENT=Test EFI image chainloading.
|
||||||
|
|
Loading…
Reference in New Issue