diff --git a/ChangeLog b/ChangeLog index bfceb2356..5a2effbd3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2009-07-19 Pavel Roskin + + * Makefile.in: Remove LIBLZO and enable_lzo. + * conf/i386-pc.rmk: Remove lzo support. + * configure.ac: Remove checks for lzo, don't define ENABLE_LZMA. + * include/grub/i386/pc/kernel.h: Define ENABLE_LZMA. Remove lzo + support. + * kern/i386/pc/lzo1x.S: Remove. + * kern/i386/pc/startup.S: Remove lzo support. + * util/i386/pc/grub-mkimage.c: Likewise. + 2009-07-19 Vladimir Serbinenko * disk/usbms.c (grub_usbms_transfer): Fix double semicolon. diff --git a/INSTALL b/INSTALL index 47d9295fc..6048b1d6e 100644 --- a/INSTALL +++ b/INSTALL @@ -16,7 +16,6 @@ configuring the GRUB. * GNU Bison * GNU binutils 2.9.1.0.23 or later * Other standard GNU/Unix tools -* LZO 1.02 or later (optional) * Ruby 1.6 or later * Autoconf 2.59 or later diff --git a/Makefile.in b/Makefile.in index 436db63ca..25acce7b1 100644 --- a/Makefile.in +++ b/Makefile.in @@ -94,7 +94,6 @@ HELP2MAN := LANG=C $(HELP2MAN) --no-info --source=FSF endif AWK = @AWK@ LIBCURSES = @LIBCURSES@ -LIBLZO = @LIBLZO@ LIBUSB = @LIBUSB@ YACC = @YACC@ UNIFONT_BDF = @UNIFONT_BDF@ @@ -104,7 +103,6 @@ enable_grub_emu = @enable_grub_emu@ enable_grub_emu_usb = @enable_grub_emu_usb@ enable_grub_fstest = @enable_grub_fstest@ enable_grub_pe2elf = @enable_grub_pe2elf@ -enable_lzo = @enable_lzo@ enable_grub_mkfont = @enable_grub_mkfont@ freetype_cflags = @freetype_cflags@ freetype_libs = @freetype_libs@ diff --git a/NEWS b/NEWS index ec10abce4..c54095e9b 100644 --- a/NEWS +++ b/NEWS @@ -26,7 +26,7 @@ New in 1.97 - : * Add x86_64 EFI support. -* Add support for LZMA compression. +* Use LZMA compression instead of LZO. * Support for saving the environment from and loading the environment from a file. diff --git a/THANKS b/THANKS index 445bb6f0d..5ce190944 100644 --- a/THANKS +++ b/THANKS @@ -30,7 +30,7 @@ Vincent Guffens Vincent Pelletier Vladimir Serbinenko -Also, we thank the projects GNU Automake and LZO. Some code +Also, we thank the projects GNU Automake and LZMA. Some code was stolen from them. This project was supported by Information-technology Promotion Agency, diff --git a/conf/i386-pc.rmk b/conf/i386-pc.rmk index f1915b646..f5bded28a 100644 --- a/conf/i386-pc.rmk +++ b/conf/i386-pc.rmk @@ -89,14 +89,8 @@ sbin_UTILITIES += grub-emu endif # For grub-mkimage. -ifeq ($(enable_lzo), yes) -grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \ - util/resolve.c -grub_mkimage_LDFLAGS = $(LIBLZO) -else grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \ util/resolve.c lib/LzmaEnc.c lib/LzFind.c -endif grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR) util/i386/pc/grub-mkimage.c_DEPENDENCIES = Makefile diff --git a/configure.ac b/configure.ac index 90464036c..b5c8acbb6 100644 --- a/configure.ac +++ b/configure.ac @@ -171,32 +171,6 @@ if test x$grub_cv_apple_cc = xyes ; then ASFLAGS="$ASFLAGS -DAPPLE_CC=1" fi -# Check LZO when compiling for the i386-pc. -if test "$target_cpu"-"$platform" = i386-pc; then - AC_ARG_ENABLE([lzo], - [AS_HELP_STRING([--enable-lzo], - [use lzo to compress kernel (default is lzma)])]) - [if [ x"$enable_lzo" = xyes ]; then - # There are three possibilities. LZO version 2 installed with the name - # liblzo2, with the name liblzo, and LZO version 1.] - AC_DEFINE([ENABLE_LZO], [1], [Use lzo compression]) - AC_CHECK_LIB([lzo2], [__lzo_init_v2], [LIBLZO="-llzo2"], - [AC_CHECK_LIB([lzo], [__lzo_init_v2], [LIBLZO="-llzo"], - [AC_CHECK_LIB([lzo], [__lzo_init2], [LIBLZO="-llzo"], - [AC_MSG_ERROR([LZO library version 1.02 or later is required])])])]) - AC_SUBST([LIBLZO]) - [LIBS="$LIBS $LIBLZO"] - AC_CHECK_FUNC([lzo1x_999_compress], , - [AC_MSG_ERROR([LZO1X-999 must be enabled])]) - - [# LZO version 2 uses lzo/lzo1x.h, while LZO version 1 uses lzo1x.h.] - AC_CHECK_HEADERS([lzo/lzo1x.h lzo1x.h]) - [else] - AC_DEFINE([ENABLE_LZMA], [1], [Use lzma compression]) - [fi] - AC_SUBST([enable_lzo]) -fi - # Check for functions. AC_CHECK_FUNCS(posix_memalign memalign asprintf) @@ -607,13 +581,6 @@ AC_OUTPUT echo "*******************************************************" echo GRUB2 will be compiled with following components: echo Platform: "$target_cpu"-"$platform" -if test "$target_cpu"-"$platform" = i386-pc; then -if [ x"$enable_lzo" = xyes ]; then -echo Compression: LZO -else -echo Compression: LZMA -fi -fi if [ x"$grub_emu_excuse" = x ]; then echo grub-emu: Yes else diff --git a/include/grub/i386/pc/kernel.h b/include/grub/i386/pc/kernel.h index 5b9d8dcb5..e830afae2 100644 --- a/include/grub/i386/pc/kernel.h +++ b/include/grub/i386/pc/kernel.h @@ -41,11 +41,10 @@ #define GRUB_KERNEL_MACHINE_DATA_END 0x5c /* The size of the first region which won't be compressed. */ -#if defined(ENABLE_LZO) -#define GRUB_KERNEL_MACHINE_RAW_SIZE (GRUB_KERNEL_MACHINE_DATA_END + 0x450) -#elif defined(ENABLE_LZMA) #define GRUB_KERNEL_MACHINE_RAW_SIZE (GRUB_KERNEL_MACHINE_DATA_END + 0x5F0) -#endif + +/* Enable LZMA compression */ +#define ENABLE_LZMA 1 #ifndef ASM_FILE diff --git a/kern/i386/pc/lzo1x.S b/kern/i386/pc/lzo1x.S deleted file mode 100644 index 49ba8cc1a..000000000 --- a/kern/i386/pc/lzo1x.S +++ /dev/null @@ -1,315 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer - * Copyright (C) 2003,2007 Free Software Foundation, Inc. - * - * GRUB is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * GRUB is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GRUB. If not, see . - */ - -/* - * This code was stolen from the files enter.sh, leave.sh, lzo1x_d.sh, - * lzo1x_f.s and lzo_asm.h in LZO version 1.08, and was heavily modified - * to adapt it to GRUB's requirement. - * - * See , for more information - * about LZO. - */ - -#define INP 4+16(%esp) -#define INS 8+16(%esp) -#define OUTP 12+16(%esp) -#define NN 3 -#define N_3 %ebp -#define N_255 $255 -#define LODSB movb (%esi), %al ; incl %esi -#define NOTL_3(r) xorl N_3, r -#define MOVSL(r1,r2,x) movl (r1), x ; addl $4, r1 ; movl x, (r2) ; addl $4, r2 -#define COPYL_C(r1,r2,x,rc) 9: MOVSL(r1,r2,x) ; decl rc ; jnz 9b -#define COPYL(r1,r2,x) COPYL_C(r1,r2,x,%ecx) - -lzo1x_decompress: - pushl %ebp - pushl %edi - pushl %esi - pushl %ebx - - cld - - movl INP, %esi - movl OUTP, %edi - movl $3, %ebp - - - xorl %eax, %eax - xorl %ebx, %ebx /* high bits 9-32 stay 0 */ - lodsb - cmpb $17, %al - jbe .L01 - subb $17-NN, %al - jmp .LFLR - - -/*********************************************************************** -// literal run -************************************************************************/ - -0: addl N_255, %eax -1: movb (%esi), %bl - incl %esi - orb %bl, %bl - jz 0b - leal 18+NN(%eax,%ebx), %eax - jmp 3f - - -.L00: - LODSB -.L01: - cmpb $16, %al - jae .LMATCH - - /* a literal run */ - orb %al, %al - jz 1b - addl $3+NN, %eax -3: -.LFLR: - movl %eax, %ecx - NOTL_3(%eax) - shrl $2, %ecx - andl N_3, %eax - COPYL(%esi,%edi,%edx) - subl %eax, %esi - subl %eax, %edi - - LODSB - cmpb $16, %al - jae .LMATCH - - -/*********************************************************************** -// R1 -************************************************************************/ - - shrl $2, %eax - movb (%esi), %bl - leal -0x801(%edi), %edx - leal (%eax,%ebx,4), %eax - incl %esi - subl %eax, %edx - movl (%edx), %ecx - movl %ecx, (%edi) - addl N_3, %edi - jmp .LMDONE - - -/*********************************************************************** -// M2 -************************************************************************/ - -.LMATCH: - cmpb $64, %al - jb .LM3MATCH - - /* a M2 match */ - movl %eax, %ecx - shrl $2, %eax - leal -1(%edi), %edx - andl $7, %eax - movb (%esi), %bl - shrl $5, %ecx - leal (%eax,%ebx,8), %eax - incl %esi - subl %eax, %edx - - addl $1+3, %ecx - - cmpl N_3, %eax - jae .LCOPYLONG - jmp .LCOPYBYTE - - -/*********************************************************************** -// M3 -************************************************************************/ - -0: addl N_255, %eax -1: movb (%esi), %bl - incl %esi - orb %bl, %bl - jz 0b - leal 33+NN(%eax,%ebx), %ecx - xorl %eax, %eax - jmp 3f - - -.LM3MATCH: - cmpb $32, %al - jb .LM4MATCH - - /* a M3 match */ - andl $31, %eax - jz 1b - lea 2+NN(%eax), %ecx -3: - movw (%esi), %ax - leal -1(%edi), %edx - shrl $2, %eax - addl $2, %esi - subl %eax, %edx - - cmpl N_3, %eax - jb .LCOPYBYTE - - -/*********************************************************************** -// copy match -************************************************************************/ - -.LCOPYLONG: /* copy match using longwords */ - leal -3(%edi,%ecx), %eax - shrl $2, %ecx - COPYL(%edx,%edi,%ebx) - movl %eax, %edi - xorl %ebx, %ebx - -.LMDONE: - movb -2(%esi), %al - andl N_3, %eax - jz .L00 -.LFLR3: - movl (%esi), %edx - addl %eax, %esi - movl %edx, (%edi) - addl %eax, %edi - - LODSB - jmp .LMATCH - - -.LCOPYBYTE: /* copy match using bytes */ - xchgl %edx,%esi - subl N_3,%ecx - - rep - movsb - movl %edx, %esi - jmp .LMDONE - - -/*********************************************************************** -// M4 -************************************************************************/ - -0: addl N_255, %ecx -1: movb (%esi), %bl - incl %esi - orb %bl, %bl - jz 0b - leal 9+NN(%ebx,%ecx), %ecx - jmp 3f - - -.LM4MATCH: - cmpb $16, %al - jb .LM1MATCH - - /* a M4 match */ - movl %eax, %ecx - andl $8, %eax - shll $13, %eax /* save in bit 16 */ - andl $7, %ecx - jz 1b - addl $2+NN, %ecx -3: - movw (%esi), %ax - addl $2, %esi - leal -0x4000(%edi), %edx - shrl $2, %eax - jz .LEOF - subl %eax, %edx - jmp .LCOPYLONG - - -/*********************************************************************** -// M1 -************************************************************************/ - -.LM1MATCH: - /* a M1 match */ - shrl $2, %eax - movb (%esi), %bl - leal -1(%edi), %edx - leal (%eax,%ebx,4), %eax - incl %esi - subl %eax, %edx - - movb (%edx), %al /* we must use this because edx can be edi-1 */ - movb %al, (%edi) - movb 1(%edx), %bl - movb %bl, 1(%edi) - addl $2, %edi - jmp .LMDONE - - -/*********************************************************************** -// -************************************************************************/ - -.LEOF: -/**** xorl %eax,%eax eax=0 from above */ - - cmpl $3+NN, %ecx /* ecx must be 3/6 */ - setnz %al - - /* check compressed size */ - movl INP, %edx - addl INS, %edx - cmpl %edx, %esi /* check compressed size */ - ja .L_input_overrun - jb .L_input_not_consumed - -.L_leave: - negl %eax - jnz 1f - - subl OUTP, %edi /* write back the uncompressed size */ - movl %edi, %eax - -1: popl %ebx - popl %esi - popl %edi - popl %ebp - ret - -.L_input_not_consumed: - movl $8, %eax /* LZO_E_INPUT_NOT_CONSUMED */ - jmp .L_leave - -.L_input_overrun: - movl $4, %eax /* LZO_E_INPUT_OVERRUN */ - jmp .L_leave - -#undef INP -#undef INS -#undef OUTP -#undef NN -#undef NN -#undef N_3 -#undef N_255 -#undef LODSB -#undef NOTL_3 -#undef MOVSL -#undef COPYL_C -#undef COPYL diff --git a/kern/i386/pc/startup.S b/kern/i386/pc/startup.S index 171fbeabe..be258fb08 100644 --- a/kern/i386/pc/startup.S +++ b/kern/i386/pc/startup.S @@ -210,20 +210,7 @@ codestart: incl %eax call EXT_C(grub_gate_a20) -#if defined(ENABLE_LZO) - /* decompress the compressed part and put the result at 1MB */ - movl $GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR, %esi - movl $(_start + GRUB_KERNEL_MACHINE_RAW_SIZE), %edi - - pushl %esi - pushl EXT_C(grub_compressed_size) - pushl %edi - call lzo1x_decompress - addl $12, %esp - - movl %eax, %ecx - cld -#elif defined(ENABLE_LZMA) +#ifdef ENABLE_LZMA movl $GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR, %edi movl $(_start + GRUB_KERNEL_MACHINE_RAW_SIZE), %esi pushl %edi @@ -451,9 +438,7 @@ gate_a20_check_state: popl %ebx ret -#if defined(ENABLE_LZO) -#include "lzo1x.S" -#elif defined(ENABLE_LZMA) +#ifdef ENABLE_LZMA #include "lzma_decode.S" #endif diff --git a/util/i386/pc/grub-mkimage.c b/util/i386/pc/grub-mkimage.c index ee1af822a..b81392ce8 100644 --- a/util/i386/pc/grub-mkimage.c +++ b/util/i386/pc/grub-mkimage.c @@ -36,57 +36,9 @@ #define _GNU_SOURCE 1 #include -#if defined(ENABLE_LZO) - -#if defined(HAVE_LZO_LZO1X_H) -# include -#elif defined(HAVE_LZO1X_H) -# include -#endif - -#elif defined(ENABLE_LZMA) - +#ifdef ENABLE_LZMA #include -#endif - -#if defined(ENABLE_LZO) - -static void -compress_kernel (char *kernel_img, size_t kernel_size, - char **core_img, size_t *core_size) -{ - lzo_uint size; - char *wrkmem; - - if (kernel_size < GRUB_KERNEL_MACHINE_RAW_SIZE) - grub_util_error ("the core image is too small"); - - if (lzo_init () != LZO_E_OK) - grub_util_error ("cannot initialize LZO"); - - *core_img = xmalloc (kernel_size + kernel_size / 64 + 16 + 3); - wrkmem = xmalloc (LZO1X_999_MEM_COMPRESS); - - memcpy (*core_img, kernel_img, GRUB_KERNEL_MACHINE_RAW_SIZE); - - grub_util_info ("compressing the core image"); - if (lzo1x_999_compress ((const lzo_byte *) (kernel_img - + GRUB_KERNEL_MACHINE_RAW_SIZE), - kernel_size - GRUB_KERNEL_MACHINE_RAW_SIZE, - (lzo_byte *) (*core_img - + GRUB_KERNEL_MACHINE_RAW_SIZE), - &size, wrkmem) - != LZO_E_OK) - grub_util_error ("cannot compress the kernel image"); - - free (wrkmem); - - *core_size = (size_t) size + GRUB_KERNEL_MACHINE_RAW_SIZE; -} - -#elif defined(ENABLE_LZMA) - static void *SzAlloc(void *p, size_t size) { p = p; return xmalloc(size); } static void SzFree(void *p, void *address) { p = p; free(address); } static ISzAlloc g_Alloc = { SzAlloc, SzFree }; @@ -124,7 +76,7 @@ compress_kernel (char *kernel_img, size_t kernel_size, *core_size += GRUB_KERNEL_MACHINE_RAW_SIZE; } -#else +#else /* No lzma compression */ static void compress_kernel (char *kernel_img, size_t kernel_size, @@ -135,7 +87,7 @@ compress_kernel (char *kernel_img, size_t kernel_size, *core_size = kernel_size; } -#endif +#endif /* No lzma compression */ static void generate_image (const char *dir, char *prefix, FILE *out, char *mods[],