2005-08-08 Yoshinori K. Okuji <okuji@enbug.org>

* Makefile.in (LIBLZO): New variable.

        * configure.ac: Check for LZO version 2.

        * util/i386/pc/grub-mkimage.c [HAVE_LZO_LZO1X_H]: Include
        lzo/lzo1x.h instead of lzo1x.h.

        * conf/i386-pc.rmk (grub_mkimage_LDFLAGS): Use $(LIBLZO) instead
        of -llzo.

        * util/i386/pc/grub-setup.c (main): Do not free PREFIX
        twice. Reported by Vladimir Serbinenko <phcoder@gmail.com>.

        * partmap/pc.c (pc_partition_map_probe): Restore P->DATA after
        copying the data from PARTITION to P.
This commit is contained in:
okuji 2005-08-08 23:15:21 +00:00
parent f4917dfdd6
commit 4ac9bd0438
12 changed files with 352 additions and 18 deletions

View File

@ -1,3 +1,21 @@
2005-08-08 Yoshinori K. Okuji <okuji@enbug.org>
* Makefile.in (LIBLZO): New variable.
* configure.ac: Check for LZO version 2.
* util/i386/pc/grub-mkimage.c [HAVE_LZO_LZO1X_H]: Include
lzo/lzo1x.h instead of lzo1x.h.
* conf/i386-pc.rmk (grub_mkimage_LDFLAGS): Use $(LIBLZO) instead
of -llzo.
* util/i386/pc/grub-setup.c (main): Do not free PREFIX
twice. Reported by Vladimir Serbinenko <phcoder@gmail.com>.
* partmap/pc.c (pc_partition_map_probe): Restore P->DATA after
copying the data from PARTITION to P.
2005-08-07 Yoshinori K. Okuji <okuji@enbug.org>
* kern/rescue.c (grub_rescue_cmd_rmmod): If the reference count is

View File

@ -67,6 +67,7 @@ NM = @NM@
LD = @LD@
RUBY = @RUBY@
LIBCURSES = @LIBCURSES@
LIBLZO = @LIBLZO@
### General variables.

6
NEWS
View File

@ -1,4 +1,8 @@
New in 1.90:
New in 1.91:
* Add support for LZO version 2.
New in 1.90 - 2005-08-07:
* Rename the project name PUPA to GRUB. Now this version is the
developmental version of GRUB officially.

1
THANKS
View File

@ -20,6 +20,7 @@ Tomas Ebenlendr <ebik@ucw.cz>
Tsuneyoshi Yasuo <tuneyoshi@naic.co.jp>
Vincent Guffens <guffens@inma.ucl.ac.be>
Vincent Pelletier <subdino2004@yahoo.fr>
Vladimir Serbinenko <phcoder@gmail.com>
Also, we thank the projects GNU Automake and LZO. Some code
was stolen from them.

View File

@ -305,7 +305,7 @@ grub_mkimage-util_resolve.d: util/resolve.c
-include grub_mkimage-util_resolve.d
grub_mkimage_LDFLAGS = -llzo
grub_mkimage_LDFLAGS = $(LIBLZO)
# For grub-setup.
grub_setup_SOURCES = util/i386/pc/grub-setup.c util/i386/pc/biosdisk.c \

View File

@ -55,7 +55,7 @@ noinst_UTILITIES = genmoddep
# For grub-mkimage.
grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \
util/resolve.c
grub_mkimage_LDFLAGS = -llzo
grub_mkimage_LDFLAGS = $(LIBLZO)
# For grub-setup.
grub_setup_SOURCES = util/i386/pc/grub-setup.c util/i386/pc/biosdisk.c \

View File

@ -25,8 +25,11 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `lzo' library (-llzo). */
#undef HAVE_LIBLZO
/* Define to 1 if you have the <lzo1x.h> header file. */
#undef HAVE_LZO1X_H
/* Define to 1 if you have the <lzo/lzo1x.h> header file. */
#undef HAVE_LZO_LZO1X_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H

306
configure vendored
View File

@ -311,7 +311,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE OBJCOPY ac_ct_OBJCOPY STRIP ac_ct_STRIP NM ac_ct_NM LD ac_ct_LD RUBY BUILD_CC CPP EGREP LIBCURSES LIBOBJS LTLIBOBJS'
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE OBJCOPY ac_ct_OBJCOPY STRIP ac_ct_STRIP NM ac_ct_NM LD ac_ct_LD RUBY BUILD_CC CPP EGREP LIBLZO LIBCURSES LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@ -5726,8 +5726,143 @@ _ACEOF
# Check LZO when compiling for the i386.
if test "x$host_cpu" = xi386; then
# There are three possibilities. LZO version 2 installed with the name
# liblzo2, with the name liblzo, and LZO version 1.
echo "$as_me:$LINENO: checking for __lzo_init_v2 in -llzo2" >&5
echo $ECHO_N "checking for __lzo_init_v2 in -llzo2... $ECHO_C" >&6
if test "${ac_cv_lib_lzo2___lzo_init_v2+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-llzo2 $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
echo "$as_me:$LINENO: checking for __lzo_init2 in -llzo" >&5
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char __lzo_init_v2 ();
int
main ()
{
__lzo_init_v2 ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_lzo2___lzo_init_v2=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_lzo2___lzo_init_v2=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_lzo2___lzo_init_v2" >&5
echo "${ECHO_T}$ac_cv_lib_lzo2___lzo_init_v2" >&6
if test $ac_cv_lib_lzo2___lzo_init_v2 = yes; then
LIBLZO="-llzo2"
else
echo "$as_me:$LINENO: checking for __lzo_init_v2 in -llzo" >&5
echo $ECHO_N "checking for __lzo_init_v2 in -llzo... $ECHO_C" >&6
if test "${ac_cv_lib_lzo___lzo_init_v2+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-llzo $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char __lzo_init_v2 ();
int
main ()
{
__lzo_init_v2 ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_lzo___lzo_init_v2=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_lzo___lzo_init_v2=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_lzo___lzo_init_v2" >&5
echo "${ECHO_T}$ac_cv_lib_lzo___lzo_init_v2" >&6
if test $ac_cv_lib_lzo___lzo_init_v2 = yes; then
LIBLZO="-llzo"
else
echo "$as_me:$LINENO: checking for __lzo_init2 in -llzo" >&5
echo $ECHO_N "checking for __lzo_init2 in -llzo... $ECHO_C" >&6
if test "${ac_cv_lib_lzo___lzo_init2+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
@ -5792,18 +5927,19 @@ fi
echo "$as_me:$LINENO: result: $ac_cv_lib_lzo___lzo_init2" >&5
echo "${ECHO_T}$ac_cv_lib_lzo___lzo_init2" >&6
if test $ac_cv_lib_lzo___lzo_init2 = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBLZO 1
_ACEOF
LIBS="-llzo $LIBS"
LIBLZO="-llzo"
else
{ { echo "$as_me:$LINENO: error: LZO library version 1.02 or later is required" >&5
echo "$as_me: error: LZO library version 1.02 or later is required" >&2;}
{ (exit 1); exit 1; }; }
fi
fi
fi
LIBS="$LIBS $LIBLZO"
echo "$as_me:$LINENO: checking for lzo1x_999_compress" >&5
echo $ECHO_N "checking for lzo1x_999_compress... $ECHO_C" >&6
if test "${ac_cv_func_lzo1x_999_compress+set}" = set; then
@ -5902,6 +6038,159 @@ echo "$as_me: error: LZO1X-999 must be enabled" >&2;}
{ (exit 1); exit 1; }; }
fi
# LZO version 2 uses lzo/lzo1x.h, while LZO version 1 uses lzo1x.h.
for ac_header in lzo/lzo1x.h lzo1x.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
else
# Is the header compilable?
echo "$as_me:$LINENO: checking $ac_header usability" >&5
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
# Is the header present?
echo "$as_me:$LINENO: checking $ac_header presence" >&5
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <$ac_header>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: )
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
{ echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
(
cat <<\_ASBOX
## ------------------------------- ##
## Report this to bug-grub@gnu.org ##
## ------------------------------- ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
;;
esac
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
eval "$as_ac_Header=\$ac_header_preproc"
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
fi
# Check for curses.
@ -6858,6 +7147,7 @@ s,@RUBY@,$RUBY,;t t
s,@BUILD_CC@,$BUILD_CC,;t t
s,@CPP@,$CPP,;t t
s,@EGREP@,$EGREP,;t t
s,@LIBLZO@,$LIBLZO,;t t
s,@LIBCURSES@,$LIBCURSES,;t t
s,@LIBOBJS@,$LIBOBJS,;t t
s,@LTLIBOBJS@,$LTLIBOBJS,;t t

View File

@ -132,10 +132,19 @@ AC_CHECK_SIZEOF(long)
# Check LZO when compiling for the i386.
if test "x$host_cpu" = xi386; then
AC_CHECK_LIB(lzo, __lzo_init2, ,
AC_MSG_ERROR([LZO library version 1.02 or later is required]))
# There are three possibilities. LZO version 2 installed with the name
# liblzo2, with the name liblzo, and LZO version 1.
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)
fi
# Check for curses.

View File

@ -1,7 +1,7 @@
/* pc.c - Read PC style partition tables. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002, 2004 Free Software Foundation, Inc.
* Copyright (C) 2002,2004,2005 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
@ -234,6 +234,7 @@ pc_partition_map_probe (grub_disk_t disk, const char *str)
&& pcdata->bsd_part == partdata->bsd_part)
{
grub_memcpy (p, partition, sizeof (*p));
p->data = pcdata;
grub_memcpy (pcdata, partdata, sizeof (*pcdata));
return 1;
}

View File

@ -35,7 +35,11 @@
#define _GNU_SOURCE 1
#include <getopt.h>
#include <lzo1x.h>
#if defined(HAVE_LZO_LZO1X_H)
# include <lzo/lzo1x.h>
#elif defined(HAVE_LZO1X_H)
# include <lzo1x.h>
#endif
static void
compress_kernel (char *kernel_img, size_t kernel_size,

View File

@ -436,6 +436,10 @@ setup (const char *prefix, const char *dir,
else
*install_dos_part = *install_bsd_part = grub_cpu_to_le32 (-1);
grub_util_info ("dos partition is %u, bsd partition is %u, prefix is %s",
grub_le_to_cpu32 (*install_dos_part),
grub_le_to_cpu32 (*install_bsd_part),
prefix);
strcpy (install_prefix, prefix);
/* Write the first two sectors of the core image onto the disk. */
@ -678,7 +682,6 @@ main (int argc, char *argv[])
free (boot_file);
free (core_file);
free (prefix);
free (dir);
free (dev_map);
free (root_dev);