SHA256
1
0
forked from pool/elilo

Accepting request 56257 from Base:System

Accepted submit request 56257 from user coolo

OBS-URL: https://build.opensuse.org/request/show/56257
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/elilo?expand=0&rev=18
This commit is contained in:
Berthold Gunreben 2010-12-20 12:48:05 +00:00 committed by Git OBS Bridge
parent 5d6438f663
commit 163b743a22
21 changed files with 1152 additions and 868 deletions

3
elilo-3.12-source.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5005534ae972603c65caa8debb2bf3c4a22b895588323bc1b0a7a9f114e030ee
size 215125

View File

@ -1,475 +0,0 @@
diff -ur elilo-3.8/Make.defaults elilo/Make.defaults
--- elilo-3.8/Make.defaults 2007-07-20 21:47:25.000000000 +0200
+++ elilo/Make.defaults 2008-01-12 00:53:33.000000000 +0100
@@ -68,7 +68,7 @@
OPTIMFLAGS = -O2
DEBUGFLAGS = -Wall
-CFLAGS = $(OPTIMFLAGS) -fpic -fshort-wchar $(DEBUGFLAGS)
+CFLAGS = $(OPTIMFLAGS) -fno-strict-aliasing -fpic -fshort-wchar $(DEBUGFLAGS)
LDFLAGS = -nostdlib -znocombreloc
INSTALL = install
diff -ur elilo-3.8/alternate.c elilo/alternate.c
--- elilo-3.8/alternate.c 2007-07-20 21:47:26.000000000 +0200
+++ elilo/alternate.c 2008-01-12 00:53:33.000000000 +0100
@@ -56,7 +56,7 @@
* Please note that no fatal error is reported by this function
*/
INTN
-alternate_kernel(CHAR16 *buffer, INTN size)
+alternate_kernel(CHAR16 *buffer, UINTN size)
{
EFI_STATUS status;
INTN ret = -1;
diff -ur elilo-3.8/choosers/simple.c elilo/choosers/simple.c
--- elilo-3.8/choosers/simple.c 2007-07-20 21:47:26.000000000 +0200
+++ elilo/choosers/simple.c 2008-01-12 00:53:33.000000000 +0100
@@ -220,7 +220,7 @@
{
fops_fd_t fd;
EFI_STATUS status;
- INTN len, i;
+ UINTN len, i;
CHAR16 *filename;
CHAR8 buf[256];
diff -ur elilo-3.8/choosers/textmenu.c elilo/choosers/textmenu.c
--- elilo-3.8/choosers/textmenu.c 2007-07-20 21:47:26.000000000 +0200
+++ elilo/choosers/textmenu.c 2008-01-12 00:53:33.000000000 +0100
@@ -186,12 +186,12 @@
}
static INTN
-read_message_file(INTN msg, INT8 *buf, INTN max)
+read_message_file(INTN msg, UINT8 *buf, UINTN max)
{
CHAR16 *filename;
fops_fd_t message_fd;
EFI_STATUS status;
- INTN len = max;
+ UINTN len = max;
if (msg > 10) return 0;
diff -ur elilo-3.8/elilo.h elilo/elilo.h
--- elilo-3.8/elilo.h 2005-12-01 22:42:59.000000000 +0100
+++ elilo/elilo.h 2008-01-12 00:53:33.000000000 +0100
@@ -183,7 +183,7 @@
extern INTN load_file(CHAR16 *, memdesc_t *);
/* from alternate.c */
-extern INTN alternate_kernel(CHAR16 *, INTN);
+extern INTN alternate_kernel(CHAR16 *, UINTN);
/* from bootparams.c */
extern VOID *create_boot_params (CHAR16 *, memdesc_t *, memdesc_t *, UINTN *);
diff -ur elilo-3.8/ia32/gzip.c elilo/ia32/gzip.c
--- elilo-3.8/ia32/gzip.c 2005-12-01 22:42:59.000000000 +0100
+++ elilo/ia32/gzip.c 2008-01-13 01:12:19.000000000 +0100
@@ -153,7 +153,7 @@
int
fill_inbuf(void)
{
- INTN expected, nread;
+ UINTN expected, nread;
EFI_STATUS status;
expected = nread = INBUFSIZE;
@@ -277,7 +277,7 @@
* the relevant header information.
*/
int
-first_block (const char *buf, long blocksize)
+first_block (const unsigned char *buf, long blocksize)
{
Elf32_Ehdr *elf;
Elf32_Phdr *phdrs;
@@ -430,7 +430,7 @@
static const CHAR8 helicopter[4] = { '|' , '/' , '-' , '\\' };
static UINTN heli_count;
struct segment *cp;
- char *src, *dst;
+ unsigned char *src, *dst;
long cnt;
if (!outcnt) return;
@@ -468,7 +468,7 @@
file_offset += skip;
outcnt -= skip;
}
- dst = (char *)cp->addr + (file_offset - cp->offset);
+ dst = (unsigned char *)cp->addr + (file_offset - cp->offset);
cnt = cp->offset + cp->size - file_offset;
if (cnt > outcnt)
cnt = outcnt;
@@ -482,7 +482,7 @@
/* See if we are at the end of this chunk */
if (file_offset == cp->offset + cp->size) {
if (cp->bss_sz) {
- dst = (char *)cp->addr + cp->size;
+ dst = (unsigned char *)cp->addr + cp->size;
Memset(dst, 0, cp->bss_sz);
}
nextchunk();
diff -ur elilo-3.8/ia32/system.c elilo/ia32/system.c
--- elilo-3.8/ia32/system.c 2008-01-03 22:48:03.000000000 +0100
+++ elilo/ia32/system.c 2008-01-14 00:31:57.000000000 +0100
@@ -163,10 +163,11 @@
EFI_GUID GopProtocol = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop_interface;
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Gop_info;
- EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Gop_mode;
- EFI_HANDLE *Gop_handle;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Gop_mode = NULL;
+ EFI_HANDLE *Gop_handle = NULL;
EFI_STATUS efi_status;
- UINTN size, size1;
+ UINTN size = 0;
+ UINTN size1;
UINT8 i;
efi_status = uefi_call_wrapper(
@@ -204,7 +205,7 @@
3,
*Gop_handle,
&GopProtocol,
- &Gop_interface);
+ (VOID **) &Gop_interface);
if (EFI_ERROR(efi_status)) {
continue;
diff -ur elilo-3.8/ia64/fpswa.c elilo/ia64/fpswa.c
--- elilo-3.8/ia64/fpswa.c 2003-08-19 18:46:09.000000000 +0200
+++ elilo/ia64/fpswa.c 2008-01-12 00:53:33.000000000 +0100
@@ -132,7 +132,7 @@
#endif
};
UINTN j, count = sizeof(fpswa_filenames)/sizeof(CHAR16 *);
- INTN cookie;
+ UINTN cookie;
CHAR16 devname[FILENAME_MAXLEN];
if (fpswa_file) {
diff -ur elilo-3.8/ia64/gzip.c elilo/ia64/gzip.c
--- elilo-3.8/ia64/gzip.c 2005-12-01 22:42:59.000000000 +0100
+++ elilo/ia64/gzip.c 2008-01-12 00:53:33.000000000 +0100
@@ -161,7 +161,7 @@
int
fill_inbuf(void)
{
- INTN expected, nread;
+ UINTN expected, nread;
EFI_STATUS status;
expected = nread = INBUFSIZE;
@@ -309,7 +309,7 @@
* the relevant header information.
*/
int
-first_block (const char *buf, long blocksize)
+first_block (const unsigned char *buf, long blocksize)
{
Elf64_Ehdr *elf;
Elf64_Phdr *phdrs;
@@ -439,7 +439,7 @@
if (alloc_kmem((void *)low_addr, pages) == -1) {
VOID *new_addr;
- VERB_PRT(1, (L"%s : AllocatePages(%d, 0x%lx) for kernel failed\n", LD_NAME, pages, low_addr));
+ VERB_PRT(1, Print(L"%s : AllocatePages(%d, 0x%lx) for kernel failed\n", LD_NAME, pages, low_addr));
if (ia64_can_relocate() == 0) {
ERR_PRT((L"relocation is disabled, cannot load kernel"));
@@ -464,7 +464,7 @@
/* unsigned arithmetic */
load_offset = (UINTN) (new_addr - ROUNDDOWN((UINTN) low_addr,256*MB));
- VERB_PRT(1, (L"low_addr=0x%lx new_addr=0x%lx offset=0x%lx", low_addr, new_addr, load_offset));
+ VERB_PRT(1, Print(L"low_addr=0x%lx new_addr=0x%lx offset=0x%lx", low_addr, new_addr, load_offset));
/*
* correct various addresses for non-zero load_offset
@@ -526,7 +526,7 @@
static const CHAR8 helicopter[4] = { '|' , '/' , '-' , '\\' };
static UINTN heli_count;
struct segment *cp;
- char *src, *dst;
+ unsigned char *src, *dst;
long cnt;
if (!outcnt) return;
@@ -565,7 +565,7 @@
file_offset += skip;
outcnt -= skip;
}
- dst = (char *)cp->addr + (file_offset - cp->offset);
+ dst = (unsigned char *)cp->addr + (file_offset - cp->offset);
cnt = cp->offset + cp->size - file_offset;
@@ -582,7 +582,7 @@
/* See if we are at the end of this chunk */
if (file_offset == cp->offset + cp->size) {
if (cp->bss_sz) {
- dst = (char *)cp->addr + cp->size;
+ dst = (unsigned char *)cp->addr + cp->size;
Memset(dst, 0, cp->bss_sz);
}
nextchunk();
diff -ur elilo-3.8/ia64/longjmp.S elilo/ia64/longjmp.S
--- elilo-3.8/ia64/longjmp.S 2002-01-13 17:00:08.000000000 +0100
+++ elilo/ia64/longjmp.S 2008-01-27 01:42:24.000000000 +0100
@@ -159,4 +159,4 @@
invala // virt. -> phys. regnum mapping may change
mov pr=r24,-1
br.ret.dptk.few rp
- .endp __longjmp
+ .endp longjmp
diff -ur elilo-3.8/ia64/plain_loader.c elilo/ia64/plain_loader.c
--- elilo-3.8/ia64/plain_loader.c 2005-09-16 18:25:52.000000000 +0200
+++ elilo/ia64/plain_loader.c 2008-01-12 00:53:33.000000000 +0100
@@ -288,7 +288,7 @@
if (alloc_kmem(low_addr, pages) == -1) {
VOID *new_addr;
- VERB_PRT(1, (L"%s : AllocatePages(%d, 0x%lx) for kernel failed\n", LD_NAME, pages, low_addr));
+ VERB_PRT(1, Print(L"%s : AllocatePages(%d, 0x%lx) for kernel failed\n", LD_NAME, pages, low_addr));
if (ia64_can_relocate() == 0) {
ERR_PRT((L"relocation is disabled, cannot load kernel"));
diff -ur elilo-3.8/ia64/setjmp.S elilo/ia64/setjmp.S
--- elilo-3.8/ia64/setjmp.S 2005-05-10 01:22:04.000000000 +0200
+++ elilo/ia64/setjmp.S 2008-01-27 01:42:24.000000000 +0100
@@ -81,6 +81,7 @@
.proc __sigsetjmp
__sigsetjmp:
//.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(2)
+ .body
alloc loc1=ar.pfs,2,2,2,0
mov r16=ar.unat
;;
@@ -89,6 +90,7 @@
add r3=8,in0
;;
st8.spill.nta [r2]=sp,16 // r12 (sp)
+ ;;
st8.spill.nta [r3]=gp,16 // r1 (gp)
;;
st8.nta [r2]=r16,16 // save caller's unat
@@ -96,13 +98,13 @@
add r8=0xa0,in0
;;
st8.spill.nta [r2]=r4,16 // r4
+ ;;
st8.spill.nta [r3]=r5,16 // r5
add r9=0xb0,in0
;;
stf.spill.nta [r8]=f2,32
stf.spill.nta [r9]=f3,32
mov loc0=rp
- .body
;;
stf.spill.nta [r8]=f4,32
stf.spill.nta [r9]=f5,32
@@ -139,6 +141,7 @@
stf.spill.nta [r9]=f31
st8.spill.nta [r2]=r6,16 // r6
+ ;;
st8.spill.nta [r3]=r7,16 // r7
;;
mov r23=ar.bsp
diff -ur elilo-3.8/ia64/sysdeps.h elilo/ia64/sysdeps.h
--- elilo-3.8/ia64/sysdeps.h 2005-12-01 22:42:59.000000000 +0100
+++ elilo/ia64/sysdeps.h 2008-01-12 00:53:34.000000000 +0100
@@ -86,7 +86,7 @@
asm volatile ("mov r28=%1; br.sptk.few %0" :: "b"(kentry),"r"(bp));
}
-static inline const UINT64
+static inline UINT64
__ia64_swab64 (UINT64 x)
{
UINT64 result;
@@ -95,13 +95,13 @@
return result;
}
-static inline const UINT32
+static inline UINT32
__ia64_swab32 (UINT32 x)
{
return __ia64_swab64(x) >> 32;
}
-static inline const UINT16
+static inline UINT16
__ia64_swab16(UINT16 x)
{
return __ia64_swab64(x) >> 48;
diff -ur elilo-3.8/inflate.c elilo/inflate.c
--- elilo-3.8/inflate.c 2005-12-01 22:42:59.000000000 +0100
+++ elilo/inflate.c 2008-01-15 02:03:19.000000000 +0100
@@ -1094,10 +1094,10 @@
error("Input has invalid flags\n");
return -1;
}
- (ulg)get_byte(); /* Get timestamp */
- ((ulg)get_byte()) << 8;
- ((ulg)get_byte()) << 16;
- ((ulg)get_byte()) << 24;
+ (void)get_byte(); /* Get timestamp - 4 bytes */
+ (void)get_byte();
+ (void)get_byte();
+ (void)get_byte();
(void)get_byte(); /* Ignore extra flags for the moment */
(void)get_byte(); /* Ignore OS type for the moment */
diff -ur elilo-3.8/util.c elilo/util.c
--- elilo-3.8/util.c 2007-07-20 21:47:26.000000000 +0200
+++ elilo/util.c 2008-01-12 00:53:33.000000000 +0100
@@ -248,7 +248,7 @@
INTN
read_file(UINTN fd, UINTN total_size, CHAR8 *buffer)
{
- INTN size, j=0;
+ UINTN size, j=0;
EFI_STATUS status;
CHAR16 helicopter[4] = { L'|' , L'/' , L'-' , L'\\' };
INTN ret = ELILO_LOAD_SUCCESS;
diff -ur elilo-3.8/x86_64/gzip.c elilo/x86_64/gzip.c
--- elilo-3.8/x86_64/gzip.c 2007-07-20 21:47:27.000000000 +0200
+++ elilo/x86_64/gzip.c 2008-01-15 02:03:19.000000000 +0100
@@ -156,7 +156,7 @@
int
fill_inbuf(void)
{
- INTN expected, nread;
+ UINTN expected, nread;
EFI_STATUS status;
expected = nread = INBUFSIZE;
@@ -280,7 +280,7 @@
* the relevant header information.
*/
int
-first_block (const char *buf, long blocksize)
+first_block (const unsigned char *buf, long blocksize)
{
Elf64_Ehdr *elf;
Elf64_Phdr *phdrs;
@@ -433,7 +433,7 @@
static const CHAR8 helicopter[4] = { '|' , '/' , '-' , '\\' };
static UINTN heli_count;
struct segment *cp;
- char *src, *dst;
+ unsigned char *src, *dst;
long cnt;
if (!outcnt) return;
@@ -471,7 +471,7 @@
file_offset += skip;
outcnt -= skip;
}
- dst = (char *)cp->addr + (file_offset - cp->offset);
+ dst = (unsigned char *)cp->addr + (file_offset - cp->offset);
cnt = cp->offset + cp->size - file_offset;
if (cnt > outcnt)
cnt = outcnt;
@@ -485,7 +485,7 @@
/* See if we are at the end of this chunk */
if (file_offset == cp->offset + cp->size) {
if (cp->bss_sz) {
- dst = (char *)cp->addr + cp->size;
+ dst = (unsigned char *)cp->addr + cp->size;
Memset(dst, 0, cp->bss_sz);
}
nextchunk();
diff -ur elilo-3.8/x86_64/sysdeps.h elilo/x86_64/sysdeps.h
--- elilo-3.8/x86_64/sysdeps.h 2007-12-19 23:52:22.000000000 +0100
+++ elilo/x86_64/sysdeps.h 2008-01-15 02:03:19.000000000 +0100
@@ -370,8 +370,8 @@
UINT32 kernel_entry;
UINT16 kernel_cs;
} jumpvector;
- UINTN njump;
VOID *jump_start;
+ uint64_t temp;
/*
* Disable interrupts.
@@ -383,7 +383,8 @@
*/
if (bp->s.initrd_start) {
- MEMCPY(INITRD_START, bp->s.initrd_start, bp->s.initrd_size);
+ temp = bp->s.initrd_start;
+ MEMCPY(INITRD_START, temp , bp->s.initrd_size);
bp->s.initrd_start = INITRD_START;
}
/*
@@ -434,14 +435,15 @@
/*
* Jump to kernel entry point.
+ *
+ * Cast is to tell gcc that we know we're going from
+ * 64-bit ptr to 32-bit integer.
*/
- jumpvector.kernel_entry=kentry;
+ jumpvector.kernel_entry=(UINT32)((UINT64)kentry);
jumpvector.kernel_cs=0x10;
- njump = &jumpvector;
jump_start = (VOID *)&jumpvector;
//asm volatile ( "mov %0, %%rcx" : : "m" (&jumpvector) );
asm volatile ( "mov %0, %%rcx" : : "m" (jump_start) );
- //asm volatile ( "mov %0, %%rcx" : : "m" (njump) );
asm volatile ( "ljmp *(%%rcx)" : :);
/* Never come back to here. */
}
diff -ur elilo-3.8/x86_64/system.c elilo/x86_64/system.c
--- elilo-3.8/x86_64/system.c 2008-01-03 22:48:03.000000000 +0100
+++ elilo/x86_64/system.c 2008-01-15 02:03:19.000000000 +0100
@@ -160,7 +160,7 @@
mmap_desc_t md;
ZeroMem(&md, sizeof md);
- md.md = (VOID *)bp->s.efi_mem_map;
+ md.md = (VOID *)(UINT64)bp->s.efi_mem_map;
free_memmap(&md);
}
@@ -189,10 +189,11 @@
EFI_GUID GopProtocol = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop_interface;
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Gop_info;
- EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Gop_mode;
- EFI_HANDLE *Gop_handle;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Gop_mode = NULL;
+ EFI_HANDLE *Gop_handle = NULL;
EFI_STATUS efi_status;
- UINTN size, size1;
+ UINTN size = 0;
+ UINTN size1;
UINT8 i;
efi_status = uefi_call_wrapper(
@@ -554,7 +555,7 @@
if (initrd->start_addr && initrd->pgcnt) {
/* %%TBD - This will probably have to be changed. */
- bp->s.initrd_start = (UINT32)initrd->start_addr;
+ bp->s.initrd_start = (UINT32)(UINT64)initrd->start_addr;
bp->s.initrd_size = (UINT32)(initrd->size);
/*
* This is the RAMdisk root device for RedHat 2.2.x
@@ -598,7 +599,7 @@
/*
* Kernel entry point.
*/
- bp->s.kernel_start = (UINT32)kernel_start;
+ bp->s.kernel_start = (UINT32)(UINT64)kernel_start;
/*
* When changing stuff in the parameter structure compare

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:eca0d67a6764d088a5526a2ef7b0f23ee51dc4a29ac58fb10e4d93421d6b7901
size 206250

View File

@ -1,7 +1,10 @@
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 glue_netfs.c | 19 +++++++++++++++++++
+++ elilo-3.5-MAC/glue_netfs.c 2005-12-07 15:19:45.655191368 +0100 1 file changed, 19 insertions(+)
@@ -61,6 +61,19 @@ static CHAR16 netfs_default_path[FILENAM
--- a/glue_netfs.c
+++ b/glue_netfs.c
@@ -65,6 +65,19 @@ static CHAR16 netfs_default_path[FILENAM
static CHAR16 *hexa=L"0123456789ABCDEF"; static CHAR16 *hexa=L"0123456789ABCDEF";
static VOID static VOID
@ -16,12 +19,12 @@ diff -purN elilo-3.5-pre2/glue_netfs.c elilo-3.5-MAC/glue_netfs.c
+ } + }
+ str[3*l-1]='\0'; + str[3*l-1]='\0';
+} +}
+ +
+static VOID +static VOID
convert_ip2hex(UINT8 *ip, INTN l, CHAR16 *str) convert_ip2hex(UINT8 *ip, INTN l, CHAR16 *str)
{ {
UINTN i; UINTN i;
@@ -197,6 +210,12 @@ netfs_setdefaults(VOID *intf, config_fil @@ -210,6 +223,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);
@ -30,7 +33,7 @@ diff -purN elilo-3.5-pre2/glue_netfs.c elilo-3.5-MAC/glue_netfs.c
+ convert_mac2hex(info.hw_addr,6,str); + convert_mac2hex(info.hw_addr,6,str);
+ StrnCpy(config[7].fname, str, maxlen-1); + StrnCpy(config[7].fname, str, maxlen-1);
+ StrnCpy(config[7].fname+17, CONFIG_EXTENSION, 6); + StrnCpy(config[7].fname+17, CONFIG_EXTENSION, 6);
+ +
#else #else
StrnCpy(config[0].fname, NETFS_DEFAULT_CONFIG, maxlen-1); StrnCpy(config[0].fname, NETFS_DEFAULT_CONFIG, maxlen-1);
config[0].fname[maxlen-1] = CHAR_NULL; config[0].fname[maxlen-1] = CHAR_NULL;

View File

@ -1,7 +1,10 @@
diff -urp elilo-3.8/config.c elilo-3.8-tab/config.c ---
--- elilo-3.8/config.c 2008-07-29 23:22:07.637647427 +0200 config.c | 4 ++--
+++ elilo-3.8-tab/config.c 2008-07-31 01:24:31.346046245 +0200 1 file changed, 2 insertions(+), 2 deletions(-)
@@ -897,10 +897,10 @@ print_label_list(VOID)
--- a/config.c
+++ b/config.c
@@ -909,10 +909,10 @@ print_label_list(VOID)
{ {
boot_image_t *img, *dfl = global_config.default_image; boot_image_t *img, *dfl = global_config.default_image;

View File

@ -28,183 +28,15 @@ resubmit if there are any issues with this approach.
Thanks! Thanks!
diff -purN '--exclude=*o' '--exclude=tags' elilo-3.8-3.35-orig1/alloc.c elilo-3.8-3.35-orig_c/alloc.c [ only one change of this patch is still missing... -- rw@suse.de ]
--- elilo-3.8-3.35-orig1/alloc.c 2008-12-08 06:03:05.000000000 -0600
+++ elilo-3.8-3.35-orig_c/alloc.c 2008-12-08 04:51:28.000000000 -0600 ---
@@ -213,6 +213,19 @@ free_all(VOID) fs/localfs.c | 2 +-
} 1 file changed, 1 insertion(+), 1 deletion(-)
INTN --- a/fs/localfs.c
+alloc_kmem_anywhere(VOID **start_addr, UINTN pgcnt) +++ b/fs/localfs.c
+{ @@ -98,7 +98,7 @@ localfs_open(localfs_interface_t *this,
+ void * tmp;
+ if ((tmp = alloc_pages(pgcnt, EfiLoaderData, AllocateAnyPages, *start_addr)) == 0) return -1;
+
+ kmem_addr = tmp;
+ kmem_pgcnt = pgcnt;
+ *start_addr = tmp;
+
+ return 0;
+}
+
+INTN
alloc_kmem(VOID *start_addr, UINTN pgcnt)
{
if (alloc_pages(pgcnt, EfiLoaderData, AllocateAddress, start_addr) == 0) return -1;
diff -purN '--exclude=*o' '--exclude=tags' elilo-3.8-3.35-orig1/elilo.c elilo-3.8-3.35-orig_c/elilo.c
--- elilo-3.8-3.35-orig1/elilo.c 2008-12-08 06:03:05.000000000 -0600
+++ elilo-3.8-3.35-orig_c/elilo.c 2008-12-08 05:01:33.000000000 -0600
@@ -132,6 +132,9 @@ kernel_load(EFI_HANDLE image, CHAR16 *kn
if (elilo_opt.initrd[0]) {
+ /*
+ * fix me? -- load_file() ignores address from sysdeps_initrd_get_addr()
+ */
if (sysdeps_initrd_get_addr(kd, imem) == -1) goto exit_error;
switch(load_file(elilo_opt.initrd, imem)) {
Files elilo-3.8-3.35-orig1/elilo.efi and elilo-3.8-3.35-orig_c/elilo.efi differ
Files elilo-3.8-3.35-orig1/tools/eliloalt and elilo-3.8-3.35-orig_c/tools/eliloalt differ
diff -purN '--exclude=*o' '--exclude=tags' elilo-3.8-3.35-orig1/x86_64/bzimage.c elilo-3.8-3.35-orig_c/x86_64/bzimage.c
--- elilo-3.8-3.35-orig1/x86_64/bzimage.c 2008-12-08 06:03:05.000000000 -0600
+++ elilo-3.8-3.35-orig_c/x86_64/bzimage.c 2008-12-08 05:04:52.000000000 -0600
@@ -158,13 +158,37 @@ bzImage_probe(CHAR16 *kname)
* Allocate memory for kernel.
*/
+ /*
+ * Get correct address for kernel from header, if applicable & available.
+ */
+ if ((param_start->s.hdr_major == 2) &&
+ (param_start->s.hdr_minor >= 0) &&
+ (param_start->s.kernel_start >= DEFAULT_KERNEL_START)) {
+ kernel_start = kernel_load_address = (VOID *)((UINTN)param_start->s.kernel_start);
+ VERB_PRT(3, Print(L"kernel header suggests kernel start at address 0x%x\n",
+ kernel_start));
+ }
+
+ kernel_load_address = kernel_start;
+
if (alloc_kmem(kernel_start, EFI_SIZE_TO_PAGES(kernel_size))) {
- ERR_PRT((L"Could not allocate kernel memory."));
- return -1;
- } else {
- VERB_PRT(3, Print(L"kernel_start: 0x%x kernel_size: %d\n",
- kernel_start, kernel_size));
+ /*
+ * Couldn't get desired address--just load it anywhere and move it later.
+ * (Easier than relocating kernel, and also works with non-relocatable kernels.)
+ */
+ if (alloc_kmem_anywhere(&kernel_load_address, EFI_SIZE_TO_PAGES(kernel_size))) {
+ ERR_PRT((L"Could not allocate memory for kernel."));
+ free(param_start);
+ param_start = NULL;
+ param_size = 0;
+ fops_close(fd);
+ return -1;
+ }
}
+
+ VERB_PRT(3, Print(L"kernel_start: 0x%x kernel_size: %d loading at: 0x%x\n",
+ kernel_start, kernel_size, kernel_load_address));
+
/*
* Now read the rest of the kernel image into memory.
*/
@@ -172,7 +196,7 @@ bzImage_probe(CHAR16 *kname)
DBG_PRT((L"reading kernel image...\n"));
size = kernel_size;
- efi_status = fops_read(fd, kernel_start, &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));
free(param_start);
diff -purN '--exclude=*o' '--exclude=tags' elilo-3.8-3.35-orig1/x86_64/sysdeps.h elilo-3.8-3.35-orig_c/x86_64/sysdeps.h
--- elilo-3.8-3.35-orig1/x86_64/sysdeps.h 2008-12-08 06:03:05.000000000 -0600
+++ elilo-3.8-3.35-orig_c/x86_64/sysdeps.h 2008-12-08 06:01:52.000000000 -0600
@@ -48,6 +48,11 @@
#define INITRD_START (50*1024*1024)
/*
+ * Default start address for kernel.
+ */
+#define DEFAULT_KERNEL_START 0x100000
+
+/*
* This version must match the one in the kernel.
*
* This table was put together using information from the
@@ -307,10 +312,16 @@ typedef union x86_64_boot_params {
UINT8 *t = (UINT8 *)(to); \
UINT8 *f = (UINT8 *)(from); \
UINTN n = cnt; \
- if (t && f && n) { \
+ if (t && f && n && (t<f)) { \
while (n--) { \
*t++ = *f++; \
} \
+ } else if (t && f && n && (t>f)) { \
+ t += n; \
+ f += n; \
+ while (n--) { \
+ *t-- = *f--; \
+ } \
} \
}
@@ -343,6 +354,7 @@ extern UINTN param_size;
extern VOID *kernel_start;
extern UINTN kernel_size;
+extern VOID *kernel_load_address;
extern VOID *initrd_start;
extern UINTN initrd_size;
@@ -379,14 +391,24 @@ start_kernel(VOID *kentry, boot_params_t
asm volatile ( "cli" : : );
/*
- * Relocate initrd, if present.
+ * Relocate kernel (if needed) and initrd (if present).
+ * Copy kernel first, in case kernel was loaded overlapping where we're
+ * planning to copy the initrd. This assumes that the initrd didn't
+ * get loaded overlapping where we're planning to copy the kernel, but
+ * that's pretty unlikely since we couldn't alloc that space for the
+ * kernel (or the kernel would already be there).
*/
+ if (kernel_start != kernel_load_address) {
+ MEMCPY(kernel_start, kernel_load_address, kernel_size);
+ }
+
if (bp->s.initrd_start) {
temp = bp->s.initrd_start;
MEMCPY(INITRD_START, temp , bp->s.initrd_size);
bp->s.initrd_start = INITRD_START;
}
+
/*
* Copy boot sector, setup data and command line
* to final resting place. We need to copy
diff -purN '--exclude=*o' '--exclude=tags' elilo-3.8-3.35-orig1/x86_64/system.c elilo-3.8-3.35-orig_c/x86_64/system.c
--- elilo-3.8-3.35-orig1/x86_64/system.c 2008-12-08 06:03:25.000000000 -0600
+++ elilo-3.8-3.35-orig_c/x86_64/system.c 2008-12-08 04:51:28.000000000 -0600
@@ -105,7 +105,9 @@ UINTN high_base_mem = 0x90000;
UINTN high_ext_mem = 32 * 1024 * 1024;
/* This starting address will hold true for all of the loader types for now */
-VOID *kernel_start = (VOID *)0x100000; /* 1M */
+VOID *kernel_start = (VOID *)DEFAULT_KERNEL_START;
+/* The kernel may load elsewhere if EFI firmware reserves kernel_start */
+VOID *kernel_load_address = (VOID *)DEFAULT_KERNEL_START;
VOID *initrd_start = NULL;
UINTN initrd_size = 0;
--- elilo/fs/localfs.c
+++ elilo/fs/localfs.c
@@ -98,7 +98,7 @@
DBG_PRT((L"localfs_open on %s\n", name)); DBG_PRT((L"localfs_open on %s\n", name));
@ -213,13 +45,3 @@ diff -purN '--exclude=*o' '--exclude=tags' elilo-3.8-3.35-orig1/x86_64/system.c
if (status == EFI_SUCCESS) { if (status == EFI_SUCCESS) {
*fd = LOCALFS_F2FD(fh); *fd = LOCALFS_F2FD(fh);
} }
--- elilo/elilo.h
+++ elilo/elilo.h
@@ -151,6 +151,7 @@
extern VOID free_pages(VOID *);
extern VOID free_all(VOID);
extern INTN alloc_kmem(VOID *, UINTN);
+extern INTN alloc_kmem_anywhere(VOID **, UINTN);
extern VOID free_kmem(VOID);
extern VOID free_all_memory(VOID);

View File

@ -1,60 +1,108 @@
--- elilo/alloc.c ---
+++ elilo/alloc.c Makefile | 2 +-
@@ -110,7 +110,7 @@ alloc.c | 12 ++++++------
choosers/Makefile | 14 +++++---------
fileops.c | 2 +-
fs/Makefile | 14 +++++---------
glue_netfs.c | 4 ++++
x86_64/bzimage.c | 6 ++++--
7 files changed, 26 insertions(+), 28 deletions(-)
--- a/Makefile
+++ b/Makefile
@@ -81,7 +81,7 @@ elilo.efi: elilo.so
elilo.so: $(FILES)
-elilo.o : elilo.c
+elilo.o : elilo.c $(ARCH)/sysdeps.h
fileops.o : Make.defaults
chooser.o : Make.defaults
--- a/alloc.c
+++ b/alloc.c
@@ -110,7 +110,7 @@ alloc(UINTN size, EFI_MEMORY_TYPE type)
} }
alloc_add(tmp, size, ALLOC_POOL); alloc_add(tmp, size, ALLOC_POOL);
#ifdef DEBUG_MEM
- DBG_PRT((L"alloc: allocated %d bytes @[0x%lx-0x%lx]\n", size, tmp, tmp+size)); - DBG_PRT((L"alloc: allocated %d bytes @[" PTR_FMT "-" PTR_FMT "]\n", size, tmp, tmp+size));
+ DBG_PRT((L"alloc: allocated %d bytes @[0x%lx-0x%lx]", size, tmp, tmp+size)); + DBG_PRT((L"alloc: allocated %d bytes @[" PTR_FMT "-" PTR_FMT "]", size, tmp, tmp+size));
#endif
return tmp; return tmp;
} }
@@ -140,7 +140,7 @@ @@ -140,7 +140,7 @@ alloc_pages(UINTN pgcnt, EFI_MEMORY_TYPE
alloc_add(addr, pgcnt, ALLOC_PAGES); 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\n", pgcnt, tmp));
+ DBG_PRT((L"allocator: allocated %d pages @0x%lx", pgcnt, tmp)); + DBG_PRT((L"allocator: allocated %d pages @" PTR_FMT, pgcnt, tmp));
return addr; return addr;
} }
@@ -161,7 +161,7 @@ @@ -162,7 +162,7 @@ free(VOID *addr)
VERB_PRT(1, Print(L"allocator: invalid free @ 0x%lx\n", addr));
return; return;
found: found:
- DBG_PRT((L"free: %s @0x%lx size=%ld\n", #ifdef DEBUG_MEM
+ DBG_PRT((L"free: %s @0x%lx size=%ld", - DBG_PRT((L"free: %s @" PTR_FMT " size=%d\n",
+ DBG_PRT((L"free: %s @" PTR_FMT " size=%d",
p->type == ALLOC_POOL ? L"Pool": L"Page", p->type == ALLOC_POOL ? L"Pool": L"Page",
addr, p->size)); addr, p->size));
#endif
@@ -195,7 +195,7 @@ @@ -196,7 +196,7 @@ free_all(VOID)
while(used_allocs) { while(used_allocs) {
#ifdef DEBUG_MEM
- 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 @ " PTR_FMT "\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)); + DBG_PRT((L"free_all %a @ " PTR_FMT, used_allocs->type == ALLOC_POOL ? "pool" : "pages", used_allocs->addr));
#endif
if (used_allocs->type == ALLOC_POOL) if (used_allocs->type == ALLOC_POOL)
uefi_call_wrapper(BS->FreePool, 1, used_allocs->addr); uefi_call_wrapper(BS->FreePool, 1, used_allocs->addr);
@@ -239,13 +239,13 @@ @@ -249,7 +249,7 @@ VOID
VOID
free_kmem(VOID) free_kmem(VOID)
{ {
- DBG_PRT((L"free_kmem before (%lx, %ld)\n", kmem_addr, kmem_pgcnt)); #ifdef DEBUG_MEM
+ DBG_PRT((L"free_kmem before (%lx, %ld)", kmem_addr, kmem_pgcnt)); - DBG_PRT((L"free_kmem before (" PTR_FMT ", %d)\n", kmem_addr, kmem_pgcnt));
+ DBG_PRT((L"free_kmem before (" PTR_FMT ", %d)", kmem_addr, kmem_pgcnt));
#endif
if (kmem_addr && kmem_pgcnt != 0) { if (kmem_addr && kmem_pgcnt != 0) {
free(kmem_addr); free(kmem_addr);
kmem_addr = NULL; @@ -257,7 +257,7 @@ free_kmem(VOID)
kmem_pgcnt = 0; kmem_pgcnt = 0;
} }
- DBG_PRT((L"free_kmem after (%lx, %ld)\n", kmem_addr, kmem_pgcnt)); #ifdef DEBUG_MEM
+ DBG_PRT((L"free_kmem after (%lx, %ld)", kmem_addr, kmem_pgcnt)); - DBG_PRT((L"free_kmem after (" PTR_FMT ", %d)\n", kmem_addr, kmem_pgcnt));
+ DBG_PRT((L"free_kmem after (" PTR_FMT ", %d)", kmem_addr, kmem_pgcnt));
#endif
} }
VOID --- a/choosers/Makefile
--- elilo/fileops.c +++ b/choosers/Makefile
+++ elilo/fileops.c @@ -42,17 +42,13 @@ TARGET=choosers.o
@@ -497,7 +497,7 @@
all: $(TARGET)
-$(TARGET): check-choosers $(TOPDIR)/Make.defaults $(FILES)
+$(TARGET): $(TOPDIR)/Make.defaults $(FILES)
+ @if [ -z "$(FILES)" ]; then \
+ echo "You need to define at least one chooser in Make.defaults"; \
+ exit 1; \
+ fi
$(LD) -o $@ -r $(FILES)
clean:
$(RM) -f $(TARGET) $(FILES)
-
-check-choosers:
- @if [ -n "$(FILES)" ]; then \
- exit 0; \
- else \
- echo "You need to define at least one chooser in Make.defaults"; \
- exit 1; \
- fi
--- a/fileops.c
+++ b/fileops.c
@@ -497,7 +497,7 @@ add_dev_tab(EFI_GUID *proto, EFI_HANDLE
str2 = str == NULL ? L"Unknown" : str; str2 = str == NULL ? L"Unknown" : str;
@ -63,9 +111,34 @@
(dev_tab[idx].fops ? dev_tab[idx].fops->name: L"N/A"), str2)); (dev_tab[idx].fops ? dev_tab[idx].fops->name: L"N/A"), str2));
if (str) FreePool(str); if (str) FreePool(str);
--- elilo/glue_netfs.c --- a/fs/Makefile
+++ elilo/glue_netfs.c +++ b/fs/Makefile
@@ -167,6 +167,8 @@ @@ -54,17 +54,13 @@ all: $(TARGET)
# XXX: does not trigger recompile when changing filesystem selection
# without doing make clean.
#
-$(TARGET): check-filesystems $(TOPDIR)/Make.defaults $(FILES)
+$(TARGET): $(TOPDIR)/Make.defaults $(FILES)
+ @if [ -z "$(FILES)" ]; then \
+ echo "You need to define at least one filesystem in Make.defaults"; \
+ exit 1; \
+ fi
$(LD) -r -o $@ $(FILES)
clean:
$(RM) -f $(TARGET) $(FILES)
-check-filesystems:
- @if [ -n "$(FILES)" ]; then \
- exit 0; \
- else \
- echo "You need to define at least one filesystem in Make.defaults"; \
- exit 1; \
- fi
-
--- a/glue_netfs.c
+++ b/glue_netfs.c
@@ -153,6 +153,8 @@ netfs_setdefaults(VOID *intf, config_fil
set_var(VAR_NETFS_DOMAINAME, info.domainame); set_var(VAR_NETFS_DOMAINAME, info.domainame);
if (info.using_pxe) { if (info.using_pxe) {
@ -74,26 +147,18 @@
status = netfs->netfs_query_layer(netfs, 0, NETFS_CONFIG_LAYER, maxlen, config[0].fname); status = netfs->netfs_query_layer(netfs, 0, NETFS_CONFIG_LAYER, maxlen, config[0].fname);
if (EFI_ERROR(status)) { if (EFI_ERROR(status)) {
StrnCpy(config[0].fname, NETFS_DEFAULT_CONFIG, maxlen-1); StrnCpy(config[0].fname, NETFS_DEFAULT_CONFIG, maxlen-1);
@@ -184,7 +186,7 @@ @@ -181,6 +183,8 @@ netfs_setdefaults(VOID *intf, config_fil
# if defined(CONFIG_ia64) # endif
# 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" # define CONFIG_EXTENSION L".conf\0"
+
+ DBG_PRT((L"netfs_setdefaults: not using_pxe, machine specific")); + DBG_PRT((L"netfs_setdefaults: machine specific (!using_pxe)"));
len = StrLen(CONFIG_ARCH_EXTENSION) + 1;
/* /*
* will try machine/subnet specific files first. * will try machine/subnet specific files first.
--- elilo/x86_64/bzimage.c * the filenames are constructed based on the IP(v4) address
+++ elilo/x86_64/bzimage.c --- a/x86_64/bzimage.c
@@ -193,18 +193,20 @@ +++ b/x86_64/bzimage.c
@@ -295,18 +295,20 @@ bzImage_probe(CHAR16 *kname)
* Now read the rest of the kernel image into memory. * Now read the rest of the kernel image into memory.
*/ */

View File

@ -1,44 +0,0 @@
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

@ -1,6 +1,6 @@
From: Bernhard Walle <bwalle@suse.de> From: Bernhard Walle <bwalle@suse.de>
Subject: [PATCH] Fix possible array length overflow Subject: [PATCH] Fix possible array length overflow
References: 256676 References: bnc#256676
Found by dan.yeisley@unisys.com. Found by dan.yeisley@unisys.com.
@ -8,19 +8,18 @@ Found by dan.yeisley@unisys.com.
Signed-off-by: Bernhard Walle <bwalle@suse.de> Signed-off-by: Bernhard Walle <bwalle@suse.de>
--- ---
choosers/simple.c | 4 +++- choosers/simple.c | 3 ++-
1 file changed, 3 insertions(+), 1 deletion(-) 1 file changed, 2 insertions(+), 1 deletion(-)
--- a/choosers/simple.c --- a/choosers/simple.c
+++ b/choosers/simple.c +++ b/choosers/simple.c
@@ -283,8 +283,10 @@ restart: @@ -290,8 +290,9 @@ restart:
}
if (elilo_opt.prompt) { if (elilo_opt.prompt) {
console_textmode();
- ret = select_kernel(buffer, sizeof(buffer)); - ret = select_kernel(buffer, sizeof(buffer));
+ ret = select_kernel(buffer, CMDLINE_MAXLEN); + ret = select_kernel(buffer, CMDLINE_MAXLEN);
if (ret == -1) return -1; if (ret == -1) return -1;
+
+ /* this function takes really the number of bytes ... */ + /* this function takes really the number of bytes ... */
argc = argify(buffer,sizeof(buffer), argv); argc = argify(buffer,sizeof(buffer), argv);
index = 0; index = 0;

View File

@ -1,10 +1,15 @@
From: Jarrod Johnson <jbjohnso@us.ibm.com> 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. Fix StrnCpy bug that would overflow dst buffer if length of src met or
diff -urN elilo/strops.c elilo-strncpy-overflow-fix/strops.c exceeded passed size value.
--- 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 @@ strops.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--- a/strops.c
+++ b/strops.c
@@ -41,11 +41,11 @@ StrnCpy(OUT CHAR16 *dst, IN const CHAR16
{ {
CHAR16 *res = dst; CHAR16 *res = dst;
@ -18,7 +23,7 @@ diff -urN elilo/strops.c elilo-strncpy-overflow-fix/strops.c
return res; return res;
} }
@@ -55,11 +55,11 @@ @@ -55,11 +55,11 @@ StrnXCpy(OUT CHAR8 *dst, IN const CHAR16
{ {
CHAR8 *res = dst; CHAR8 *res = dst;
@ -32,7 +37,7 @@ diff -urN elilo/strops.c elilo-strncpy-overflow-fix/strops.c
return res; return res;
} }
@@ -76,11 +76,11 @@ @@ -76,11 +76,11 @@ strncpya(OUT CHAR8 *dst, IN const CHAR8
{ {
CHAR8 *res = dst; CHAR8 *res = dst;

View File

@ -1,6 +1,8 @@
References: 242702 From: Bernhard Walle <bwalle@suse.de>
Subject: Increase command line size to 2048 chars.
References: bnc#242702
Increase command line size to 2048 chars. Signed-off-by: Bernhard Walle <bwalle@suse.de>
--- ---
choosers/simple.c | 10 +++++----- choosers/simple.c | 10 +++++-----
@ -12,7 +14,7 @@ Increase command line size to 2048 chars.
--- a/choosers/simple.c --- a/choosers/simple.c
+++ b/choosers/simple.c +++ b/choosers/simple.c
@@ -36,8 +36,8 @@ static VOID @@ -41,8 +41,8 @@ static VOID
display_label_info(CHAR16 *name) display_label_info(CHAR16 *name)
{ {
CHAR16 *desc; CHAR16 *desc;
@ -23,7 +25,7 @@ Increase command line size to 2048 chars.
CHAR16 options_tmp[CMDLINE_MAXLEN]; CHAR16 options_tmp[CMDLINE_MAXLEN];
CHAR16 options[CMDLINE_MAXLEN]; CHAR16 options[CMDLINE_MAXLEN];
CHAR16 kname[FILENAME_MAXLEN]; CHAR16 kname[FILENAME_MAXLEN];
@@ -248,10 +248,10 @@ simple_choose(CHAR16 **argv, INTN argc, @@ -254,10 +254,10 @@ simple_choose(CHAR16 **argv, INTN argc,
# define BOOT_IMG_STR L"BOOT_IMAGE=" # define BOOT_IMG_STR L"BOOT_IMAGE="
CHAR16 buffer[CMDLINE_MAXLEN]; CHAR16 buffer[CMDLINE_MAXLEN];
CHAR16 alt_buffer[CMDLINE_MAXLEN]; CHAR16 alt_buffer[CMDLINE_MAXLEN];
@ -39,7 +41,7 @@ Increase command line size to 2048 chars.
UINTN len; UINTN len;
--- a/choosers/textmenu.c --- a/choosers/textmenu.c
+++ b/choosers/textmenu.c +++ b/choosers/textmenu.c
@@ -362,10 +362,10 @@ textmenu_choose(CHAR16 **argv, INTN argc @@ -363,10 +363,10 @@ textmenu_choose(CHAR16 **argv, INTN argc
{ {
# define BOOT_IMG_STR L"BOOT_IMAGE=" # define BOOT_IMG_STR L"BOOT_IMAGE="
CHAR16 label[CMDLINE_MAXLEN]; CHAR16 label[CMDLINE_MAXLEN];
@ -55,7 +57,7 @@ Increase command line size to 2048 chars.
UINTN len; UINTN len;
--- a/config.c --- a/config.c
+++ b/config.c +++ b/config.c
@@ -51,7 +51,7 @@ @@ -56,7 +56,7 @@
*/ */
#define ELILO_DEFAULT_CONFIG L"elilo.conf" #define ELILO_DEFAULT_CONFIG L"elilo.conf"
@ -64,7 +66,7 @@ Increase command line size to 2048 chars.
#define CONFIG_BUFSIZE 512 /* input buffer size */ #define CONFIG_BUFSIZE 512 /* input buffer size */
/* /*
@@ -66,7 +66,7 @@ typedef struct boot_image { @@ -71,7 +71,7 @@ typedef struct boot_image {
struct boot_image *next; struct boot_image *next;
CHAR16 label[MAX_STRING]; CHAR16 label[MAX_STRING];
CHAR16 kname[FILENAME_MAXLEN]; CHAR16 kname[FILENAME_MAXLEN];
@ -73,7 +75,7 @@ Increase command line size to 2048 chars.
CHAR16 initrd[FILENAME_MAXLEN]; CHAR16 initrd[FILENAME_MAXLEN];
CHAR16 vmcode[FILENAME_MAXLEN]; CHAR16 vmcode[FILENAME_MAXLEN];
CHAR16 root[FILENAME_MAXLEN]; CHAR16 root[FILENAME_MAXLEN];
@@ -95,7 +95,7 @@ typedef struct { @@ -100,7 +100,7 @@ typedef struct {
CHAR16 root[FILENAME_MAXLEN]; /* globally defined root fs */ CHAR16 root[FILENAME_MAXLEN]; /* globally defined root fs */
CHAR16 initrd[FILENAME_MAXLEN];/* globally defined initrd */ CHAR16 initrd[FILENAME_MAXLEN];/* globally defined initrd */
CHAR16 vmcode[FILENAME_MAXLEN];/* globally defined boot-time module */ CHAR16 vmcode[FILENAME_MAXLEN];/* globally defined boot-time module */
@ -84,7 +86,7 @@ Increase command line size to 2048 chars.
CHAR16 chooser[FILENAME_MAXLEN];/* which image chooser to use */ CHAR16 chooser[FILENAME_MAXLEN];/* which image chooser to use */
--- a/elilo.c --- a/elilo.c
+++ b/elilo.c +++ b/elilo.c
@@ -87,7 +87,7 @@ do_kernel_load(CHAR16 *kname, kdesc_t *k @@ -93,7 +93,7 @@ do_kernel_load(CHAR16 *kname, kdesc_t *k
INTN INTN
kernel_load(EFI_HANDLE image, CHAR16 *kname, kdesc_t *kd, memdesc_t *imem, memdesc_t *mmem) kernel_load(EFI_HANDLE image, CHAR16 *kname, kdesc_t *kd, memdesc_t *imem, memdesc_t *mmem)
{ {
@ -95,7 +97,7 @@ Increase command line size to 2048 chars.
* Do the vm image switch here * Do the vm image switch here
--- a/elilo.h --- a/elilo.h
+++ b/elilo.h +++ b/elilo.h
@@ -57,7 +57,8 @@ @@ -69,7 +69,8 @@
#define ELILO_DEFAULT_TIMEOUT ELILO_TIMEOUT_INFINITY #define ELILO_DEFAULT_TIMEOUT ELILO_TIMEOUT_INFINITY
#define ELILO_TIMEOUT_INFINITY (~0UL) #define ELILO_TIMEOUT_INFINITY (~0UL)
@ -105,4 +107,3 @@ Increase command line size to 2048 chars.
#define FILENAME_MAXLEN 256 #define FILENAME_MAXLEN 256
#define MAX_ARGS 256 #define MAX_ARGS 256
/* Just pick an arbitrary number that's high enough for now :o) */ /* Just pick an arbitrary number that's high enough for now :o) */

View File

@ -1,20 +0,0 @@
--- config.c
+++ config.c
@@ -580,7 +580,7 @@
*/
tok = get_token(numstr, MAX_STRING);
if (tok != TOK_EQUAL) {
- config_error(L"Option %s expects an equal signal + value", p->name);
+ config_error(L"Option %s expects an equal sign + value", p->name);
return -1;
}
@@ -673,7 +673,7 @@
*/
tok = get_token(str, maxlen);
if (tok != TOK_EQUAL) {
- config_error(L"Option %s expects an equal signal + %s", p->name, msg);
+ config_error(L"Option %s expects an equal sign + %s", p->name, msg);
return -1;
}

View File

@ -1,5 +1,11 @@
--- elilo/x86_64/config.c ---
+++ elilo/x86_64/config.c x86_64/config.c | 19 ++++++++++++++++---
x86_64/sysdeps.h | 4 +++-
x86_64/system.c | 4 ++++
3 files changed, 23 insertions(+), 4 deletions(-)
--- a/x86_64/config.c
+++ b/x86_64/config.c
@@ -33,15 +33,23 @@ @@ -33,15 +33,23 @@
typedef struct { typedef struct {
@ -24,7 +30,7 @@
/* /*
* X86_64 operations that need to be done only once and just before * X86_64 operations that need to be done only once and just before
* entering the main loop of the loader * entering the main loop of the loader
@@ -81,6 +89,14 @@ @@ -81,6 +89,14 @@ x86_64_use_legacy_free_boot(VOID)
return x86_64_gconf.legacy_free_boot ? 1 : 0; return x86_64_gconf.legacy_free_boot ? 1 : 0;
} }
@ -39,7 +45,7 @@
INTN INTN
sysdeps_register_options(VOID) sysdeps_register_options(VOID)
{ {
@@ -89,14 +105,11 @@ @@ -89,14 +105,11 @@ sysdeps_register_options(VOID)
ret = register_config_options(sysdeps_global_options, ret = register_config_options(sysdeps_global_options,
sizeof(sysdeps_global_options)/sizeof(config_option_t), sizeof(sysdeps_global_options)/sizeof(config_option_t),
OPTIONS_GROUP_GLOBAL); OPTIONS_GROUP_GLOBAL);
@ -54,9 +60,9 @@
return ret; return ret;
} }
--- elilo/x86_64/sysdeps.h --- a/x86_64/sysdeps.h
+++ elilo/x86_64/sysdeps.h +++ b/x86_64/sysdeps.h
@@ -369,6 +369,7 @@ @@ -364,6 +364,7 @@ extern UINT8 rmswitch_image[];
extern UINTN rmswitch_size; extern UINTN rmswitch_size;
extern INTN x86_64_use_legacy_free_boot(); extern INTN x86_64_use_legacy_free_boot();
@ -64,7 +70,7 @@
/* /*
* How to jump to kernel code * How to jump to kernel code
@@ -471,7 +472,8 @@ @@ -457,7 +458,8 @@ start_kernel(VOID *kentry, boot_params_t
} }
typedef struct sys_img_options { typedef struct sys_img_options {
@ -74,9 +80,9 @@
} sys_img_options_t; } sys_img_options_t;
#endif /* __ELILO_SYSDEPS_X86_64_H__ */ #endif /* __ELILO_SYSDEPS_X86_64_H__ */
--- elilo/x86_64/system.c --- a/x86_64/system.c
+++ elilo/x86_64/system.c +++ b/x86_64/system.c
@@ -198,6 +198,10 @@ @@ -251,6 +251,10 @@ static INTN get_video_info(boot_params_t
UINTN size1; UINTN size1;
UINT8 i; UINT8 i;

View File

@ -0,0 +1,186 @@
---
x86_64/sysdeps.h | 34 +++++++++++++---------------------
x86_64/system.c | 34 +++++++---------------------------
2 files changed, 20 insertions(+), 48 deletions(-)
--- a/x86_64/sysdeps.h
+++ b/x86_64/sysdeps.h
@@ -107,12 +107,12 @@ typedef union x86_64_boot_params {
/* 0x06 */ UINT8 orig_video_mode; /* LDR */
/* 0x07 */ UINT8 orig_video_cols; /* LDR */
-/* 0x08 */ UINT16 unused_1; /* unused */
+/* 0x08 */ UINT16 pad_1; /* unused */
/* %%TBD */
/* 0x0A */ UINT16 orig_ega_bx; /* LDR */
-/* 0x0C */ UINT16 unused_2; /* unused */
+/* 0x0C */ UINT16 pad_2; /* unused */
/* Screen height before passing control to kernel. */
/* 0x0E */ UINT8 orig_video_rows; /* LDR */
@@ -174,7 +174,7 @@ typedef union x86_64_boot_params {
/* 0x4E */ UINT32 bios_code_len; /* LDR */
/* 0x52 */ UINT16 bios_data_len; /* LDR */
-/* 0x54 */ UINT8 unused_3[0x2C]; /* unused */
+/* 0x54 */ UINT8 pad_3[0x2C]; /* unused */
/* %%TBD */
/* 0x80 */ UINT8 hd0_info[0x10]; /* LDR */
@@ -184,7 +184,7 @@ typedef union x86_64_boot_params {
/* 0xA0 */ UINT16 mca_info_len; /* LDR */
/* 0xA2 */ UINT8 mca_info_buf[0x10]; /* LDR */
-/* 0xB2 */ UINT8 unused_4[0x10E]; /* unused */
+/* 0xB2 */ UINT8 pad_4[0x10E]; /* unused */
/* EFI boot loader signature. */
/* 0x1C0 */ UINT8 efi_loader_sig[4]; /* LDR */
@@ -209,9 +209,9 @@ typedef union x86_64_boot_params {
/* Available contiguous extended memory in KB. */
/* 0x1E0 */ UINT32 alt_mem_k; /* LDR */
-/* 0x1E4 */ UINT32 unused_51; /* unused */
+/* 0x1E4 */ UINT32 pad_51; /* unused */
/* 0x1E8 */ UINT8 e820_nrmap;
-/* 0x1E9 */ UINT32 unused_52[2]; /* unused */
+/* 0x1E9 */ UINT32 pad_52[2]; /* unused */
/* Size of setup code in sectors (1 sector == 512 bytes). */
/* 0x1F1 */ UINT8 setup_sectors; /* BLD */
@@ -220,15 +220,10 @@ typedef union x86_64_boot_params {
/* 0x1F2 */ UINT16 mount_root_rdonly; /* BLD */
/* %%TBD */
-/* 0x1F4 */ UINT16 sys_size; /* BLD */
+/* 0x1F4 */ UINT32 sys_size; /* BLD */
/* %%TBD */
-/* 0x1F6 */ UINT16 swap_dev; /* BLD */
-
-/* %%TBD */
-/* 0x1F8 */ UINT16 ramdisk_flags; /* BLD */
-#define RAMDISK_PROMPT 0x8000
-#define RAMDISK_LOAD 0x4000
+/* 0x1F8 */ UINT16 ram_size_DNU; /* BLD */
/* %%TBD */
/* 0x1FA */ UINT16 video_mode_flag; /* BLD */
@@ -236,12 +231,8 @@ typedef union x86_64_boot_params {
/* %%TBD */
/* 0x1FC */ UINT16 orig_root_dev; /* BLD */
-/* 0x1FE */ UINT8 unused_6; /* unused */
-
/* %%TBD */
-/* 0x1FF */ UINT8 aux_dev_info; /* LDR */
-#define NO_MOUSE 0x00
-#define FOUND_MOUSE 0xAA
+/* 0x1FE */ UINT16 boot_flag; /* ? */
/* Jump past setup data (not used in EFI). */
/* 0x200 */ UINT16 jump; /* BLD */
@@ -283,16 +274,17 @@ typedef union x86_64_boot_params {
/* 0x21C */ UINT32 initrd_size; /* LDR */
/* %%TBD */
-/* 0x220 */ UINT32 bootsect_helper; /* BLD */
+/* 0x220 */ UINT32 bootsect_helper_DNU; /* BLD */
/* %%TBD */
/* 0x224 */ UINT16 heap_end_ptr; /* LDR */
/* %%TBD */
-/* 0x226 */ UINT16 unused_7; /* LDR */
+/* 0x226 */ UINT8 ext_loader_ver; /* LDR */
+/* 0x227 */ UINT8 ext_loader_type; /* LDR */
/* 0x228 */ UINT32 cmdline_addr; /* LDR */
-/* 0x22C */ UINT32 unused_8[41];
+/* 0x22C */ UINT32 pad_8[41];
/* 0x2D0 */ UINT8 e820_map[2560];
} s;
} boot_params_t;
--- a/x86_64/system.c
+++ b/x86_64/system.c
@@ -493,17 +493,9 @@ sysdeps_create_boot_params(
hdr_version = (bp->s.hdr_major << 8) | bp->s.hdr_minor;
/*
- * Clear out unused memory in boot sector image.
+ * Do NOT clear out unknown memory in boot sector image.
+ * This breaks boot protocol >= 2.10 (2.6.31).
*/
- bp->s.unused_1 = 0;
- bp->s.unused_2 = 0;
- ZeroMem(&bp->s.unused_3, sizeof bp->s.unused_3);
- ZeroMem(&bp->s.unused_4, sizeof bp->s.unused_4);
- ZeroMem(&bp->s.unused_51, sizeof bp->s.unused_51);
- ZeroMem(&bp->s.unused_52, sizeof bp->s.unused_52);
- bp->s.unused_6 = 0;
- bp->s.unused_7 = 0;
- ZeroMem(bp->s.unused_8, sizeof bp->s.unused_8);
/*
* Tell kernel this was loaded by an advanced loader type.
@@ -553,19 +545,14 @@ sysdeps_create_boot_params(
DBG_PRT((L"initrd->start_addr="PTR_FMT" initrd->pgcnt=%d\n",
initrd->start_addr, initrd->pgcnt));
- /* These RAMdisk flags are not needed, just zero them. */
- bp->s.ramdisk_flags = 0;
+ /* These RAMdisk flags are not needed, just zero them. NOT!*/
+ /* 'ramdisk_flags' (@0x1F8) is called 'ram_size' in the meantime, */
+ /* see Documentation/x86/boot.txt. */
if (initrd->start_addr && initrd->pgcnt) {
/* %%TBD - This will probably have to be changed. */
bp->s.initrd_start = (UINT32)(UINT64)initrd->start_addr;
bp->s.initrd_size = (UINT32)(initrd->size);
- /*
- * This is the RAMdisk root device for RedHat 2.2.x
- * kernels (major 0x01, minor 0x00).
- */
-
- bp->s.orig_root_dev = 0x0100;
} else {
bp->s.initrd_start = 0;
bp->s.initrd_size = 0;
@@ -590,11 +577,6 @@ sysdeps_create_boot_params(
ZeroMem(bp->s.mca_info_buf, sizeof bp->s.mca_info_buf);
/*
- * Pointing device presence. The kernel will detect this.
- */
- bp->s.aux_dev_info = NO_MOUSE;
-
- /*
* EFI loader signature
*/
CopyMem(bp->s.efi_loader_sig, EFI_LOADER_SIG_X64, 4);
@@ -692,11 +674,9 @@ sysdeps_create_boot_params(
CHECK_OFFSET(setup_sectors, 0x1F1, L"%xh");
CHECK_OFFSET(mount_root_rdonly, 0x1F2, L"%xh");
CHECK_OFFSET(sys_size, 0x1F4, L"%xh");
- CHECK_OFFSET(swap_dev, 0x1F6, L"%xh");
- CHECK_OFFSET(ramdisk_flags, 0x1F8, L"%xh");
CHECK_OFFSET(video_mode_flag, 0x1FA, L"%xh");
CHECK_OFFSET(orig_root_dev, 0x1FC, L"%xh");
- CHECK_OFFSET(aux_dev_info, 0x1FF, L"%xh");
+ CHECK_OFFSET(boot_flag, 0x1FE, L"%xh");
CHECK_OFFSET(jump, 0x200, L"%xh");
CHECK_OFFSET(setup_sig, 0x202, L"'%-4.4a'");
CHECK_OFFSET(hdr_minor, 0x206, L"%xh");
@@ -710,9 +690,9 @@ sysdeps_create_boot_params(
CHECK_OFFSET(kernel_start, 0x214, L"%xh");
CHECK_OFFSET(initrd_start, 0x218, L"%xh");
CHECK_OFFSET(initrd_size, 0x21C, L"%xh");
- CHECK_OFFSET(bootsect_helper, 0x220, L"%xh");
CHECK_OFFSET(heap_end_ptr, 0x224, L"%xh");
CHECK_OFFSET(cmdline_addr, 0x228, L"%xh");
+ CHECK_OFFSET(e820_map, 0x2D0, L"%xh");
if (test) {
ERR_PRT((L"Boot sector and/or setup parameter alignment error."));

230
elilo-x86-64-e820-max.diff Normal file
View File

@ -0,0 +1,230 @@
---
bootparams.c | 2
x86_64/system.c | 139 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
2 files changed, 134 insertions(+), 7 deletions(-)
--- a/bootparams.c
+++ b/bootparams.c
@@ -96,6 +96,8 @@ create_boot_params(CHAR16 *args, memdesc
*/
Memset(bp, 0, BOOT_PARAM_MEMSIZE);
+ U2ascii(args, cp, cmdline_size);
+
if (sysdeps_create_boot_params(bp, cp, initrd, vmcode, cookie) == -1) return 0;
/*
--- a/x86_64/system.c
+++ b/x86_64/system.c
@@ -38,11 +38,19 @@
*/
#include <efi.h>
#include <efilib.h>
+#include <string.h>
#include "elilo.h"
#include "loader.h"
#include "rmswitch.h"
+#define DEBUG_CREATE_BOOT_PARAMS 0
+#if DEBUG_CREATE_BOOT_PARAMS
+#define DPR(a) do { if (elilo_opt.debug) { Print a; } } while ( 0 )
+#else
+#define DPR(a)
+#endif
+
extern loader_ops_t bzimage_loader, plain_loader, gzip_loader;
/*
@@ -113,6 +121,8 @@ VOID *kernel_load_address = (VOID *)DEFA
VOID *initrd_start = NULL;
UINTN initrd_size = 0;
+INTN e820_map_overflow = 0;
+
INTN
sysdeps_init(EFI_HANDLE dev)
{
@@ -368,10 +378,56 @@ static INTN get_video_info(boot_params_t
return 0;
}
+CHAR16 *
+StrStr(IN const CHAR16 *h, IN const CHAR16 *n)
+{
+ const CHAR16 *t = h;
+ CHAR16 *res;
+ int len = 0, i;
+
+ len = StrLen((CHAR16 *)n);
+ while(*t != CHAR_NULL) {
+ res = StrChr( t, n[0]);
+ if (!res) return res;
+ for( i = 1; i < len && res[i] != CHAR_NULL && res[i] == n[i]; i++);
+ if ( i == len ) return res;
+ t = res + 1;
+ if (t > h + CMDLINE_MAXLEN) return (CHAR16 *)0;
+ }
+
+ return (CHAR16 *)0;
+}
+
+CHAR8 *
+StrStr8(IN const CHAR8 *h, IN const CHAR8 *n)
+{
+ const CHAR8 *t = h;
+ CHAR8 *res;
+ int len = 0, i;
+
+ len = strlena((CHAR8 *)n);
+ while(*t != 0) {
+ res = strchra( t, n[0]);
+ if (!res) return res;
+ for( i = 1; i < len && res[i] != 0 && res[i] == n[i]; i++);
+ if ( i == len ) return res;
+ t = res + 1;
+ if (t > (h + CMDLINE_MAXLEN)) return (CHAR8 *)0;
+ }
+
+ return (CHAR8 *)0;
+}
+
/* Convert EFI memory map to E820 map for the operating system
* This code is based on a Linux kernel patch submitted by Edgar Hucek
*/
+#if DEBUG_CREATE_BOOT_PARAMS
+static int e820_max = 6;
+#else
+static int e820_max = E820_MAX;
+#endif
+
/* Add a memory region to the e820 map */
static void add_memory_region (struct e820entry *e820_map,
int *e820_nr_map,
@@ -380,21 +436,56 @@ static void add_memory_region (struct e8
unsigned int type)
{
int x = *e820_nr_map;
+ static unsigned long long estart = 0ULL;
+ static unsigned long esize = 0L;
+ static unsigned int etype = -1;
+ static int merge = 0;
+
+ if (x == 0)
+ DPR((L"AMR: %3s %4s %16s/%12s/%s\n",
+ L"idx", L" ", L"start", L"size", L"type"));
- if (x == E820_MAX) {
- Print(L"Too many entries in the memory map!\n");
- return;
- }
-
+ /* merge adjacent regions of same type */
if ((x > 0) && e820_map[x-1].addr + e820_map[x-1].size == start
- && e820_map[x-1].type == type)
+ && e820_map[x-1].type == type) {
e820_map[x-1].size += size;
- else {
+ estart = e820_map[x-1].addr;
+ esize = e820_map[x-1].size;
+ etype = e820_map[x-1].type;
+ merge++;
+ return;
+ }
+ /* fill up to E820_MAX */
+ if ( x < e820_max ) {
e820_map[x].addr = start;
e820_map[x].size = size;
e820_map[x].type = type;
(*e820_nr_map)++;
+ if (merge) DPR((L"AMR: %3d ==> %016llx/%012lx/%d (%d)\n",
+ x-1, estart, esize, etype, merge));
+ merge=0;
+ DPR((L"AMR: %3d add %016llx/%012lx/%d\n",
+ x, start, size, type));
+ return;
+ }
+ /* different type means another region didn't fit */
+ /* or same type, but there's a hole */
+ if (etype != type || (estart + esize) != start) {
+ if (merge) DPR((L"AMR: %3d ===> %016llx/%012lx/%d (%d)\n",
+ e820_map_overflow, estart, esize, etype, merge));
+ merge = 0;
+ estart = start;
+ esize = size;
+ etype = type;
+ e820_map_overflow++;
+ DPR((L"AMR: %3d OVER %016llx/%012lx/%d\n",
+ e820_map_overflow, start, size, type));
+ return;
}
+ /* same type and no hole, merge it */
+ estart += esize;
+ esize += size;
+ merge++;
}
void fill_e820map(boot_params_t *bp, mmap_desc_t *mdesc)
@@ -473,6 +564,7 @@ void fill_e820map(boot_params_t *bp, mma
break;
default:
/* We should not hit this case */
+ DBG_PRT((L"hit default!?"));
add_memory_region(e820_map, &e820_nr_map,
md->PhysicalStart,
md->NumberOfPages << EFI_PAGE_SHIFT,
@@ -486,6 +578,8 @@ void fill_e820map(boot_params_t *bp, mma
/*
* x86_64 specific boot parameters initialization routine
+ *
+ * Note: debug and verbose messages have already been turned off!
*/
INTN
sysdeps_create_boot_params(
@@ -501,6 +595,12 @@ sysdeps_create_boot_params(
UINT8 row, col;
UINT8 mode;
UINT16 hdr_version;
+ UINT8 e820_map_overflow_warned = 0;
+
+#if DEBUG_CREATE_BOOT_PARAMS
+ elilo_opt.debug=1;
+ elilo_opt.verbose=5;
+#endif
DBG_PRT((L"fill_boot_params()\n"));
@@ -834,6 +934,31 @@ do_memmap:
* and update the bootparam accordingly
*/
fill_e820map(bp, &mdesc);
+
+#if DEBUG_CREATE_BOOT_PARAMS
+ if ( e820_map_overflow == 0 )
+ e820_map_overflow = -1; /* force second get_memmap()! */
+#endif
+ if (e820_map_overflow && !e820_map_overflow_warned) {
+ CHAR8 *aem = (CHAR8 *)"add_efi_memmap";
+ e820_map_overflow_warned++;
+
+#if DEBUG_CREATE_BOOT_PARAMS
+ elilo_opt.debug=0;
+ elilo_opt.verbose=0;
+#endif
+ if (e820_map_overflow == -1 || StrStr8(cmdline, aem)) {
+ /* Print(L"...mapping again, silently!\n"); */
+ goto do_memmap;
+ }
+
+ Print(L"\nCAUTION: EFI memory map has %d more entr%a"
+ " than E820 map supports.\n"
+ "To access all memory, '%a' may be necessary.\n\n",
+ e820_map_overflow, (e820_map_overflow==1)?"y":"ies",
+ aem);
+ goto do_memmap;
+ }
return 0;
}

228
elilo-x86-64-initrd.diff Normal file
View File

@ -0,0 +1,228 @@
---
elilo.h | 5 ++++
ia32/system.c | 6 +++++
ia64/system.c | 6 +++++
initrd.c | 12 +++++++++-
x86_64/sysdeps.h | 20 ++++++------------
x86_64/system.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++-------
6 files changed, 88 insertions(+), 22 deletions(-)
--- a/elilo.h
+++ b/elilo.h
@@ -54,6 +54,10 @@
#define ROUNDUP(x,a) (((x) + (a) - 1) & ~((a) - 1))
#define ROUNDDOWN(x,a) ((x) & ~((a) - 1))
+#ifndef UINT32_MAX
+#define UINT32_MAX ((UINT32)-1)
+#endif
+
/*
* Elilo Boot modes
*/
@@ -212,6 +216,7 @@ extern CHAR16 *sysdeps_get_cmdline_opts(
extern INTN sysdeps_getopt(INTN, INTN, CHAR16 *);
extern VOID sysdeps_print_cmdline_opts(VOID);
extern INTN sysdeps_register_options(VOID);
+extern VOID *sysdeps_checkfix_initrd(VOID *, memdesc_t *);
#define CHAR_SLASH L'/'
#define CHAR_BACKSLASH L'\\'
--- a/ia32/system.c
+++ b/ia32/system.c
@@ -149,6 +149,12 @@ sysdeps_initrd_get_addr(kdesc_t *kd, mem
return 0;
}
+VOID *
+sysdeps_checkfix_initrd(VOID *start_addr, memdesc_t *imem)
+{
+ return start_addr;
+}
+
VOID
sysdeps_free_boot_params(boot_params_t *bp)
{
--- a/ia64/system.c
+++ b/ia64/system.c
@@ -140,6 +140,12 @@ sysdeps_initrd_get_addr(kdesc_t *kd, mem
return 0;
}
+VOID *
+sysdeps_checkfix_initrd(VOID *start_addr, memdesc_t *imem)
+{
+ return start_addr;
+}
+
/* Flush data cache [addr; addr + len], and sync with icache. */
void
flush_dcache (CHAR8 *addr, UINT64 len)
--- a/initrd.c
+++ b/initrd.c
@@ -41,7 +41,11 @@ INTN
load_file(CHAR16 *filename, memdesc_t *image)
{
EFI_STATUS status;
- VOID *start_addr = NULL;
+ /*
+ * Actually using the value from sysdeps_initrd_get_addr()
+ * instead of NULL is no change for ia64!
+ */
+ VOID *start_addr = image->start_addr;
UINTN pgcnt;
UINT64 size = 0;
fops_fd_t fd;
@@ -71,7 +75,11 @@ load_file(CHAR16 *filename, memdesc_t *i
/* round up to get required number of pages (4KB) */
image->pgcnt = pgcnt = EFI_SIZE_TO_PAGES(image->size);
- start_addr = alloc_pages(pgcnt, EfiLoaderData, start_addr ? AllocateAddress : AllocateAnyPages, 0 );
+ start_addr = alloc_pages(pgcnt, EfiLoaderData,
+ start_addr ? AllocateAddress : AllocateAnyPages, start_addr);
+
+ start_addr = sysdeps_checkfix_initrd(start_addr, image);
+
if (start_addr == NULL) {
ERR_PRT((L"Failed to allocate %d pages for %s image", pgcnt,
filename));
--- a/x86_64/sysdeps.h
+++ b/x86_64/sysdeps.h
@@ -284,7 +284,8 @@ typedef union x86_64_boot_params {
/* 0x227 */ UINT8 ext_loader_type; /* LDR */
/* 0x228 */ UINT32 cmdline_addr; /* LDR */
-/* 0x22C */ UINT32 pad_8[41];
+/* 0x22C */ UINT32 initrd_addr_max; /* BLD */
+/* 0x230 */ UINT32 pad_8[40];
/* 0x2D0 */ UINT8 e820_map[2560];
} s;
} boot_params_t;
@@ -374,7 +375,6 @@ start_kernel(VOID *kentry, boot_params_t
UINT16 kernel_cs;
} jumpvector;
VOID *jump_start;
- uint64_t temp;
/*
* Disable interrupts.
@@ -382,22 +382,16 @@ start_kernel(VOID *kentry, boot_params_t
asm volatile ( "cli" : : );
/*
- * Relocate kernel (if needed), and initrd (if present).
- * Copy kernel first, in case kernel was loaded overlapping where we're
- * planning to copy the initrd. This assumes that the initrd didn't
- * get loaded overlapping where we're planning to copy the kernel, but
- * that's pretty unlikely since we couldn't alloc that space for the
- * kernel (or the kernel would already be there).
+ * Relocate kernel (if needed).
+ * This assumes that the initrd didn't get loaded overlapping where
+ * we're planning to copy the kernel, but that's pretty unlikely
+ * since we couldn't alloc that space for the kernel (or the kernel
+ * would already be there).
*/
if (kernel_start != kernel_load_address) {
MEMCPY(kernel_start, kernel_load_address, kernel_size);
}
- if (bp->s.initrd_start) {
- temp = bp->s.initrd_start;
- MEMCPY(INITRD_START, temp , bp->s.initrd_size);
- bp->s.initrd_start = INITRD_START;
- }
/*
* Copy boot sector, setup data and command line
* to final resting place. We need to copy
--- a/x86_64/system.c
+++ b/x86_64/system.c
@@ -131,10 +131,8 @@ sysdeps_init(EFI_HANDLE dev)
/*
* initrd_get_addr()
* Compute a starting address for the initial RAMdisk image.
- * For now, this image is placed immediately after the end of
- * the kernel memory. Inside the start_kernel() code, the
- * RAMdisk image will be relocated to the top of available
- * extended memory.
+ * For now we suggest 'initrd_addr_max' with room for 32MB,
+ * as image->pgcnt is not initialized yet.
*/
INTN
sysdeps_initrd_get_addr(kdesc_t *kd, memdesc_t *imem)
@@ -146,10 +144,12 @@ sysdeps_initrd_get_addr(kdesc_t *kd, mem
return -1;
}
- VERB_PRT(3, Print(L"kstart="PTR_FMT" kentry="PTR_FMT" kend="PTR_FMT"\n",
- kd->kstart, kd->kentry, kd->kend));
+ VERB_PRT(3, Print(L"initrd_addr_max="PTR_FMT" reserve=%d\n",
+ param_start->s.initrd_addr_max, 32*MB));
- imem->start_addr = kd->kend;
+ imem->start_addr = (VOID *)
+ (((UINT64)param_start->s.initrd_addr_max - 32*MB + 1)
+ & ~EFI_PAGE_MASK);
VERB_PRT(3, Print(L"initrd start_addr="PTR_FMT" pgcnt=%d\n",
imem->start_addr, imem->pgcnt));
@@ -157,6 +157,48 @@ sysdeps_initrd_get_addr(kdesc_t *kd, mem
return 0;
}
+
+/*
+ * checkfix_initrd()
+ * Check and possibly fix allocation of initrd memory.
+ */
+VOID *
+sysdeps_checkfix_initrd(VOID *start_addr, memdesc_t *imem)
+{
+ UINTN pgcnt = EFI_SIZE_TO_PAGES(imem->size);
+ UINT64 initrd_addr_max = (UINT64)param_start->s.initrd_addr_max;
+ UINT64 ki_max = initrd_addr_max - imem->size + 1;
+ VOID *ki_max_addr;
+
+ VERB_PRT( 3, Print(L"loadfile: start_addr="PTR_FMT
+ " ki_max_addr="PTR_FMT"\n", start_addr, (VOID *)ki_max));
+ if (ki_max > UINT32_MAX) {
+ ERR_PRT((L"Force kernel specified initrd_addr_max="PTR_FMT
+ " below 4GB\n", (VOID *)initrd_addr_max));
+ ki_max = UINT32_MAX - imem->size + 1;
+ }
+ ki_max_addr = (VOID *)ki_max;
+
+ if ((UINT64)start_addr > ki_max) {
+ VERB_PRT(1, Print(L"initrd start_addr="PTR_FMT" above "
+ "limit="PTR_FMT"\n", start_addr, ki_max_addr));
+ free(start_addr);
+ start_addr = NULL;
+ }
+ /* so either the initial allocation failed or it's been to high! */
+ if (start_addr == NULL) {
+ start_addr = alloc_pages(pgcnt, EfiLoaderData,
+ AllocateMaxAddress, ki_max_addr);
+ }
+ if ((UINT64)start_addr > ki_max) {
+ ERR_PRT((L"Failed to allocate %d pages below %dMB",
+ pgcnt, (param_start->s.initrd_addr_max+1)>>20));
+ free(start_addr);
+ start_addr = NULL;
+ }
+ return start_addr;
+}
+
VOID
sysdeps_free_boot_params(boot_params_t *bp)
{
@@ -550,6 +592,11 @@ sysdeps_create_boot_params(
/* see Documentation/x86/boot.txt. */
if (initrd->start_addr && initrd->pgcnt) {
+ if ( (UINT64)initrd->start_addr > UINT32_MAX ) {
+ ERR_PRT((L"Start of initrd out of reach (>4GB)."));
+ free_kmem();
+ return -1;
+ }
/* %%TBD - This will probably have to be changed. */
bp->s.initrd_start = (UINT32)(UINT64)initrd->start_addr;
bp->s.initrd_size = (UINT32)(initrd->size);

257
elilo-x86-64-kernel.diff Normal file
View File

@ -0,0 +1,257 @@
---
alloc.c | 10 +++
ia32/bzimage.c | 2
x86_64/bzimage.c | 160 +++++++++++++++++++++++++++++++++++++++++++++----------
x86_64/sysdeps.h | 5 +
x86_64/system.c | 9 ++-
5 files changed, 152 insertions(+), 34 deletions(-)
--- a/alloc.c
+++ b/alloc.c
@@ -217,7 +217,15 @@ INTN
alloc_kmem_anywhere(VOID **start_addr, UINTN pgcnt)
{
void * tmp;
- if ((tmp = alloc_pages(pgcnt, EfiLoaderData, AllocateAnyPages, *start_addr)) == 0) return -1;
+ /*
+ * During "AllocateAnyPages" *start_addr will be ignored.
+ * Therefore we can safely subvert it to reuse this function with
+ * an alloc_kmem_anyhwere_below() semantic...
+ */
+ tmp = alloc_pages(pgcnt, EfiLoaderData,
+ (*start_addr) ? AllocateMaxAddress : AllocateAnyPages,
+ *start_addr);
+ if (tmp == NULL) return -1;
kmem_addr = tmp;
kmem_pgcnt = pgcnt;
--- a/ia32/bzimage.c
+++ b/ia32/bzimage.c
@@ -169,7 +169,7 @@ bzImage_probe(CHAR16 *kname)
kernel_start));
}
- kernel_load_address = kernel_start;
+ kernel_load_address = NULL; /* allocate anywhere! */
if (alloc_kmem(kernel_start, EFI_SIZE_TO_PAGES(kernel_size)) != 0) {
/*
--- a/x86_64/bzimage.c
+++ b/x86_64/bzimage.c
@@ -36,6 +36,129 @@ UINTN param_size = 0;
UINTN kernel_size = 0x800000; /* 8M (default x86_64 bzImage size limit) */
+static VOID *
+bzImage_alloc()
+{
+ UINTN pages = EFI_SIZE_TO_PAGES(kernel_size);
+ int reloc_kernel = 0;
+ VOID *kla, *kend = kernel_start + kernel_size;
+ UINT32 kalign, kmask;
+ boot_params_t *ps = param_start;
+
+ /*
+ * Get address for kernel from header, if applicable & available.
+ */
+ if ((ps->s.hdr_major < 2) ||
+ (ps->s.hdr_major == 2 && ps->s.hdr_minor < 5)) {
+ reloc_kernel = 0;
+ } else {
+ if (ps->s.kernel_start >= DEFAULT_KERNEL_START)
+ kernel_start = (void *)(UINT64)ps->s.kernel_start;
+ reloc_kernel = ps->s.relocatable_kernel;
+ kalign = ps->s.kernel_alignment;
+ kmask = kalign - 1;
+ VERB_PRT(3, Print(L"kernel header (%d.%d) suggests kernel "
+ "start at address "PTR_FMT" (%srelocatable!)\n",
+ ps->s.hdr_major, ps->s.hdr_minor, ps->s.kernel_start,
+ (reloc_kernel ? L"": L"not ")));
+ }
+
+ /*
+ * Best effort for old (< 2.6.20) and non-relocatable kernels
+ */
+ if (alloc_kmem(kernel_start, pages) == 0) {
+ VERB_PRT(3, Print(L"kernel_start: "PTR_FMT" kernel_size: %d\n",
+ kernel_start, kernel_size));
+ return kernel_start;
+ } else if ( ! reloc_kernel ) {
+ /*
+ * Couldn't get desired address--just load it anywhere and
+ * (try to) move it later. It's the only chance for non-
+ * relocatable kernels, but it breaks occassionally...
+ */
+ ERR_PRT((L"Kernel header (%d.%d) suggests kernel "
+ "start at address "PTR_FMT" (non relocatable!)\n"
+ "This address is not available, so an attempt"
+ "is made to copy the kernel there later on\n"
+ "BEWARE: this is unsupported and may not work. "
+ "Please update your kernel.\n",
+ ps->s.hdr_major, ps->s.hdr_minor, ps->s.kernel_start));
+ kla = (VOID *)(UINT32_MAX - kernel_size);
+ /* NULL would preserve the "anywhere" semantic, */
+ /* but it would not prevent allocation above 4GB! */
+
+ if (alloc_kmem_anywhere(&kla, pages) != 0) {
+ /* out of luck */
+ return NULL;
+ }
+ VERB_PRT(3, Print(L"kernel_start: "PTR_FMT
+ " kernel_size: %d loading at: "PTR_FMT"\n",
+ kernel_start, kernel_size, kla));
+ return kla;
+ }
+
+
+ /* Is 'ps->s.kernel_alignment' guaranteed to be sane? */
+ if (kalign < EFI_PAGE_SIZE) {
+ kalign = EFI_PAGE_SIZE;
+ kmask = EFI_PAGE_MASK;
+ }
+ DBG_PRT((L"alignment: kernel=0x%x efi_page=0x%x : 0x%x\n",
+ ps->s.kernel_alignment, EFI_PAGE_SIZE, kalign));
+
+ /*
+ * Couldn't get the preferred address, but luckily it's
+ * a relocatable kernel, so ...
+ *
+ * 1. use 'find_kernel_memory()' (like Itanium)
+ * 2. try out the 16 lowest possible aligned addresses (> 0)
+ * 3. get enough memory to align "creatively"
+ * 4. forget alignment (and start praying)...
+ */
+
+ /* 1. */
+ if ((find_kernel_memory(kernel_start, kend, kalign, &kla) != 0) ||
+ (alloc_kmem(kla, pages) != 0)) {
+ kla = NULL;
+ }
+
+ /* 2. */
+ if ( ! kla && (UINT64)kernel_start < kalign ) {
+ int i;
+ for ( i = 1; i < 16 && !kla; i++ ) {
+ VOID *tmp = (VOID *)((UINT64)kalign * i);
+ if (alloc_kmem(tmp, pages) == 0) {
+ kla = tmp;
+ }
+ }
+ }
+
+ /* 3. */
+ if ( ! kla ) {
+ UINTN apages = EFI_SIZE_TO_PAGES(kernel_size + kmask);
+ kla = (VOID *)(UINT32_MAX - kernel_size - kmask);
+
+ if (alloc_kmem_anywhere(&kla, apages) == 0) {
+ kla = (VOID *)(((UINT64)kla + kmask) & ~kmask);
+ } else {
+ kla = NULL;
+ }
+ }
+
+ /* 4. last resort */
+ if ( ! kla ) {
+ kla = (VOID *)(UINT32_MAX - kernel_size);
+ if (alloc_kmem_anywhere(&kla, pages) != 0) {
+ return NULL;
+ }
+ }
+
+ kernel_start = kla;
+ VERB_PRT(1, Print(L"relocating kernel_start: "PTR_FMT
+ " kernel_size: %d\n", kernel_start, kernel_size));
+ return kla;
+}
+
static INTN
bzImage_probe(CHAR16 *kname)
{
@@ -158,37 +281,16 @@ bzImage_probe(CHAR16 *kname)
* Allocate memory for kernel.
*/
- /*
- * Get correct address for kernel from header, if applicable & available.
- */
- if ((param_start->s.hdr_major == 2) &&
- (param_start->s.hdr_minor >= 6) &&
- (param_start->s.kernel_start >= DEFAULT_KERNEL_START)) {
- kernel_start = (void *)param_start->s.kernel_start;
- VERB_PRT(3, Print(L"kernel header suggests kernel start at address "PTR_FMT"\n",
- kernel_start));
- }
-
- kernel_load_address = kernel_start;
-
- if (alloc_kmem(kernel_start, EFI_SIZE_TO_PAGES(kernel_size)) != 0) {
- /*
- * Couldn't get desired address--just load it anywhere and move it later.
- * (Easier than relocating kernel, and also works with non-relocatable kernels.)
- */
- if (alloc_kmem_anywhere(&kernel_load_address, EFI_SIZE_TO_PAGES(kernel_size)) != 0) {
- ERR_PRT((L"Could not allocate memory for kernel."));
- free(param_start);
- param_start = NULL;
- param_size = 0;
- fops_close(fd);
- return -1;
- }
+ kernel_load_address = bzImage_alloc();
+ if ( ! kernel_load_address ) {
+ ERR_PRT((L"Could not allocate memory for kernel."));
+ free(param_start);
+ param_start = NULL;
+ param_size = 0;
+ fops_close(fd);
+ return -1;
}
- VERB_PRT(3, Print(L"kernel_start: "PTR_FMT" kernel_size: %d loading at: "PTR_FMT"\n",
- kernel_start, kernel_size, kernel_load_address));
-
/*
* Now read the rest of the kernel image into memory.
*/
--- a/x86_64/sysdeps.h
+++ b/x86_64/sysdeps.h
@@ -285,7 +285,10 @@ typedef union x86_64_boot_params {
/* 0x228 */ UINT32 cmdline_addr; /* LDR */
/* 0x22C */ UINT32 initrd_addr_max; /* BLD */
-/* 0x230 */ UINT32 pad_8[40];
+/* 0x230 */ UINT32 kernel_alignment; /* BLD */
+/* 0x234 */ UINT8 relocatable_kernel; /* BLD */
+/* 0x235 */ UINT8 pad_8[3];
+/* 0x238 */ UINT32 pad_9[38];
/* 0x2D0 */ UINT8 e820_map[2560];
} s;
} boot_params_t;
--- a/x86_64/system.c
+++ b/x86_64/system.c
@@ -105,10 +105,10 @@ UINTN high_base_mem = 0x90000;
UINTN high_ext_mem = 32 * 1024 * 1024;
/* This starting address will hold true for all of the loader types for now */
-VOID *kernel_start = (void *)DEFAULT_KERNEL_START;
+VOID *kernel_start = (VOID *)DEFAULT_KERNEL_START;
/* The kernel may load elsewhere if EFI firmware reserves kernel_start */
-VOID *kernel_load_address = DEFAULT_KERNEL_START;
+VOID *kernel_load_address = (VOID *)DEFAULT_KERNEL_START;
VOID *initrd_start = NULL;
UINTN initrd_size = 0;
@@ -631,6 +631,11 @@ sysdeps_create_boot_params(
/*
* Kernel entry point.
*/
+ if ( (UINT64)kernel_start != (UINT32)(UINT64)kernel_start ) {
+ ERR_PRT((L"Start of kernel (will be) out of reach (>4GB)."));
+ free_kmem();
+ return -1;
+ }
bp->s.kernel_start = (UINT32)(UINT64)kernel_start;
/*

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Dec 17 10:51:23 UTC 2010 - coolo@novell.com
* Update to elilo-3.12 from SLE11 to fix EFI boot (bnc#659368)
- see ChangeLog for a detailed log
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Jul 20 08:16:44 CEST 2009 - coolo@novell.com Mon Jul 20 08:16:44 CEST 2009 - coolo@novell.com

View File

@ -1,5 +1,5 @@
#!/usr/bin/perl -w #!/usr/bin/perl -w
# $Id: elilo.pl,v 0.17 2008/11/12 15:57:58 rw Exp $ # $Id: elilo.pl,v 0.21 2010/12/10 20:31:09 rw Exp $
use strict; use strict;
my $C = $0; $C =~ s{^.*/}{}; my $C = $0; $C =~ s{^.*/}{};
@ -36,10 +36,9 @@ my $Disclaimer = <<EoD;
EoD EoD
$| = 1; $| = 1;
$[ = 0;
sub Version() { sub Version() {
my $v = q($Revision: 0.17 $ ); my $v = q($Revision: 0.21 $ );
$v =~ s/^\$ Rev.*:\ ([0-9.]+)\ \$\ /$1/x; $v =~ s/^\$ Rev.*:\ ([0-9.]+)\ \$\ /$1/x;
$v .= " (part of elilo-$Edition)" if ( $Edition ne "\@EDITION\@" ); $v .= " (part of elilo-$Edition)" if ( $Edition ne "\@EDITION\@" );
print "$C version $v\n"; print "$C version $v\n";
@ -101,9 +100,9 @@ sub Transfer ($$) {
} }
while ( <IN> ) { while ( <IN> ) {
next if ( m/$Reserved/xo ); next if ( m/$Reserved/xo );
if ( m{^\s*(?:image|initrd)\s*=\s*} ) { if ( m{^\s*(?:image|initrd|vmm)\s*=\s*} ) {
chomp; chomp;
s{^(\s*(image|initrd)\s*=\s*)(/\S+/)?([^/\s]+)\s*$}{$1$4}; s{^(\s*(image|initrd|vmm)\s*=\s*)(/\S+/)?([^/\s]+)\s*$}{$1$4};
my( $t, $p, $f) = ($2, $3, $4); my( $t, $p, $f) = ($2, $3, $4);
#Info( 0, "$C: $in: $.: t=$t p=$p f=$f\n"); #Info( 0, "$C: $in: $.: t=$t p=$p f=$f\n");
$_ .= "\n"; $_ .= "\n";
@ -241,7 +240,7 @@ sub Purge($) {
Info( 1, "## remove old files from '$d'\n"); Info( 1, "## remove old files from '$d'\n");
my @F = glob( "$d/*"); my @F = glob( "$d/*");
foreach my $f ( @F ) { foreach my $f ( @F ) {
next unless ( $f =~ m{.*/((vm|)linu(x|z)|initrd)-\S+$} ); next unless ( $f =~ m{.*/((vm|)linu(x|z)|initrd)(|[-.]\S+)$} );
Info( 1, "> rm $f\n"); Info( 1, "> rm $f\n");
unlink( $f) unless ($test); unlink( $f) unless ($test);
} }
@ -393,7 +392,7 @@ Info( 1, "## Using '$D'...\n");
System( 2, "mkdir", "-p", $D) unless ( -d $D ); System( 2, "mkdir", "-p", $D) unless ( -d $D );
if ( -r $Sconf ) { if ( -r $Sconf ) {
# extract kernels and initrds and write fixed .conf # extract kernels, etc. and write fixed .conf
my @F = Transfer( $Sconf, $D); my @F = Transfer( $Sconf, $D);
# remove old files # remove old files
Purge( $D); Purge( $D);

View File

@ -1,7 +1,7 @@
# #
# spec file for package elilo (Version 3.8) # spec file for package elilo (Version 3.12)
# #
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany. # Copyright (c) 2010 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
@ -17,36 +17,43 @@
# norootforbuild # norootforbuild
%ifarch x86_64
%if 0%{?suse_version} < 1100
BuildRequires: binutils219
#!BuildIgnore: binutils
%endif
%endif
BuildRequires: gnu-efi >= 3.0e
Name: elilo Name: elilo
Summary: EFI Linux Loader Summary: EFI Linux Loader
Version: 3.8 Version: 3.12
Release: 28 Release: 0
ExclusiveArch: ia64 %ix86 x86_64 ExclusiveArch: ia64 %ix86 x86_64
Group: System/Boot Group: System/Boot
AutoReqProv: on AutoReqProv: on
PreReq: /usr/bin/perl PreReq: /usr/bin/perl
License: GPL v2 or later License: GPL v2 or later
Url: http://elilo.sourceforge.net/ Url: http://elilo.sourceforge.net/
Source: http://dl.sourceforge.net/elilo/elilo-3.8.tar.gz Source: http://dl.sourceforge.net/elilo/elilo-3.12-source.tar.gz
Source1: elilo.pl Source1: elilo.pl
Source2: debian.eliloalt.man8 Source2: debian.eliloalt.man8
Source3: elilo.conf.man5 Source3: elilo.conf.man5
Source9: rpmlintrc Source9: rpmlintrc
Patch0: elilo-3.8-cvs20080127.diff Patch0: elilo-x86-64-bootproto-update.diff
Patch1: elilo-MAC.diff Patch1: elilo-x86-64-initrd.diff
Patch2: elilo-spelling.diff Patch2: elilo-x86-64-kernel.diff
Patch3: elilo-longer-commandline.diff Patch3: elilo-x86-64-e820-max.diff
Patch4: elilo-fix-possible-overflow.diff Patch4: elilo-fix-possible-overflow.diff
Patch5: elilo-avoid-tab.diff Patch5: elilo-bzimage-alloc.diff
Patch6: elilo-bzimage-alloc.diff Patch6: elilo-fix-strncpy-overflow.diff
Patch7: elilo-text-mode.diff Patch7: elilo-longer-commandline.diff
Patch8: elilo-fix-amd64-netboot.diff Patch8: elilo-avoid-tab.diff
Patch9: eliloalt-sysfs.diff Patch9: elilo-cleanup.diff
Patch10: elilo-strncpy-overflow-fix.diff Patch10: eliloalt-sysfs.diff
Patch11: elilo-cleanup.diff Patch11: elilo-MAC.diff
Patch12: elilo-text-mode.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: gnu-efi >= 3.0e
%description %description
The EFI Linux boot loader. The EFI Linux boot loader.
@ -61,10 +68,10 @@ Authors:
Brett Johnson <brett@hp.com> Brett Johnson <brett@hp.com>
%prep %prep
%setup -q -n elilo %setup -q
%patch0 -p1 %patch0 -p1
%patch1 -p1 %patch1 -p1
%patch2 %patch2 -p1
%patch3 -p1 %patch3 -p1
%patch4 -p1 %patch4 -p1
%patch5 -p1 %patch5 -p1
@ -74,23 +81,25 @@ Authors:
%patch9 -p1 %patch9 -p1
%patch10 -p1 %patch10 -p1
%patch11 -p1 %patch11 -p1
perl -pe 's{\@EDITION\@}{%{version}-%{release}}; %patch12 -p1
s{\@LIBEXECDIR\@}{%{_libdir}};
s{\@ARCH\@}{%{_target_cpu}};
' < %{SOURCE1} > elilo.pl &&
perl -pi -e 's{/usr/lib}{%{_libdir}}' Make.defaults
chmod 555 elilo.pl && touch -r %{SOURCE1} elilo.pl
! fgrep '%%{version}-%%{release}' elilo.pl
%build %build
perl -pi -e 's{/usr/lib}{%{_libdir}}' Make.defaults
make OPTIMFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -fno-stack-protector" make OPTIMFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -fno-stack-protector"
perl -pe 's{\@EDITION\@}{%{version}-%{release}};
s{\@LIBDIR\@}{%{_libdir}};
s{\@ARCH\@}{%{_target_cpu}};
' < %{SOURCE1} > elilo.pl &&
chmod 555 elilo.pl && touch -r %{SOURCE1} elilo.pl
! grep -F '%%{version}-%%{release}' elilo.pl
pod2man -s 8 -c "System Boot" -r "SuSE Linux" \ pod2man -s 8 -c "System Boot" -r "SuSE Linux" \
-n elilo -d "%{version}-%{release}" elilo.pl elilo.8 -n elilo -d "%{version}-%{release}" elilo.pl elilo.8
touch -r elilo.pl elilo.8 touch -r elilo.pl elilo.8
%install %install
install -d $RPM_BUILD_ROOT%{_libdir}/efi $RPM_BUILD_ROOT/sbin install -d $RPM_BUILD_ROOT%{_libdir}/efi $RPM_BUILD_ROOT/sbin
install -m 444 elilo.efi $RPM_BUILD_ROOT%{_libdir}/efi install -p -m 444 elilo.efi $RPM_BUILD_ROOT%{_libdir}/efi
install tools/eliloalt $RPM_BUILD_ROOT/sbin install tools/eliloalt $RPM_BUILD_ROOT/sbin
install -p -m 555 elilo.pl $RPM_BUILD_ROOT/sbin/elilo install -p -m 555 elilo.pl $RPM_BUILD_ROOT/sbin/elilo
install -D -p -m 644 elilo.8 $RPM_BUILD_ROOT/usr/share/man/man8/elilo.8 install -D -p -m 644 elilo.8 $RPM_BUILD_ROOT/usr/share/man/man8/elilo.8
@ -106,7 +115,7 @@ echo "Please run /sbin/elilo!"
%files %files
%defattr(-, root, root) %defattr(-, root, root)
%doc README README.* TODO docs/*.txt %doc README README.* TODO docs/*.txt ChangeLog
%{_libdir}/efi %{_libdir}/efi
/sbin/elilo /sbin/elilo
/sbin/eliloalt /sbin/eliloalt

View File

@ -1,3 +1,7 @@
---
tools/eliloalt.c | 33 ++++++++++++++++++++++-----------
1 file changed, 22 insertions(+), 11 deletions(-)
--- a/tools/eliloalt.c --- a/tools/eliloalt.c
+++ b/tools/eliloalt.c +++ b/tools/eliloalt.c
@@ -47,8 +47,10 @@ @@ -47,8 +47,10 @@
@ -12,7 +16,7 @@
#define EFI_VARIABLE_NON_VOLATILE 0x0000000000000001 #define EFI_VARIABLE_NON_VOLATILE 0x0000000000000001
#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x0000000000000002 #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x0000000000000002
@@ -80,7 +82,9 @@ @@ -80,7 +82,9 @@ typedef struct _efi_variable_t {
uint32_t attributes; uint32_t attributes;
} __attribute__((packed)) efi_variable_t; } __attribute__((packed)) efi_variable_t;
@ -22,7 +26,7 @@
static struct option cmd_options[]={ static struct option cmd_options[]={
{ "version", 0, 0, 1}, { "version", 0, 0, 1},
@@ -129,9 +133,15 @@ @@ -129,9 +133,15 @@ check_proc_efi(int find_entry)
if (getuid() != 0) { if (getuid() != 0) {
fatal_error("This program must be run as root\n"); fatal_error("This program must be run as root\n");
} }
@ -40,7 +44,7 @@
} }
if (!find_entry) { if (!find_entry) {
closedir(efi_vars); closedir(efi_vars);
@@ -143,9 +153,10 @@ @@ -143,9 +153,10 @@ check_proc_efi(int find_entry)
break; break;
} }
if (entry == NULL) { if (entry == NULL) {
@ -53,7 +57,7 @@
closedir(efi_vars); closedir(efi_vars);
return name; return name;
} }
@@ -158,7 +169,7 @@ @@ -158,7 +169,7 @@ delete_var(void)
check_proc_efi(0); check_proc_efi(0);
@ -62,7 +66,7 @@
if (fd == -1) { if (fd == -1) {
fatal_error("variable not defined\n"); fatal_error("variable not defined\n");
} }
@@ -176,7 +187,7 @@ @@ -176,7 +187,7 @@ delete_var(void)
r = write(fd, &var, sizeof(var)); r = write(fd, &var, sizeof(var));
if (r != sizeof(var)) { if (r != sizeof(var)) {
@ -71,7 +75,7 @@
} }
close(fd); close(fd);
} }
@@ -191,7 +202,7 @@ @@ -191,7 +202,7 @@ print_var(void)
check_proc_efi(0); check_proc_efi(0);
@ -80,7 +84,7 @@
if (fd == -1) { if (fd == -1) {
fatal_error("variable not defined\n"); fatal_error("variable not defined\n");
} }
@@ -200,7 +211,7 @@ @@ -200,7 +211,7 @@ print_var(void)
r = read(fd, &var, sizeof(var)); r = read(fd, &var, sizeof(var));
if (r != sizeof(var)) { if (r != sizeof(var)) {
@ -89,7 +93,7 @@
} }
printf("EliloAlt=\""); printf("EliloAlt=\"");
for(i=0; i < var.datasize; i+=1){ for(i=0; i < var.datasize; i+=1){
@@ -231,7 +242,7 @@ @@ -231,7 +242,7 @@ set_var(char *cmdline)
fd = open(name, O_WRONLY); fd = open(name, O_WRONLY);
if (fd == -1) { if (fd == -1) {
@ -98,7 +102,7 @@
} }
memset(&var, 0, sizeof(var)); memset(&var, 0, sizeof(var));
@@ -256,7 +267,7 @@ @@ -256,7 +267,7 @@ set_var(char *cmdline)
r = write(fd, &var, sizeof(var)); r = write(fd, &var, sizeof(var));
if (r != sizeof(var)) { if (r != sizeof(var)) {