SHA256
1
0
forked from pool/elilo
OBS User unknown 2009-02-09 16:50:41 +00:00 committed by Git OBS Bridge
parent d2abc5e393
commit bdd129f371
7 changed files with 327 additions and 4 deletions

View File

@ -1,13 +1,14 @@
diff -purN elilo-3.5-pre2/glue_netfs.c elilo-3.5-MAC/glue_netfs.c diff -purN elilo-3.5-pre2/glue_netfs.c elilo-3.5-MAC/glue_netfs.c
--- elilo-3.5-pre2/glue_netfs.c 2004-02-20 23:30:37.000000000 +0100 --- elilo-3.5-pre2/glue_netfs.c 2004-02-20 23:30:37.000000000 +0100
+++ elilo-3.5-MAC/glue_netfs.c 2005-12-07 15:19:45.655191368 +0100 +++ elilo-3.5-MAC/glue_netfs.c 2005-12-07 15:19:45.655191368 +0100
@@ -61,6 +61,18 @@ static CHAR16 netfs_default_path[FILENAM @@ -61,6 +61,19 @@ static CHAR16 netfs_default_path[FILENAM
static CHAR16 *hexa=L"0123456789ABCDEF"; static CHAR16 *hexa=L"0123456789ABCDEF";
static VOID static VOID
+convert_mac2hex(UINT8 *hw_addr,INTN l, CHAR16 *str) +convert_mac2hex(UINT8 *hw_addr,INTN l, CHAR16 *str)
+{ +{
+ UINTN i; + UINTN i;
+
+ for (i=0 ; i < l; i++) { + for (i=0 ; i < l; i++) {
+ str[3*i] = hexa[(hw_addr[i] & 0xf0)>>4]; + str[3*i] = hexa[(hw_addr[i] & 0xf0)>>4];
+ str[3*i+1] = hexa[hw_addr[i] & 0x0f]; + str[3*i+1] = hexa[hw_addr[i] & 0x0f];
@ -20,7 +21,7 @@ diff -purN elilo-3.5-pre2/glue_netfs.c elilo-3.5-MAC/glue_netfs.c
convert_ip2hex(UINT8 *ip, INTN l, CHAR16 *str) convert_ip2hex(UINT8 *ip, INTN l, CHAR16 *str)
{ {
UINTN i; UINTN i;
@@ -197,6 +209,12 @@ netfs_setdefaults(VOID *intf, config_fil @@ -197,6 +210,12 @@ netfs_setdefaults(VOID *intf, config_fil
StrnCpy(config[6].fname, str, maxlen-1); StrnCpy(config[6].fname, str, maxlen-1);
StrnCpy(config[6].fname+2, CONFIG_EXTENSION, 6); StrnCpy(config[6].fname+2, CONFIG_EXTENSION, 6);

118
elilo-cleanup.diff Normal file
View File

@ -0,0 +1,118 @@
--- elilo/alloc.c
+++ elilo/alloc.c
@@ -110,7 +110,7 @@
}
alloc_add(tmp, size, ALLOC_POOL);
- DBG_PRT((L"alloc: allocated %d bytes @[0x%lx-0x%lx]\n", size, tmp, tmp+size));
+ DBG_PRT((L"alloc: allocated %d bytes @[0x%lx-0x%lx]", size, tmp, tmp+size));
return tmp;
}
@@ -140,7 +140,7 @@
alloc_add(addr, pgcnt, ALLOC_PAGES);
- DBG_PRT((L"allocator: allocated %d pages @0x%lx\n", pgcnt, tmp));
+ DBG_PRT((L"allocator: allocated %d pages @0x%lx", pgcnt, tmp));
return addr;
}
@@ -161,7 +161,7 @@
VERB_PRT(1, Print(L"allocator: invalid free @ 0x%lx\n", addr));
return;
found:
- DBG_PRT((L"free: %s @0x%lx size=%ld\n",
+ DBG_PRT((L"free: %s @0x%lx size=%ld",
p->type == ALLOC_POOL ? L"Pool": L"Page",
addr, p->size));
@@ -195,7 +195,7 @@
while(used_allocs) {
- DBG_PRT((L"free_all %a @ 0x%lx\n", used_allocs->type == ALLOC_POOL ? "pool" : "pages", used_allocs->addr));
+ DBG_PRT((L"free_all %a @ 0x%lx", used_allocs->type == ALLOC_POOL ? "pool" : "pages", used_allocs->addr));
if (used_allocs->type == ALLOC_POOL)
uefi_call_wrapper(BS->FreePool, 1, used_allocs->addr);
@@ -239,13 +239,13 @@
VOID
free_kmem(VOID)
{
- DBG_PRT((L"free_kmem before (%lx, %ld)\n", kmem_addr, kmem_pgcnt));
+ DBG_PRT((L"free_kmem before (%lx, %ld)", kmem_addr, kmem_pgcnt));
if (kmem_addr && kmem_pgcnt != 0) {
free(kmem_addr);
kmem_addr = NULL;
kmem_pgcnt = 0;
}
- DBG_PRT((L"free_kmem after (%lx, %ld)\n", kmem_addr, kmem_pgcnt));
+ DBG_PRT((L"free_kmem after (%lx, %ld)", kmem_addr, kmem_pgcnt));
}
VOID
--- elilo/fileops.c
+++ elilo/fileops.c
@@ -497,7 +497,7 @@
str2 = str == NULL ? L"Unknown" : str;
- DBG_PRT((L"%s : %-8s : %s\n", dev_tab[idx].name,
+ DBG_PRT((L"%s : %-8s : %s", dev_tab[idx].name,
(dev_tab[idx].fops ? dev_tab[idx].fops->name: L"N/A"), str2));
if (str) FreePool(str);
--- elilo/glue_netfs.c
+++ elilo/glue_netfs.c
@@ -167,6 +167,8 @@
set_var(VAR_NETFS_DOMAINAME, info.domainame);
if (info.using_pxe) {
+ DBG_PRT((L"netfs_setdefaults: using_pxe"));
+
status = netfs->netfs_query_layer(netfs, 0, NETFS_CONFIG_LAYER, maxlen, config[0].fname);
if (EFI_ERROR(status)) {
StrnCpy(config[0].fname, NETFS_DEFAULT_CONFIG, maxlen-1);
@@ -184,7 +186,7 @@
# if defined(CONFIG_ia64)
# define CONFIG_ARCH_EXTENSION L"-ia64.conf\0"
# elif defined (CONFIG_ia32)
-# define CONFIG_ARCH_EXTENSION L"-ia64.conf\0"
+# define CONFIG_ARCH_EXTENSION L"-ia32.conf\0"
# elif defined (CONFIG_x86_64)
# define CONFIG_ARCH_EXTENSION L"-x86_64.conf\0"
# else
@@ -193,6 +195,7 @@
# define CONFIG_EXTENSION L".conf\0"
+ DBG_PRT((L"netfs_setdefaults: not using_pxe, machine specific"));
len = StrLen(CONFIG_ARCH_EXTENSION) + 1;
/*
* will try machine/subnet specific files first.
--- elilo/x86_64/bzimage.c
+++ elilo/x86_64/bzimage.c
@@ -193,18 +193,20 @@
* 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_load_address, &size);
if (EFI_ERROR(efi_status) || size < 0x10000) {
- ERR_PRT((L"Error reading kernel image %s.", kname));
+ ERR_PRT((L"Error reading kernel image (0x%x).", efi_status));
free(param_start);
param_start = NULL;
param_size = 0;
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));

View File

@ -0,0 +1,44 @@
diff -ur elilo.a/glue_netfs.c elilo.b/glue_netfs.c
--- elilo.a/glue_netfs.c 2009-02-05 15:22:00.000000000 +0100
+++ elilo.b/glue_netfs.c 2009-02-05 20:53:11.000000000 +0100
@@ -143,6 +143,7 @@
UINTN m;
CHAR16 ip_var[64], str[64];
UINT8 *ip;
+ INTN len;
if (config == NULL || kname == NULL || maxlen < 1) return EFI_INVALID_PARAMETER;
@@ -191,6 +192,8 @@
# endif
# define CONFIG_EXTENSION L".conf\0"
+
+ len = StrLen(CONFIG_ARCH_EXTENSION) + 1;
/*
* will try machine/subnet specific files first.
* the filenames are constructed based on the IP(v4) address
@@ -200,19 +203,19 @@
StrnCpy(config[0].fname+8, CONFIG_EXTENSION, 6);
StrnCpy(config[1].fname, str, maxlen-1);
- StrnCpy(config[1].fname+6, CONFIG_ARCH_EXTENSION, 11);
+ StrnCpy(config[1].fname+6, CONFIG_ARCH_EXTENSION, len);
StrnCpy(config[2].fname, str, maxlen-1);
StrnCpy(config[2].fname+6, CONFIG_EXTENSION, 6);
StrnCpy(config[3].fname, str, maxlen-1);
- StrnCpy(config[3].fname+4, CONFIG_ARCH_EXTENSION, 11);
+ StrnCpy(config[3].fname+4, CONFIG_ARCH_EXTENSION, len);
StrnCpy(config[4].fname, str, maxlen-1);
StrnCpy(config[4].fname+4, CONFIG_EXTENSION, 6);
-
+
StrnCpy(config[5].fname, str, maxlen-1);
- StrnCpy(config[5].fname+2, CONFIG_ARCH_EXTENSION, 11);
+ StrnCpy(config[5].fname+2, CONFIG_ARCH_EXTENSION, len);
StrnCpy(config[6].fname, str, maxlen-1);
StrnCpy(config[6].fname+2, CONFIG_EXTENSION, 6);

View File

@ -0,0 +1,48 @@
From: Jarrod Johnson <jbjohnso@us.ibm.com>
Fix StrnCpy bug that would overflow dst buffer if length of src met or exceeded passed size value.
diff -urN elilo/strops.c elilo-strncpy-overflow-fix/strops.c
--- elilo/strops.c 2003-08-19 12:47:41.000000000 -0400
+++ elilo-strncpy-overflow-fix/strops.c 2009-02-07 11:17:10.000000000 -0500
@@ -41,11 +41,11 @@
{
CHAR16 *res = dst;
- while (size-- && (*dst++ = *src++) != CHAR_NULL);
+ while (size && size-- && (*dst++ = *src++) != CHAR_NULL);
/*
* does the null padding
*/
- while (size-- > 0) *dst++ = CHAR_NULL;
+ while (size && size-- > 0) *dst++ = CHAR_NULL;
return res;
}
@@ -55,11 +55,11 @@
{
CHAR8 *res = dst;
- while (size-- && (*dst++ = (CHAR8)*src++) != '\0');
+ while (size && size-- && (*dst++ = (CHAR8)*src++) != '\0');
/*
* does the null padding
*/
- while (size-- > 0) *dst++ = '\0';
+ while (size && size-- > 0) *dst++ = '\0';
return res;
}
@@ -76,11 +76,11 @@
{
CHAR8 *res = dst;
- while (size-- && (*dst++ = *src++) != '\0');
+ while (size && size-- && (*dst++ = *src++) != '\0');
/*
* does the null padding
*/
- while (size-- > 0) *dst++ = '\0';
+ while (size && size-- > 0) *dst++ = '\0';
return res;
}

89
elilo-text-mode.diff Normal file
View File

@ -0,0 +1,89 @@
--- elilo/x86_64/config.c
+++ elilo/x86_64/config.c
@@ -33,15 +33,23 @@
typedef struct {
UINTN legacy_free_boot;
+ UINTN text_mode;
} 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}
};
+static config_option_t sysdeps_image_options[]={
+ {OPT_BOOL, OPT_IMAGE_SYS, L"text-mode", NULL, NULL, x86_64_opt_offsetof(text_mode)}
+};
+
+
/*
* X86_64 operations that need to be done only once and just before
* entering the main loop of the loader
@@ -81,6 +89,14 @@
return x86_64_gconf.legacy_free_boot ? 1 : 0;
}
+
+INTN
+x86_64_text_mode(VOID)
+{
+ return (elilo_opt.sys_img_opts &&
+ elilo_opt.sys_img_opts->text_mode == TRUE) ? 1 : 0;
+}
+
INTN
sysdeps_register_options(VOID)
{
@@ -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
@@ -369,6 +369,7 @@
extern UINTN rmswitch_size;
extern INTN x86_64_use_legacy_free_boot();
+extern INTN x86_64_text_mode();
/*
* How to jump to kernel code
@@ -471,7 +472,8 @@
}
typedef struct sys_img_options {
- UINT8 nothing_yet;
+ UINT8 dummy; /* forces non-zero offset for first field */
+ UINT8 text_mode; /* do not try to initialize Graphics Output Protocol */
} sys_img_options_t;
#endif /* __ELILO_SYSDEPS_X86_64_H__ */
--- elilo/x86_64/system.c
+++ elilo/x86_64/system.c
@@ -198,6 +198,10 @@
UINTN size1;
UINT8 i;
+ if (x86_64_text_mode() == 1) {
+ Print((L"Skip GOP init, force text-mode.\n"));
+ return -1;
+ }
efi_status = uefi_call_wrapper(
BS->LocateHandle,
5,

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Mon Feb 9 15:36:39 CET 2009 - rw@suse.de
- elilo.efi
* Allow booting x86_64 from network. (bnc#473914)
* Introduce new per-image option 'text-mode' for x86_64, which can
be used to sidestep "dubious" GOP implementations. (bnc#466570)
* Minor cleanup.
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Dec 9 16:34:53 CET 2008 - rw@suse.de Tue Dec 9 16:34:53 CET 2008 - rw@suse.de

View File

@ -1,7 +1,7 @@
# #
# spec file for package elilo (Version 3.8) # spec file for package elilo (Version 3.8)
# #
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany. # Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -21,7 +21,7 @@
Name: elilo Name: elilo
Summary: EFI Linux Loader Summary: EFI Linux Loader
Version: 3.8 Version: 3.8
Release: 25 Release: 27
ExclusiveArch: ia64 %ix86 x86_64 ExclusiveArch: ia64 %ix86 x86_64
Group: System/Boot Group: System/Boot
AutoReqProv: on AutoReqProv: on
@ -40,7 +40,11 @@ Patch3: elilo-longer-commandline.diff
Patch4: elilo-fix-possible-overflow.diff Patch4: elilo-fix-possible-overflow.diff
Patch5: elilo-avoid-tab.diff Patch5: elilo-avoid-tab.diff
Patch6: elilo-bzimage-alloc.diff Patch6: elilo-bzimage-alloc.diff
Patch7: elilo-text-mode.diff
Patch8: elilo-fix-amd64-netboot.diff
Patch9: eliloalt-sysfs.diff Patch9: eliloalt-sysfs.diff
Patch10: elilo-strncpy-overflow-fix.diff
Patch11: elilo-cleanup.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: gnu-efi >= 3.0e BuildRequires: gnu-efi >= 3.0e
@ -65,7 +69,11 @@ Authors:
%patch4 -p1 %patch4 -p1
%patch5 -p1 %patch5 -p1
%patch6 -p1 %patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1 %patch9 -p1
%patch10 -p1
%patch11 -p1
perl -pe 's{\@EDITION\@}{%{version}-%{release}}; perl -pe 's{\@EDITION\@}{%{version}-%{release}};
s{\@LIBEXECDIR\@}{%{_libexecdir}}; s{\@LIBEXECDIR\@}{%{_libexecdir}};
s{\@ARCH\@}{%{_target_cpu}}; s{\@ARCH\@}{%{_target_cpu}};
@ -106,6 +114,12 @@ echo "Please run /sbin/elilo!"
/usr/share/man/man8/* /usr/share/man/man8/*
%changelog %changelog
* Mon Feb 09 2009 rw@suse.de
- elilo.efi
* Allow booting x86_64 from network. (bnc#473914)
* Introduce new per-image option 'text-mode' for x86_64, which can
be used to sidestep "dubious" GOP implementations. (bnc#466570)
* Minor cleanup.
* Tue Dec 09 2008 rw@suse.de * Tue Dec 09 2008 rw@suse.de
- elilo.efi - elilo.efi
* Second attempt to work around firmware problem. (bnc#437486) * Second attempt to work around firmware problem. (bnc#437486)