forked from pool/elilo
109 lines
2.8 KiB
Diff
109 lines
2.8 KiB
Diff
--- elilo/x86_64/bzimage.c
|
|
+++ elilo/x86_64/bzimage.c
|
|
@@ -160,7 +160,9 @@
|
|
|
|
if (alloc_kmem(kernel_start, EFI_SIZE_TO_PAGES(kernel_size))) {
|
|
ERR_PRT((L"Could not allocate kernel memory."));
|
|
- return -1;
|
|
+ if (x86_64_allow_alloc_fail() != 1) {
|
|
+ return -1;
|
|
+ }
|
|
} else {
|
|
VERB_PRT(3, Print(L"kernel_start: 0x%x kernel_size: %d\n",
|
|
kernel_start, kernel_size));
|
|
@@ -169,7 +171,7 @@
|
|
* Now read the rest of the kernel image into memory.
|
|
*/
|
|
|
|
- DBG_PRT((L"reading kernel image...\n"));
|
|
+ Print(L"Loading kernel %s... ", kname);
|
|
|
|
size = kernel_size;
|
|
efi_status = fops_read(fd, kernel_start, &size);
|
|
@@ -181,6 +183,8 @@
|
|
fops_close(fd);
|
|
free_kmem();
|
|
return -1;
|
|
+ } else {
|
|
+ Print(L" done\n");
|
|
}
|
|
|
|
DBG_PRT((L"kernel image read: %d bytes, %d Kbytes\n", size, size / 1024));
|
|
--- elilo/x86_64/config.c
|
|
+++ elilo/x86_64/config.c
|
|
@@ -33,15 +33,24 @@
|
|
|
|
typedef struct {
|
|
UINTN legacy_free_boot;
|
|
+ UINTN allow_alloc_fail;
|
|
} x86_64_global_config_t;
|
|
|
|
|
|
+#define x86_64_opt_offsetof(option) (&((sys_img_options_t *)(0x0))->option)
|
|
+
|
|
static x86_64_global_config_t x86_64_gconf;
|
|
|
|
static config_option_t sysdeps_global_options[]={
|
|
- {OPT_BOOL, OPT_GLOBAL, L"legacy-free", NULL, NULL, &x86_64_gconf.legacy_free_boot}
|
|
+ {OPT_BOOL, OPT_GLOBAL, L"legacy-free", NULL, NULL, &x86_64_gconf.legacy_free_boot},
|
|
+ {OPT_BOOL, OPT_GLOBAL, L"skid-alloc", NULL, NULL, &x86_64_gconf.allow_alloc_fail},
|
|
+};
|
|
+
|
|
+static config_option_t sysdeps_image_options[]={
|
|
+ {OPT_BOOL, OPT_IMAGE_SYS, L"skid-alloc", NULL, NULL, x86_64_opt_offsetof(allow_alloc_fail)},
|
|
};
|
|
|
|
+
|
|
/*
|
|
* X86_64 operations that need to be done only once and just before
|
|
* entering the main loop of the loader
|
|
@@ -82,6 +91,13 @@
|
|
}
|
|
|
|
INTN
|
|
+x86_64_allow_alloc_fail(VOID)
|
|
+{
|
|
+ return x86_64_gconf.allow_alloc_fail == TRUE
|
|
+ || (elilo_opt.sys_img_opts && elilo_opt.sys_img_opts->allow_alloc_fail ==TRUE) ? 1 : 0;
|
|
+}
|
|
+
|
|
+INTN
|
|
sysdeps_register_options(VOID)
|
|
{
|
|
INTN ret;
|
|
@@ -89,14 +105,11 @@
|
|
ret = register_config_options(sysdeps_global_options,
|
|
sizeof(sysdeps_global_options)/sizeof(config_option_t),
|
|
OPTIONS_GROUP_GLOBAL);
|
|
-#if 0
|
|
- /* no per image options yet */
|
|
if (ret == -1 ) return ret;
|
|
|
|
ret = register_config_options(sysdeps_image_options,
|
|
sizeof(sysdeps_image_options)/sizeof(config_option_t),
|
|
OPTIONS_GROUP_IMAGE);
|
|
-#endif
|
|
|
|
return ret;
|
|
}
|
|
--- elilo/x86_64/sysdeps.h
|
|
+++ elilo/x86_64/sysdeps.h
|
|
@@ -357,6 +357,7 @@
|
|
extern UINTN rmswitch_size;
|
|
|
|
extern INTN x86_64_use_legacy_free_boot();
|
|
+extern INTN x86_64_allow_alloc_fail();
|
|
|
|
/*
|
|
* How to jump to kernel code
|
|
@@ -449,7 +450,8 @@
|
|
}
|
|
|
|
typedef struct sys_img_options {
|
|
- UINT8 nothing_yet;
|
|
+ UINT8 dummy; /* forces non-zero offset for first field */
|
|
+ UINT8 allow_alloc_fail; /* ignore failure of alloc_kmem */
|
|
} sys_img_options_t;
|
|
|
|
#endif /* __ELILO_SYSDEPS_X86_64_H__ */
|