diff --git a/elilo-3.8-cvs20080127.diff b/elilo-3.8-cvs20080127.diff new file mode 100644 index 0000000..c6f431c --- /dev/null +++ b/elilo-3.8-cvs20080127.diff @@ -0,0 +1,475 @@ +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 diff --git a/elilo-asm.diff b/elilo-asm.diff deleted file mode 100644 index 6754edd..0000000 --- a/elilo-asm.diff +++ /dev/null @@ -1,9 +0,0 @@ -diff -purN elilo-3.5-pre2/ia64/longjmp.S elilo/ia64/longjmp.S ---- elilo-3.5-pre2/ia64/longjmp.S 2002-01-13 17:00:08.000000000 +0100 -+++ elilo/ia64/longjmp.S 2005-12-07 14:50:38.833056090 +0100 -@@ -159,4 +159,4 @@ longjmp: - invala // virt. -> phys. regnum mapping may change - mov pr=r24,-1 - br.ret.dptk.few rp -- .endp __longjmp -+ .endp longjmp diff --git a/elilo-uEFI-no-alloc_kmem.diff b/elilo-uEFI-no-alloc_kmem.diff new file mode 100644 index 0000000..0805ba5 --- /dev/null +++ b/elilo-uEFI-no-alloc_kmem.diff @@ -0,0 +1,108 @@ +--- 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__ */ diff --git a/elilo.changes b/elilo.changes index ae0ff84..c0895a7 100644 --- a/elilo.changes +++ b/elilo.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Fri Nov 21 15:56:50 CET 2008 - rw@suse.de + +- elilo.efi + * Significant code cleanup from CVS. (bnc#443565) + * First attempt to work around firmware problem. (bnc#437486) +- elilo.pl + * Improve removal of obsolete files. (bnc#398416) +- eliloalt + * Support sysfs interface. (bnc#440489) + * Provide man page. (bnc#440197) + ------------------------------------------------------------------- Mon Oct 27 18:16:02 CET 2008 - rw@suse.de diff --git a/elilo.pl b/elilo.pl index 6faee9c..704c341 100644 --- a/elilo.pl +++ b/elilo.pl @@ -1,5 +1,5 @@ #!/usr/bin/perl -w -# $Id: elilo.pl,v 0.16 2008/10/27 17:15:29 rw Exp $ +# $Id: elilo.pl,v 0.17 2008/11/12 15:57:58 rw Exp $ use strict; my $C = $0; $C =~ s{^.*/}{}; @@ -15,10 +15,10 @@ my $Dlib = "$dbg$LibD/efi"; my $Fconf = "elilo.conf"; my $Sconf = "$dbg/etc/" . $Fconf; -my $Reserved = qr(^(efi-mountpoint|vendor-directory|elilo-origin))o; +my $Reserved = qr(^(efi-mountpoint|vendor-directory|elilo-origin|precious))o; my %Sconf = (); -my $keep = 0; +my $keep = -1; my $test = 0; my $verbose = 0; my $warn = 0; @@ -39,7 +39,7 @@ $| = 1; $[ = 0; sub Version() { - my $v = q($Revision: 0.16 $ ); + my $v = q($Revision: 0.17 $ ); $v =~ s/^\$ Rev.*:\ ([0-9.]+)\ \$\ /$1/x; $v .= " (part of elilo-$Edition)" if ( $Edition ne "\@EDITION\@" ); print "$C version $v\n"; @@ -62,12 +62,14 @@ sub Parse ($) { my( $f) = @_; my %r = (); + Info( 3, "### Parse '$f'\n"); open( IN, "< $f") || return( %r ); # fixme: add failure-detection while ( ) { chomp; - next unless ( m/$Reserved\s*\=\s*(.+)?\s*$/xo ); - $r{$1} = $2; + next unless ( m/$Reserved\s*(?:\=\s*(.+))?\s*$/xo ); + $r{$1} = (defined($2)) ? $2 : "true"; + Info( 3, ">>> $1 = '$r{$1}'\n"); } close( IN); return( %r ); @@ -232,17 +234,16 @@ sub System($@) { sub Purge($) { my( $d) = @_; - if ( $keep ) { + if ( $keep > 0) { Info( 1, "## skip removal of old files from '$d'\n"); return 0; } Info( 1, "## remove old files from '$d'\n"); my @F = glob( "$d/*"); foreach my $f ( @F ) { - next if ( $f =~ m{.*/elilo.(conf|efi)$} ); + next unless ( $f =~ m{.*/((vm|)linu(x|z)|initrd)-\S+$} ); Info( 1, "> rm $f\n"); - next if ($test); - unlink( $f); + unlink( $f) unless ($test); } } @@ -335,12 +336,15 @@ sub isMP($) { pod2usage(2) unless ( GetOptions( \%Opt, 'help|h', 'man|m', 'version|V', 'verbose|v+', - 'test|t', 'keep|k') && ! $Opt{'help'} ); + 'test|t', 'keep|k', 'purge|K') && + ( ! $Opt{'purge'} || ! $Opt{'keep'} ) && + ! $Opt{'help'} ); Version() if ( $Opt{'version'} ); pod2usage(-exitstatus => 0, -verbose => 2) if ( $Opt{'man'} ); pod2usage(1) if ( $Opt{'help'} ); $test = 1 if ( $Opt{'test'} ); + $keep = 0 if ( $Opt{'purge'} ); $keep = 1 if ( $Opt{'keep'} ); $verbose += $Opt{'verbose'} if ( $Opt{'verbose'} ); } @@ -380,6 +384,10 @@ if ( exists( $Sconf{"vendor-directory"}) ) { Info( 1, "## Don't forget: '$VD != SuSE'--NVRAM (efibootmgr) issue!\n") unless ( $VD eq "SuSE" ); } +if ( exists( $Sconf{"precious"}) && $keep < 0 ) { + $keep = 1; +} + $D = $MP . "/efi/" . $VD; Info( 1, "## Using '$D'...\n"); System( 2, "mkdir", "-p", $D) unless ( -d $D ); diff --git a/elilo.spec b/elilo.spec index b3a8d11..c6bb396 100644 --- a/elilo.spec +++ b/elilo.spec @@ -21,7 +21,7 @@ Name: elilo Summary: EFI Linux Loader Version: 3.8 -Release: 23 +Release: 24 ExclusiveArch: ia64 %ix86 x86_64 Group: System/Boot AutoReqProv: on @@ -30,13 +30,16 @@ License: GPL v2 or later Url: http://elilo.sourceforge.net/ Source: http://dl.sourceforge.net/elilo/elilo-3.8.tar.gz Source1: elilo.pl -Source2: rpmlintrc -Patch0: elilo-asm.diff +Source2: eliloalt.debian.man8 +Source3: rpmlintrc +Patch0: elilo-3.8-cvs20080127.diff Patch1: elilo-MAC.diff Patch2: elilo-spelling.diff Patch3: elilo-longer-commandline.diff Patch4: elilo-fix-possible-overflow.diff Patch5: elilo-avoid-tab.diff +Patch6: eliloalt-sysfs.diff +Patch7: elilo-uEFI-no-alloc_kmem.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: gnu-efi >= 3.0e @@ -60,6 +63,8 @@ Authors: %patch3 -p1 %patch4 -p1 %patch5 -p1 +%patch6 -p1 +%patch7 -p1 perl -pe 's{\@EDITION\@}{%{version}-%{release}}; s{\@LIBEXECDIR\@}{%{_libexecdir}}; s{\@ARCH\@}{%{_target_cpu}}; @@ -67,6 +72,7 @@ perl -pe 's{\@EDITION\@}{%{version}-%{release}}; perl -pi -e 's{/usr/lib}{%{_libexecdir}}' Make.defaults chmod 555 elilo.pl && touch -r %{SOURCE1} elilo.pl ! fgrep '%%{version}-%%{release}' elilo.pl +cp --preserve=time %{SOURCE2} eliloalt.8 %build make OPTIMFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -fno-stack-protector" @@ -80,9 +86,10 @@ install -m 444 elilo.efi $RPM_BUILD_ROOT%{_libexecdir}/efi install tools/eliloalt $RPM_BUILD_ROOT/sbin install -p -m 555 elilo.pl $RPM_BUILD_ROOT/sbin/elilo %if 0 -install -D -p elilo.5 $RPM_BUILD_ROOT/usr/share/man/man5/elilo.conf.5 -install -D -p elilo.8 $RPM_BUILD_ROOT/usr/share/man/man8/elilo.8 +install -D -p -m 644 elilo.5 $RPM_BUILD_ROOT/usr/share/man/man5/elilo.conf.5 %endif +install -D -p -m 644 elilo.8 $RPM_BUILD_ROOT/usr/share/man/man8/elilo.8 +install -D -p -m 644 eliloalt.8 $RPM_BUILD_ROOT/usr/share/man/man8/eliloalt.8 %clean rm -fr $RPM_BUILD_ROOT @@ -99,10 +106,19 @@ echo "Please run /sbin/elilo!" /sbin/eliloalt %if 0 /usr/share/man/man5/* -/usr/share/man/man8/* %endif +/usr/share/man/man8/* %changelog +* Fri Nov 21 2008 rw@suse.de +- elilo.efi + * Significant code cleanup from CVS. (bnc#443565) + * First attempt to work around firmware problem. (bnc#437486) +- elilo.pl + * Improve removal of obsolete files. (bnc#398416) +- eliloalt + * Support sysfs interface. (bnc#440489) + * Provide man page. (bnc#440197) * Mon Oct 27 2008 rw@suse.de - elilo.pl * Mask 'relocatable' (unless supported). (bnc#438276) @@ -121,10 +137,10 @@ echo "Please run /sbin/elilo!" * Thu Feb 28 2008 ro@suse.de - elilo.spec * No strip for elilo.efi during install (unknown binary format). -* Sun May 27 2007 schwab@suse.de +* Sat May 26 2007 schwab@suse.de - elilo.spec * Revert last change. -* Sun May 27 2007 ro@suse.de +* Sat May 26 2007 ro@suse.de - elilo.spec * Added gnu-efi-devel to buildreq. * Wed May 09 2007 rw@suse.de diff --git a/eliloalt-sysfs.diff b/eliloalt-sysfs.diff new file mode 100644 index 0000000..58411be --- /dev/null +++ b/eliloalt-sysfs.diff @@ -0,0 +1,109 @@ +--- a/tools/eliloalt.c ++++ b/tools/eliloalt.c +@@ -47,8 +47,10 @@ + #define ELILOALT_VERSION "0.02" + + #define ELILO_ALT_NAME "EliloAlt" +-#define EFIVAR_DIR "/proc/efi/vars" ++#define EFIVAR_DIR "/sys/firmware/efi/vars" ++#define OFIVAR_DIR "/proc/efi/vars" + #define ELILO_ALTVAR EFIVAR_DIR"/"ELILO_ALT_NAME"-00000000-0000-0000-0000-000000000000" ++#define OLILO_ALTVAR OFIVAR_DIR"/"ELILO_ALT_NAME"-00000000-0000-0000-0000-000000000000" + + #define EFI_VARIABLE_NON_VOLATILE 0x0000000000000001 + #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x0000000000000002 +@@ -80,7 +82,9 @@ + uint32_t attributes; + } __attribute__((packed)) efi_variable_t; + ++static char *efivar_dir = EFIVAR_DIR; + static char *elilo_alt_name = ELILO_ALT_NAME; ++static char *elilo_altvar = ELILO_ALTVAR; + + static struct option cmd_options[]={ + { "version", 0, 0, 1}, +@@ -129,9 +133,15 @@ + if (getuid() != 0) { + fatal_error("This program must be run as root\n"); + } +- efi_vars = opendir(EFIVAR_DIR); ++ efi_vars = opendir(efivar_dir); + if (efi_vars == NULL) { +- fatal_error("Cannot access %s\n", EFIVAR_DIR); ++ efivar_dir = OFIVAR_DIR; ++ elilo_altvar = OLILO_ALTVAR; ++ efi_vars = opendir(efivar_dir); ++ } ++ if (efi_vars == NULL) { ++ fatal_error("Can access neither %s nor %s\n", ++ EFIVAR_DIR, efivar_dir); + } + if (!find_entry) { + closedir(efi_vars); +@@ -143,9 +153,10 @@ + break; + } + if (entry == NULL) { +- fatal_error("Cannot find entry in %s\n", EFIVAR_DIR); ++ fatal_error("Cannot find entry in %s\n", efivar_dir); + } +- sprintf(name, "%s/%s", EFIVAR_DIR, entry->d_name); ++ snprintf(name, 1023, "%s/%s", efivar_dir, entry->d_name); ++ name[1023] = 0; + closedir(efi_vars); + return name; + } +@@ -158,7 +169,7 @@ + + check_proc_efi(0); + +- fd = open(ELILO_ALTVAR, O_WRONLY); ++ fd = open(elilo_altvar, O_WRONLY); + if (fd == -1) { + fatal_error("variable not defined\n"); + } +@@ -176,7 +187,7 @@ + + r = write(fd, &var, sizeof(var)); + if (r != sizeof(var)) { +- fatal_error("Variable %s defined but invalid content\n", ELILO_ALTVAR); ++ fatal_error("Variable %s defined but invalid content\n", elilo_altvar); + } + close(fd); + } +@@ -191,7 +202,7 @@ + + check_proc_efi(0); + +- fd = open(ELILO_ALTVAR, O_RDONLY); ++ fd = open(elilo_altvar, O_RDONLY); + if (fd == -1) { + fatal_error("variable not defined\n"); + } +@@ -200,7 +211,7 @@ + + r = read(fd, &var, sizeof(var)); + if (r != sizeof(var)) { +- fatal_error("Variable %s defined but invalid content\n", ELILO_ALTVAR); ++ fatal_error("Variable %s defined but invalid content\n", elilo_altvar); + } + printf("EliloAlt=\""); + for(i=0; i < var.datasize; i+=1){ +@@ -231,7 +242,7 @@ + + fd = open(name, O_WRONLY); + if (fd == -1) { +- fatal_error("can't open %s: %s\n", ELILO_ALTVAR, strerror(errno)); ++ fatal_error("can't open %s: %s\n", elilo_altvar, strerror(errno)); + } + + memset(&var, 0, sizeof(var)); +@@ -256,7 +267,7 @@ + + r = write(fd, &var, sizeof(var)); + if (r != sizeof(var)) { +- fatal_error("Variable %s defined but invalid content %d\n", ELILO_ALTVAR, r); ++ fatal_error("Variable %s defined but invalid content %d\n", elilo_altvar, r); + } + close(fd); + diff --git a/eliloalt.debian.man8 b/eliloalt.debian.man8 new file mode 100644 index 0000000..88afd17 --- /dev/null +++ b/eliloalt.debian.man8 @@ -0,0 +1,20 @@ +.TH ELILOALT 8 "18 Mar 2002" +.SH NAME +eliloalt \- manipulate elilo alternate +.SH SYNOPSIS +.B eliloalt +.RI [ options ] +.SH DESCRIPTION +The +.B eliloalt +command makes it possible to coerce elilo to boot an alternate +kernel configuration one time only, as when engaging in kernel development or +debugging. +.sp +.SH SEE ALSO +Additional information about +.B eliloalt +is available in the /usr/share/doc/packages/elilo directory. +.SH AUTHOR +This manual page was written by Bdale Garbee +for the Debian GNU/Linux system (but may be used by others).