merge with Trunk

This commit is contained in:
Carles Pina i Estany 2009-11-21 21:05:15 +00:00
commit a239a5e9cc
8 changed files with 198 additions and 58 deletions

View file

@ -1,3 +1,56 @@
2009-11-21 Samuel Thibault <samuel.thibault@ens-lyon.org>
* util/getroot.c [__GNU__]: Include <hurd.h>, <hurd/lookup.h>, and
<hurd/fs.h>
[__GNU__] (grub_guess_root_device): Call file_name_lookup and
file_get_storage_info to implement grub_guess_root_device.
2009-11-21 Felix Zielcke <fzielcke@z-51.de>
* util/grub-mkrescue.in: Print an error and usage if output option
has not been given.
2009-11-21 Felix Zielcke <fzielcke@z-51.de>
Patch from Loïc Minier <loic.minier@ubuntu.com>.
* util/grub.d/30_os-prober.in: Cope with Linux entries where
root and /boot are on different devices.
2009-11-21 Robert Millan <rmh.grub@aybabtu.com>
Fix build for srcdir != objdir.
* Makefile.in (po/$(PACKAGE).pot): Rename to ...
($(srcdir)/po/$(PACKAGE).pot): ... this. Run $(XGETTEXT) from
$(srcdir).
($(foreach lang, $(LINGUAS), po/$(lang).po)): Rename to ...
($(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po): ... this. Use $^
reference for input.
2009-11-21 Robert Millan <rmh.grub@aybabtu.com>
* util/grub-mkrescue.in: Use source directory direcly (without copiing
or hardlinking it). Remove -J option, Joliet is not compatible with
multiple source directories.
2009-11-21 Carles Pina i Estany <carles@pina.cat>
2009-11-21 Robert Millan <rmh.grub@aybabtu.com>
* util/grub-mkrescue.in: Recognize `--override-directory' option.
(process_input_dir): New function. Process an arbitrary input
directory.
Misc adjustments to support both "override mode" and system-wide mode.
2009-11-20 Felix Zielcke <fzielcke@z-51.de>
* configure.ac (UNIFONT_BDF): Rename to ...
(FONT_SOURCE): ... this. Update all users.
2009-11-20 Felix Zielcke <fzielcke@z-51.de>
* configure.ac: Add `/usr/share/fonts/X11/misc/unifont.pcf.gz'
to the list of unifont files to look for.
2009-11-19 Robert Millan <rmh.grub@aybabtu.com>
Patch from Joe Auricchio <jauricchio@gmail.com>

View file

@ -108,7 +108,7 @@ AWK = @AWK@
LIBCURSES = @LIBCURSES@
LIBUSB = @LIBUSB@
YACC = @YACC@
UNIFONT_BDF = @UNIFONT_BDF@
FONT_SOURCE = @FONT_SOURCE@
# Options.
enable_grub_emu = @enable_grub_emu@
@ -207,7 +207,7 @@ docs/grub.info: docs/grub.texi docs/version.texi docs/fdl.texi
$(MKDIR_P) docs
-$(MAKEINFO) -P $(builddir)/docs --no-split --force $< -o $@
ifeq (, $(UNIFONT_BDF))
ifeq (, $(FONT_SOURCE))
else
ifeq ($(enable_grub_mkfont),yes)
@ -218,11 +218,11 @@ pkgdata_DATA += unicode.pf2 ascii.pf2
UNICODE_ARROWS=0x2190-0x2193
UNICODE_LINES=0x2501-0x251B
unicode.pf2: $(UNIFONT_BDF) grub-mkfont
$(builddir)/grub-mkfont -o $@ $(UNIFONT_BDF)
unicode.pf2: $(FONT_SOURCE) grub-mkfont
$(builddir)/grub-mkfont -o $@ $(FONT_SOURCE)
ascii.pf2: $(UNIFONT_BDF) grub-mkfont
$(builddir)/grub-mkfont -o $@ $(UNIFONT_BDF) -r 0x0-0x7f,$(UNICODE_ARROWS),$(UNICODE_LINES)
ascii.pf2: $(FONT_SOURCE) grub-mkfont
$(builddir)/grub-mkfont -o $@ $(FONT_SOURCE) -r 0x0-0x7f,$(UNICODE_ARROWS),$(UNICODE_LINES)
endif
endif
@ -472,12 +472,12 @@ gensymlist.sh: gensymlist.sh.in config.status
genkernsyms.sh: genkernsyms.sh.in config.status
$(SHELL) ./config.status
po/$(PACKAGE).pot: po/POTFILES po/POTFILES-shell
$(XGETTEXT) --from-code=utf-8 -o $@ -f $< --keyword=_
$(XGETTEXT) --from-code=utf-8 -o $@ -f po/POTFILES-shell -j --language=Shell
$(srcdir)/po/$(PACKAGE).pot: po/POTFILES po/POTFILES-shell
cd $(srcdir) && $(XGETTEXT) --from-code=utf-8 -o $@ -f $< --keyword=_
cd $(srcdir) && $(XGETTEXT) --from-code=utf-8 -o $@ -f po/POTFILES-shell -j --language=Shell
$(foreach lang, $(LINGUAS), po/$(lang).po): po/$(PACKAGE).pot
$(MSGMERGE) -U $@ po/$(PACKAGE).pot
$(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po): po/$(PACKAGE).pot
$(MSGMERGE) -U $@ $^
po/%.mo: po/%.po
$(MKDIR_P) $$(dirname $@)

View file

@ -136,9 +136,9 @@ if test "x$YACC" = x; then
AC_MSG_ERROR([bison is not found])
fi
for file in /usr/src/unifont.bdf ; do
for file in /usr/src/unifont.bdf /usr/share/fonts/X11/misc/unifont.pcf.gz ; do
if test -e $file ; then
AC_SUBST([UNIFONT_BDF], [$file])
AC_SUBST([FONT_SOURCE], [$file])
break
fi
done

View file

@ -216,21 +216,22 @@ static void
grub_gettext_init_ext (const char *lang)
{
char *mo_file;
char *grub_prefix;
char *locale_dir;
grub_prefix = grub_env_get ("prefix");
locale_dir = grub_env_get ("locale_dir");
fd_mo = 0;
// mo_file e.g.: /boot/grub/locale/ca.mo
mo_file = grub_malloc (grub_strlen (grub_prefix) + sizeof ("/locale/") + grub_strlen (lang) + sizeof(".mo"));
mo_file = grub_malloc (grub_strlen (locale_dir) + sizeof ("/") + grub_strlen (lang) + sizeof(".mo"));
// Warning: if changing some paths in the below line, change the grub_malloc
// contents below
grub_sprintf (mo_file, "%s/locale/%s.mo", grub_prefix, lang);
grub_dprintf(" -------------- %s ",mo_file);
grub_sprintf (mo_file, "%s/%s.mo", locale_dir, lang);
grub_dprintf("gettext", "Will try to open file: %s " ,mo_file);
fd_mo = grub_mofile_open(mo_file);
grub_free (mo_file);

View file

@ -30,6 +30,12 @@
# define DEV_CYGDRIVE_MAJOR 98
#endif
#ifdef __GNU__
#include <hurd.h>
#include <hurd/lookup.h>
#include <hurd/fs.h>
#endif
#include <grub/util/misc.h>
#include <grub/util/hostdisk.h>
#include <grub/util/getroot.h>
@ -378,8 +384,65 @@ find_cygwin_root_device (const char *path, dev_t dev)
char *
grub_guess_root_device (const char *dir)
{
struct stat st;
char *os_dev;
#ifdef __GNU__
file_t file;
mach_port_t *ports;
int *ints;
loff_t *offsets;
char *data;
error_t err;
mach_msg_type_number_t num_ports = 0, num_ints = 0, num_offsets = 0, data_len = 0;
size_t name_len;
file = file_name_lookup (dir, 0, 0);
if (file == MACH_PORT_NULL)
return 0;
err = file_get_storage_info (file,
&ports, &num_ports,
&ints, &num_ints,
&offsets, &num_offsets,
&data, &data_len);
if (num_ints < 1)
grub_util_error ("Storage info for `%s' does not include type", dir);
if (ints[0] != STORAGE_DEVICE)
grub_util_error ("Filesystem of `%s' is not stored on local disk", dir);
if (num_ints < 5)
grub_util_error ("Storage info for `%s' does not include name", dir);
name_len = ints[4];
if (name_len < data_len)
grub_util_error ("Bogus name length for storage info for `%s'", dir);
if (data[name_len - 1] != '\0')
grub_util_error ("Storage name for `%s' not NUL-terminated", dir);
os_dev = xmalloc (strlen ("/dev/") + data_len);
memcpy (os_dev, "/dev/", strlen ("/dev/"));
memcpy (os_dev + strlen ("/dev/"), data, data_len);
if (ports && num_ports > 0)
{
mach_msg_type_number_t i;
for (i = 0; i < num_ports; i++)
{
mach_port_t port = ports[i];
if (port != MACH_PORT_NULL)
mach_port_deallocate (mach_task_self(), port);
}
munmap ((caddr_t) ports, num_ports * sizeof (*ports));
}
if (ints && num_ints > 0)
munmap ((caddr_t) ints, num_ints * sizeof (*ints));
if (offsets && num_offsets > 0)
munmap ((caddr_t) offsets, num_offsets * sizeof (*offsets));
if (data && data_len > 0)
munmap (data, data_len);
mach_port_deallocate (mach_task_self (), file);
#else /* !__GNU__ */
struct stat st;
if (stat (dir, &st) < 0)
grub_util_error ("Cannot stat `%s'", dir);
@ -393,6 +456,7 @@ grub_guess_root_device (const char *dir)
/* This might be truly slow, but is there any better way? */
os_dev = find_root_device ("/dev", st.st_dev);
#endif
#endif /* !__GNU__ */
return os_dev;
}

View file

@ -27,10 +27,10 @@ PACKAGE_NAME=@PACKAGE_NAME@
PACKAGE_TARNAME=@PACKAGE_TARNAME@
PACKAGE_VERSION=@PACKAGE_VERSION@
target_cpu=@target_cpu@
native_platform=@platform@
coreboot_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-coreboot
pc_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-pc
grub_mkisofs="grub-mkisofs"
# Usage: usage
# Print the usage.
@ -42,7 +42,7 @@ Make GRUB rescue image.
-h, --help print this message and exit
-v, --version print the version information and exit
--modules=MODULES pre-load specified modules MODULES
--output=FILE save output in FILE
--output=FILE save output in FILE [required]
$0 generates a bootable rescue image with specified source files or directories.
@ -63,6 +63,12 @@ for option in "$@"; do
modules=`echo "$option" | sed 's/--modules=//'` ;;
--output=*)
output_image=`echo "$option" | sed 's/--output=//'` ;;
# Intentionally undocumented
--override-directory=*)
override_dir=`echo "${option}/" | sed 's/--override-directory=//'`
PATH=${override_dir}:$PATH
export PATH
;;
-*)
echo "Unrecognized option \`$option'" 1>&2
usage
@ -73,25 +79,49 @@ for option in "$@"; do
esac
done
if [ "x${output_image}" = x ] ; then
echo "output file must be given" >&2
usage
exit 1
fi
iso9660_dir=`mktemp -d`
mkdir -p ${iso9660_dir}/boot/grub
for platform in pc coreboot ; do
input_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-${platform}
if test -e ${input_dir} ; then
mkdir -p ${iso9660_dir}/boot/grub/${target_cpu}-${platform}
for file in ${input_dir}/*.mod ${input_dir}/efiemu??.o \
${input_dir}/command.lst ${input_dir}/moddep.lst ${input_dir}/fs.lst \
${input_dir}/handler.lst ${input_dir}/parttool.lst; do
if test -f "$file"; then
cp -f "$file" ${iso9660_dir}/boot/grub/${target_cpu}-${platform}/
fi
done
process_input_dir ()
{
input_dir="$1"
platform="$2"
mkdir -p ${iso9660_dir}/boot/grub/${target_cpu}-${platform}
for file in ${input_dir}/*.mod ${input_dir}/efiemu??.o \
${input_dir}/command.lst ${input_dir}/moddep.lst ${input_dir}/fs.lst \
${input_dir}/handler.lst ${input_dir}/parttool.lst; do
if test -f "$file"; then
cp -f "$file" ${iso9660_dir}/boot/grub/${target_cpu}-${platform}/
fi
done
}
if [ "${override_dir}" = "" ] ; then
if test -e "${coreboot_dir}" ; then
process_input_dir ${coreboot_dir} coreboot
fi
done
if test -e "${pc_dir}" ; then
process_input_dir ${pc_dir} pc
fi
else
process_input_dir ${override_dir} ${native_platform}
coreboot_dir=
pc_dir=
case "${native_platform}" in
coreboot) coreboot_dir=${override_dir} ;;
pc) pc_dir=${override_dir} ;;
esac
fi
# build coreboot core.img
if test -e ${coreboot_dir} ; then
if test -e "${coreboot_dir}" ; then
echo "Generates coreboot"
memdisk_img=`mktemp`
memdisk_dir=`mktemp -d`
mkdir -p ${memdisk_dir}/boot/grub
@ -115,18 +145,12 @@ EOF
memdisk tar search iso9660 configfile sh \
ata at_keyboard
rm -f ${memdisk_img}
grub_mkisofs="${grub_mkisofs} --modification-date=$(echo ${iso_uuid} | sed -e s/-//g)"
fi
if [ "${source}" != "" ] ; then
for d in ${source}; do
echo "Processing $d"
cp -dpRl "${d}" ${iso9660_dir}/
done
grub_mkisofs_arguments="${grub_mkisofs_arguments} --modification-date=$(echo ${iso_uuid} | sed -e s/-//g)"
fi
# build eltorito core.img
if test -e ${pc_dir} ; then
if test -e "${pc_dir}" ; then
echo "Generates eltorito"
core_img=`mktemp`
grub-mkimage -d ${pc_dir}/ -o ${core_img} --prefix=/boot/grub/i386-pc \
memdisk tar search iso9660 configfile sh \
@ -141,11 +165,11 @@ if test -e ${pc_dir} ; then
echo "source /boot/grub/grub.cfg") \
> ${iso9660_dir}/boot/grub/i386-pc/grub.cfg
grub_mkisofs="${grub_mkisofs} -b boot/grub/i386-pc/eltorito.img -boot-info-table"
grub_mkisofs_arguments="${grub_mkisofs_arguments} -b boot/grub/i386-pc/eltorito.img -boot-info-table"
fi
# build iso image
${grub_mkisofs} -o ${output_image} -r -J ${iso9660_dir}
grub-mkisofs ${grub_mkisofs_arguments} -o ${output_image} -r ${iso9660_dir} ${source}
rm -rf ${iso9660_dir}
exit 0

View file

@ -22,7 +22,8 @@ prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
grub_prefix=`echo /boot/grub | sed ${transform}`
locale_prefix="/usr/share/locale" # TODO: dynamic with exec_prefix ?
locale_dir=`echo /boot/grub/locale | sed ${transform}`
grub_lang=`echo $LANG | cut -d _ -f 1`
. ${libdir}/grub/grub-mkconfig_lib
@ -101,20 +102,12 @@ EOF
;;
esac
if test -e ${grub_prefix}/gettext.mod -a -d /usr/share/locale; then
# Make the locales accesible
prepare_grub_to_access_device `${grub_probe} --target=device ${locale_prefix}`
lang=`get_locale_lang`
grub_locale_prefix=`make_system_path_relative_to_its_root ${locale_prefix}`
cat << EOF
# Gettext variables and module
set locale_prefix=${grub_locale_prefix}
set lang=${lang}
cat << EOF
set locale_dir=${locale_dir}
set lang=${grub_lang}
insmod gettext
EOF
else
echo "gettext module or /usr/share/locale is not available"
fi
if [ "x${GRUB_HIDDEN_TIMEOUT}" != "x" ] ; then
if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then

View file

@ -88,11 +88,16 @@ EOF
LLABEL="${LONGNAME}"
fi
if [ "${LROOT}" != "${LBOOT}" ]; then
LKERNEL="${LKERNEL#/boot}"
LINITRD="${LINITRD#/boot}"
fi
cat << EOF
menuentry "${LLABEL} (on ${DEVICE})" {
EOF
if [ -z "${prepare_boot_cache}" ]; then
prepare_boot_cache="$(prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/")"
prepare_boot_cache="$(prepare_grub_to_access_device ${LBOOT} | sed -e "s/^/\t/")"
fi
printf '%s\n' "${prepare_boot_cache}"
cat << EOF