merge mainline

This commit is contained in:
Colin Watson 2010-06-17 16:14:08 +01:00
commit e803a2b793
17 changed files with 377 additions and 54 deletions

View file

@ -2,6 +2,7 @@
10_* 10_*
30_os-prober 30_os-prober
40_custom 40_custom
41_custom
aclocal.m4 aclocal.m4
ascii.bitmaps ascii.bitmaps
ascii.h ascii.h

View file

@ -1,3 +1,77 @@
2010-06-17 Colin Watson <cjwatson@ubuntu.com>
Fix i386-pc prefix handling with nested partitions (Debian bug
#585068). Note that the case where the core image is booted using
multiboot and relocated from its original location still requires
more work.
* kern/i386/pc/init.c (make_install_device): If the prefix starts
with "(,", fill the boot drive in between those two characters, but
expect that a full partition specification including partition map
names will follow.
* util/i386/pc/grub-setup.c (setup): Unless an explicit prefix was
specified, write a prefix without the drive name but including a
full partition specification.
2010-06-16 Colin Watson <cjwatson@ubuntu.com>
* util/grub-mkconfig.in: Ignore non-option arguments, for
compatibility with older versions (before 2010-06-12) which did the
same. In particular, this makes it easier to ship an update-grub
wrapper which is compatible with that used with GRUB Legacy (Debian
bug #586056).
2010-06-14 Grégoire Sutre <gregoire.sutre@gmail.com>
* Makefile.in (install-local): Use $$file.h2m instead of $$dest.h2m
for manual page generation.
2010-06-14 Grégoire Sutre <gregoire.sutre@gmail.com>
* po/POTFILES: Remove leftover commands/handler.c.
2010-06-14 Colin Watson <cjwatson@ubuntu.com>
* util/grub-mkconfig.in: Remove vestige of old argument parsing that
left this script non-functional.
2010-06-14 Colin Watson <cjwatson@ubuntu.com>
* docs/man/grub-emu.h2m: New file.
2010-06-13 Colin Watson <cjwatson@ubuntu.com>
* docs/grub.texi (Commands): Document reduced command set in rescue
mode.
(cpuid): New section.
2010-06-13 Grégoire Sutre <gregoire.sutre@gmail.com>
* kern/emu/hostdisk.c (grub_util_biosdisk_get_grub_dev): Use the
new partition naming style.
* util/grub-install.in: Adapt sed subtitutions in grub-probe calls.
2010-06-12 BVK Chaitanya <bvk.groups@gmail.com>
Add "-o grub.iso" like cmdline options support.
* util/grub-install.in: Improve cmdline option parsing.
* util/grub-mkconfig.in: Likewise.
* util/grub-mkrescue.in: Likewise.
* util/grub-reboot.in: Likewise.
* util/grub-set-default.in: Likewise.
* util/i386/efi/grub-install.in: Likewise.
* util/ieee1275/grub-install.in: Likewise.
* util/powerpc/ieee1275/grub-mkrescue.in: Likewise.
2010-06-12 Colin Watson <cjwatson@ubuntu.com>
* .bzrignore: Ignore 41_custom.
2010-06-12 Thomas Schmitt <scdbackup@gmx.net>
* util/grub-mkrescue.in: Pass unrecognized options to xorriso.
2010-06-12 Colin Watson <cjwatson@ubuntu.com> 2010-06-12 Colin Watson <cjwatson@ubuntu.com>
Avoid false positives in fs.lst, partmap.lst, and video.lst due to Avoid false positives in fs.lst, partmap.lst, and video.lst due to

View file

@ -323,26 +323,26 @@ install-local: all
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
$(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \ $(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \
$(HELP2MAN) --section=1 -i $(srcdir)/docs/man/$$dest.h2m -o $(DESTDIR)$(mandir)/man1/$$dest.1 $(builddir)/$$file; \ $(HELP2MAN) --section=1 -i $(srcdir)/docs/man/$$file.h2m -o $(DESTDIR)$(mandir)/man1/$$dest.1 $(builddir)/$$file; \
done done
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(mandir)/man8 $(SHELL) $(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(mandir)/man8
@list='$(sbin_UTILITIES)'; for file in $$list; do \ @list='$(sbin_UTILITIES)'; for file in $$list; do \
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
$(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \ $(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \
$(HELP2MAN) --section=8 -i $(srcdir)/docs/man/$$dest.h2m -o $(DESTDIR)$(mandir)/man8/$$dest.8 $(builddir)/$$file; \ $(HELP2MAN) --section=8 -i $(srcdir)/docs/man/$$file.h2m -o $(DESTDIR)$(mandir)/man8/$$dest.8 $(builddir)/$$file; \
done done
@list='$(bin_SCRIPTS)'; for file in $$list; do \ @list='$(bin_SCRIPTS)'; for file in $$list; do \
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
$(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \ $(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \
$(HELP2MAN) --section=1 -i $(srcdir)/docs/man/$$dest.h2m -o $(DESTDIR)$(mandir)/man1/$$dest.1 $(builddir)/$$file; \ $(HELP2MAN) --section=1 -i $(srcdir)/docs/man/$$file.h2m -o $(DESTDIR)$(mandir)/man1/$$dest.1 $(builddir)/$$file; \
done done
@list='$(sbin_SCRIPTS)'; for file in $$list; do \ @list='$(sbin_SCRIPTS)'; for file in $$list; do \
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
$(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \ $(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \
$(HELP2MAN) --section=8 -i $(srcdir)/docs/man/$$dest.h2m -o $(DESTDIR)$(mandir)/man8/$$dest.8 $(builddir)/$$file; \ $(HELP2MAN) --section=8 -i $(srcdir)/docs/man/$$file.h2m -o $(DESTDIR)$(mandir)/man8/$$dest.8 $(builddir)/$$file; \
done done
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/grub.d $(SHELL) $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/grub.d
@list='$(grub-mkconfig_SCRIPTS)'; for file in $$list; do \ @list='$(grub-mkconfig_SCRIPTS)'; for file in $$list; do \

View file

@ -1388,6 +1388,10 @@ the global section of the configuration file (or ``menu''); most
of them can be entered on the command-line and can be used either of them can be entered on the command-line and can be used either
anywhere in the menu or specifically in the menu entries. anywhere in the menu or specifically in the menu entries.
In rescue mode, only the @command{insmod} (@pxref{insmod}), @command{ls}
(@pxref{ls}), @command{set} (@pxref{set}), and @command{unset}
(@pxref{unset}) commands are normally available.
@menu @menu
* Menu-specific commands:: * Menu-specific commands::
* General commands:: * General commands::
@ -1548,6 +1552,7 @@ you forget a command, you can run the command @command{help}
* chainloader:: Chain-load another boot loader * chainloader:: Chain-load another boot loader
* cmp:: Compare two files * cmp:: Compare two files
* configfile:: Load a configuration file * configfile:: Load a configuration file
* cpuid:: Check for CPU features
* crc:: Calculate CRC32 checksums * crc:: Calculate CRC32 checksums
* date:: Display or set current date and time * date:: Display or set current date and time
* drivemap:: Map a drive to another * drivemap:: Map a drive to another
@ -1669,6 +1674,20 @@ Load @var{file} as a configuration file.
@end deffn @end deffn
@node cpuid
@subsection cpuid
@deffn Command cpuid [-l]
Check for CPU features. This command is only available on x86 systems.
With the @option{-l} option, return true if the CPU supports long mode
(64-bit).
If invoked without options, this command currently behaves as if it had been
invoked with @option{-l}. This may change in the future.
@end deffn
@node crc @node crc
@subsection crc @subsection crc

2
docs/man/grub-emu.h2m Normal file
View file

@ -0,0 +1,2 @@
[NAME]
grub-emu \- GRUB emulator

View file

@ -992,6 +992,11 @@ grub_util_biosdisk_fini (void)
grub_disk_dev_unregister (&grub_util_biosdisk_dev); grub_disk_dev_unregister (&grub_util_biosdisk_dev);
} }
/*
* Note: we do not use the new partition naming scheme as dos_part does not
* necessarily correspond to an msdos partition. See e.g. the FreeBSD code
* in function grub_util_biosdisk_get_grub_dev.
*/
static char * static char *
make_device_name (int drive, int dos_part, int bsd_part) make_device_name (int drive, int dos_part, int bsd_part)
{ {
@ -1400,11 +1405,9 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
For NetBSD, proceed as for Linux, except that the start sector is For NetBSD, proceed as for Linux, except that the start sector is
obtained from the disk label. */ obtained from the disk label. */
{ {
char *name; char *name, *partname;
grub_disk_t disk; grub_disk_t disk;
grub_disk_addr_t start; grub_disk_addr_t start;
int dos_part = -1;
int bsd_part = -1;
auto int find_partition (grub_disk_t dsk, auto int find_partition (grub_disk_t dsk,
const grub_partition_t partition); const grub_partition_t partition);
@ -1419,17 +1422,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
if (start == part_start) if (start == part_start)
{ {
if (partition->parent) partname = grub_partition_get_name (partition);
{
dos_part = partition->parent->number;
bsd_part = partition->number;
}
else
{
dos_part = partition->number;
bsd_part = -1;
}
return 1; return 1;
} }
@ -1465,6 +1458,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
if (! disk) if (! disk)
return 0; return 0;
partname = NULL;
grub_partition_iterate (disk, find_partition); grub_partition_iterate (disk, find_partition);
if (grub_errno != GRUB_ERR_NONE) if (grub_errno != GRUB_ERR_NONE)
{ {
@ -1472,7 +1466,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
return 0; return 0;
} }
if (dos_part < 0) if (partname == NULL)
{ {
grub_disk_close (disk); grub_disk_close (disk);
grub_error (GRUB_ERR_BAD_DEVICE, grub_error (GRUB_ERR_BAD_DEVICE,
@ -1480,7 +1474,9 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
return 0; return 0;
} }
return make_device_name (drive, dos_part, bsd_part); name = grub_xasprintf ("%s,%s", disk->name, partname);
free (partname);
return name;
} }
#elif defined(__GNU__) #elif defined(__GNU__)
@ -1525,7 +1521,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
for (p = os_dev + 5; *p; ++p) for (p = os_dev + 5; *p; ++p)
if (grub_isdigit(*p)) if (grub_isdigit(*p))
{ {
p = strchr (p, 's'); p = strchr (p, 's'); /* msdos or apple (or ... ?) partition map */
if (p) if (p)
{ {
p++; p++;

View file

@ -83,6 +83,14 @@ make_install_device (void)
grub_snprintf (ptr, sizeof (dev) - (ptr - dev), ")%s", grub_prefix); grub_snprintf (ptr, sizeof (dev) - (ptr - dev), ")%s", grub_prefix);
grub_strcpy (grub_prefix, dev); grub_strcpy (grub_prefix, dev);
} }
else if (grub_prefix[1] == ',' || grub_prefix[1] == ')')
{
/* We have a prefix, but still need to fill in the boot drive. */
grub_snprintf (dev, sizeof (dev),
"(%cd%u%s", (grub_boot_drive & 0x80) ? 'h' : 'f',
grub_boot_drive & 0x7f, grub_prefix + 1);
grub_strcpy (grub_prefix, dev);
}
return grub_prefix; return grub_prefix;
} }

View file

@ -12,7 +12,6 @@ commands/efi/fixvideo.c
commands/efi/loadbios.c commands/efi/loadbios.c
commands/gptsync.c commands/gptsync.c
commands/halt.c commands/halt.c
commands/handler.c
commands/hdparm.c commands/hdparm.c
commands/help.c commands/help.c
commands/hexdump.c commands/hexdump.c

View file

@ -103,8 +103,23 @@ Report bugs to <bug-grub@gnu.org>.
EOF EOF
} }
argument () {
opt=$1
shift
if test $# -eq 0; then
echo "$0: option requires an argument -- '$opt'" 1>&2
exit 1
fi
echo $1
}
# Check the arguments. # Check the arguments.
for option in "$@"; do while test $# -gt 0
do
option=$1
shift
case "$option" in case "$option" in
-h | --help) -h | --help)
usage usage
@ -112,33 +127,62 @@ for option in "$@"; do
-v | --version) -v | --version)
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}" echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
exit 0 ;; exit 0 ;;
--modules)
modules=`argument $option "$@"`; shift;;
--modules=*) --modules=*)
modules=`echo "$option" | sed 's/--modules=//'` ;; modules=`echo "$option" | sed 's/--modules=//'` ;;
--font)
font=`argument $option "$@"`; shift;;
--font=*) --font=*)
font=`echo "$option" | sed 's/--font=//'` ;; font=`echo "$option" | sed 's/--font=//'` ;;
--root-directory)
rootdir=`argument $option "$@"`; shift;;
--root-directory=*) --root-directory=*)
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;; rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
--grub-setup)
grub_setup=`argument $option "$@"`; shift;;
--grub-setup=*) --grub-setup=*)
grub_setup=`echo "$option" | sed 's/--grub-setup=//'` ;; grub_setup=`echo "$option" | sed 's/--grub-setup=//'` ;;
--grub-mkimage)
grub_mkimage=`argument $option "$@"`; shift;;
--grub-mkimage=*) --grub-mkimage=*)
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
--grub-mkdevicemap)
grub_mkdevicemap=`argument $option "$@"`; shift;;
--grub-mkdevicemap=*) --grub-mkdevicemap=*)
grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;; grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;;
--grub-probe)
grub_probe=`argument $option "$@"`; shift;;
--grub-probe=*) --grub-probe=*)
grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;; grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;;
--no-floppy) --no-floppy)
no_floppy="--no-floppy" ;; no_floppy="--no-floppy" ;;
--recheck) --recheck)
recheck=yes ;; recheck=yes ;;
--disk-module)
if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
disk_module=`argument $option "$@"`; shift;
fi ;;
--disk-module=*) --disk-module=*)
if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
disk_module=`echo "$option" | sed 's/--disk-module=//'` disk_module=`echo "$option" | sed 's/--disk-module=//'`
fi ;; fi ;;
# This is an undocumented feature... # This is an undocumented feature...
--debug) --debug)
debug=yes ;; debug=yes ;;
-f | --force) -f | --force)
setup_force="--force" ;; setup_force="--force" ;;
-*) -*)
echo "Unrecognized option \`$option'" 1>&2 echo "Unrecognized option \`$option'" 1>&2
usage usage
@ -312,12 +356,12 @@ if [ "x${devabstraction_module}" = "x" ] ; then
else else
install_drive="`$grub_probe --target=drive --device ${install_device}`" || exit 1 install_drive="`$grub_probe --target=drive --device ${install_device}`" || exit 1
fi fi
install_drive="`echo ${install_drive} | sed -e s/,[0-9]*[a-z]*//g`" install_drive="`echo ${install_drive} | sed -e s/,[a-z0-9,]*//g`"
fi fi
grub_drive="`$grub_probe --target=drive --device ${grub_device}`" || exit 1 grub_drive="`$grub_probe --target=drive --device ${grub_device}`" || exit 1
# Strip partition number # Strip partition number
grub_drive="`echo ${grub_drive} | sed -e s/,[0-9]*[a-z]*//g`" grub_drive="`echo ${grub_drive} | sed -e s/,[a-z0-9,]*//g`"
if [ "$disk_module" = ata ] ; then if [ "$disk_module" = ata ] ; then
# generic method (used on coreboot and ata mod) # generic method (used on coreboot and ata mod)
uuid="`$grub_probe --target=fs_uuid --device ${grub_device}`" uuid="`$grub_probe --target=fs_uuid --device ${grub_device}`"

View file

@ -52,14 +52,23 @@ Report bugs to <bug-grub@gnu.org>.
EOF EOF
} }
argument () {
opt=$1
shift
if test $# -eq 0; then
echo "$0: option requires an argument -- '$opt'" 1>&2
exit 1
fi
echo $1
}
# Check the arguments. # Check the arguments.
next_grub_cfg=false while test $# -gt 0
for option in "$@"; do do
if $next_grub_cfg; then option=$1
grub_cfg=$option shift
next_grub_cfg=false
continue
fi
case "$option" in case "$option" in
-h | --help) -h | --help)
usage usage
@ -67,9 +76,8 @@ for option in "$@"; do
-v | --version) -v | --version)
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}" echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
exit 0 ;; exit 0 ;;
-o) -o | --output)
next_grub_cfg=: grub_cfg=`argument $option "$@"`; shift;;
;;
--output=*) --output=*)
grub_cfg=`echo "$option" | sed 's/--output=//'` grub_cfg=`echo "$option" | sed 's/--output=//'`
;; ;;
@ -78,13 +86,9 @@ for option in "$@"; do
usage usage
exit 1 exit 1
;; ;;
# Explicitly ignore non-option arguments, for compatibility.
esac esac
done done
if $next_grub_cfg; then
echo "Missing argument to \`-o'" 1>&2
usage
exit 1
fi
. ${libdir}/grub/grub-mkconfig_lib . ${libdir}/grub/grub-mkconfig_lib

View file

@ -53,20 +53,38 @@ Make GRUB rescue image.
-h, --help print this message and exit -h, --help print this message and exit
-v, --version print the version information and exit -v, --version print the version information and exit
--output=FILE save output in FILE [required] -o, --output=FILE save output in FILE [required]
--modules=MODULES pre-load specified modules MODULES --modules=MODULES pre-load specified modules MODULES
--rom-directory=DIR save rom images in DIR [optional] --rom-directory=DIR save rom images in DIR [optional]
--xorriso=FILE use FILE as xorriso [optional] --xorriso=FILE use FILE as xorriso [optional]
--grub-mkimage=FILE use FILE as grub-mkimage --grub-mkimage=FILE use FILE as grub-mkimage
$self generates a bootable rescue image with specified source files or directories. $self generates a bootable rescue image with specified source files, source
directories, or mkisofs options listed by: xorriso -as mkisofs -help
Option -- switches to native xorriso command mode. or directories.
Report bugs to <bug-grub@gnu.org>. Report bugs to <bug-grub@gnu.org>.
Mail xorriso support requests to <bug-xorriso@gnu.org>.
EOF EOF
} }
argument () {
opt=$1
shift
if test $# -eq 0; then
echo "$0: option requires an argument -- '$opt'" 1>&2
exit 1
fi
echo $1
}
# Check the arguments. # Check the arguments.
for option in "$@"; do while test $# -gt 0
do
option=$1
shift
case "$option" in case "$option" in
-h | --help) -h | --help)
usage usage
@ -74,29 +92,47 @@ for option in "$@"; do
-v | --version) -v | --version)
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}" echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
exit 0 ;; exit 0 ;;
--modules)
modules=`argument $option "$@"`; shift ;;
--modules=*) --modules=*)
modules=`echo "$option" | sed 's/--modules=//'` ;; modules=`echo "$option" | sed 's/--modules=//'` ;;
-o | --output)
output_image=`argument $option "$@"`; shift ;;
--output=*) --output=*)
output_image=`echo "$option" | sed 's/--output=//'` ;; output_image=`echo "$option" | sed 's/--output=//'` ;;
--rom-directory)
rom_directory=`argument $option "$@"`; shift ;;
--rom-directory=*) --rom-directory=*)
rom_directory=`echo "$option" | sed 's/--rom-directory=//'` ;; rom_directory=`echo "$option" | sed 's/--rom-directory=//'` ;;
# Intentionally undocumented # Intentionally undocumented
--override-directory)
override_dir=`argument $option "$@"`
shift
PATH=${override_dir}:$PATH
export PATH
;;
--override-directory=*) --override-directory=*)
override_dir=`echo "${option}/" | sed 's/--override-directory=//'` override_dir=`echo "${option}/" | sed 's/--override-directory=//'`
PATH=${override_dir}:$PATH PATH=${override_dir}:$PATH
export PATH export PATH
;; ;;
--grub-mkimage)
grub_mkimage=`argument $option "$@"`; shift ;;
--grub-mkimage=*) --grub-mkimage=*)
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
--xorriso)
xorriso=`argument $option "$@"`; shift ;;
--xorriso=*) --xorriso=*)
xorriso=`echo "${option}/" | sed 's/--xorriso=//'` ;; xorriso=`echo "${option}/" | sed 's/--xorriso=//'` ;;
-*)
echo "Unrecognized option \`$option'" 1>&2
usage
exit 1
;;
*) *)
source="${source} ${option}" ;; source="${source} ${option} $@"; break ;;
esac esac
done done

View file

@ -48,8 +48,23 @@ Report bugs to <bug-grub@gnu.org>.
EOF EOF
} }
argument () {
opt=$1
shift
if test $# -eq 0; then
echo "$0: option requires an argument -- '$opt'" 1>&2
exit 1
fi
echo $1
}
# Check the arguments. # Check the arguments.
for option in "$@"; do while test $# -gt 0
do
option=$1
shift
case "$option" in case "$option" in
-h | --help) -h | --help)
usage usage
@ -57,8 +72,12 @@ for option in "$@"; do
-v | --version) -v | --version)
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}" echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
exit 0 ;; exit 0 ;;
--root-directory)
rootdir=`argument $option "$@"`; shift ;;
--root-directory=*) --root-directory=*)
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;; rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
-*) -*)
echo "Unrecognized option \`$option'" 1>&2 echo "Unrecognized option \`$option'" 1>&2
usage usage

View file

@ -48,8 +48,23 @@ Report bugs to <bug-grub@gnu.org>.
EOF EOF
} }
argument () {
opt=$1
shift
if test $# -eq 0; then
echo "$0: option requires an argument -- '$opt'" 1>&2
exit 1
fi
echo $1
}
# Check the arguments. # Check the arguments.
for option in "$@"; do while test $# -gt 0
do
option=$1
shift
case "$option" in case "$option" in
-h | --help) -h | --help)
usage usage
@ -57,8 +72,12 @@ for option in "$@"; do
-v | --version) -v | --version)
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}" echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
exit 0 ;; exit 0 ;;
--root-directory)
rootdir=`argument $option "$@"`; shift ;;
--root-directory=*) --root-directory=*)
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;; rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
-*) -*)
echo "Unrecognized option \`$option'" 1>&2 echo "Unrecognized option \`$option'" 1>&2
usage usage

View file

@ -73,8 +73,23 @@ Report bugs to <bug-grub@gnu.org>.
EOF EOF
} }
argument () {
opt=$1
shift
if test $# -eq 0; then
echo "$0: option requires an argument -- '$opt'" 1>&2
exit 1
fi
echo $1
}
# Check the arguments. # Check the arguments.
for option in "$@"; do while test $# -gt 0
do
option=$1
shift
case "$option" in case "$option" in
-h | --help) -h | --help)
usage usage
@ -82,16 +97,32 @@ for option in "$@"; do
-v | --version) -v | --version)
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}" echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
exit 0 ;; exit 0 ;;
--modules)
modules=`argument $option "$@"`; shift ;;
--modules=*) --modules=*)
modules=`echo "$option" | sed 's/--modules=//'` ;; modules=`echo "$option" | sed 's/--modules=//'` ;;
--root-directory)
rootdir=`argument $option "$@"`; shift ;;
--root-directory=*) --root-directory=*)
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;; rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
--grub-mkimage)
grub_mkimage=`argument $option "$@"`; shift ;;
--grub-mkimage=*) --grub-mkimage=*)
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
--grub-mkdevicemap)
grub_mkdevicemap=`argument $option "$@"`; shift ;;
--grub-mkdevicemap=*) --grub-mkdevicemap=*)
grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;; grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;;
--grub-probe)
grub_probe=`argument $option "$@"`; shift ;;
--grub-probe=*) --grub-probe=*)
grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;; grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;;
--no-floppy) --no-floppy)
no_floppy="--no-floppy" ;; no_floppy="--no-floppy" ;;
--recheck) --recheck)

View file

@ -99,6 +99,7 @@ setup (const char *dir,
struct grub_boot_blocklist *first_block, *block; struct grub_boot_blocklist *first_block, *block;
grub_int32_t *install_dos_part, *install_bsd_part; grub_int32_t *install_dos_part, *install_bsd_part;
grub_int32_t dos_part, bsd_part; grub_int32_t dos_part, bsd_part;
char *prefix;
char *tmp_img; char *tmp_img;
int i; int i;
grub_disk_addr_t first_sector; grub_disk_addr_t first_sector;
@ -230,6 +231,8 @@ setup (const char *dir,
+ GRUB_KERNEL_MACHINE_INSTALL_DOS_PART); + GRUB_KERNEL_MACHINE_INSTALL_DOS_PART);
install_bsd_part = (grub_int32_t *) (core_img + GRUB_DISK_SECTOR_SIZE install_bsd_part = (grub_int32_t *) (core_img + GRUB_DISK_SECTOR_SIZE
+ GRUB_KERNEL_MACHINE_INSTALL_BSD_PART); + GRUB_KERNEL_MACHINE_INSTALL_BSD_PART);
prefix = (char *) (core_img + GRUB_DISK_SECTOR_SIZE +
GRUB_KERNEL_MACHINE_PREFIX);
/* Open the root device and the destination device. */ /* Open the root device and the destination device. */
root_dev = grub_device_open (root); root_dev = grub_device_open (root);
@ -305,6 +308,18 @@ setup (const char *dir,
dos_part = root_dev->disk->partition->number; dos_part = root_dev->disk->partition->number;
bsd_part = -1; bsd_part = -1;
} }
if (prefix[0] != '(')
{
char *root_part_name, *new_prefix;
root_part_name =
grub_partition_get_name (root_dev->disk->partition);
new_prefix = xasprintf ("(,%s)%s", root_part_name, prefix);
strcpy (prefix, new_prefix);
free (new_prefix);
free (root_part_name);
}
} }
else else
dos_part = bsd_part = -1; dos_part = bsd_part = -1;

View file

@ -76,8 +76,23 @@ Report bugs to <bug-grub@gnu.org>.
EOF EOF
} }
argument () {
opt=$1
shift
if test $# -eq 0; then
echo "$0: option requires an argument -- '$opt'" 1>&2
exit 1
fi
echo $1
}
# Check the arguments. # Check the arguments.
for option in "$@"; do while test $# -gt 0
do
option=$1
shift
case "$option" in case "$option" in
-h | --help) -h | --help)
usage usage
@ -85,16 +100,32 @@ for option in "$@"; do
-v | --version) -v | --version)
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}" echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
exit 0 ;; exit 0 ;;
--modules)
modules=`argument $option "$@"`; shift ;;
--modules=*) --modules=*)
modules=`echo "$option" | sed 's/--modules=//'` ;; modules=`echo "$option" | sed 's/--modules=//'` ;;
--root-directory)
rootdir=`argument $option "$@"`; shift ;;
--root-directory=*) --root-directory=*)
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;; rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
--grub-mkdevicemap)
grub_mkdevicemap=`argument $option "$@"`; shift ;;
--grub-mkdevicemap=*) --grub-mkdevicemap=*)
grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;; grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;;
--grub-mkimage)
grub_mkimage=`argument $option "$@"`; shift ;;
--grub-mkimage=*) --grub-mkimage=*)
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
--grub-probe)
grub_probe=`argument $option "$@"`; shift ;;
--grub-probe=*) --grub-probe=*)
grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;; grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;;
--no-nvram) --no-nvram)
update_nvram=no ;; update_nvram=no ;;
# This is an undocumented feature... # This is an undocumented feature...

View file

@ -54,10 +54,25 @@ Report bugs to <bug-grub@gnu.org>.
EOF EOF
} }
argument () {
opt=$1
shift
if test $# -eq 0; then
echo "$0: option requires an argument -- '$opt'" 1>&2
exit 1
fi
echo $1
}
input_dir=${pkglibdir} input_dir=${pkglibdir}
# Check the arguments. # Check the arguments.
for option in "$@"; do while test $# -gt 0
do
option=$1
shift
case "$option" in case "$option" in
-h | --help) -h | --help)
usage usage
@ -65,12 +80,22 @@ for option in "$@"; do
-v | --version) -v | --version)
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}" echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
exit 0 ;; exit 0 ;;
--modules)
modules=`argument $option "$@"`; shift ;;
--modules=*) --modules=*)
modules=`echo "$option" | sed 's/--modules=//'` ;; modules=`echo "$option" | sed 's/--modules=//'` ;;
--pkglibdir)
input_dir=`argument $option "$@"`; shift ;;
--pkglibdir=*) --pkglibdir=*)
input_dir=`echo "$option" | sed 's/--pkglibdir=//'` ;; input_dir=`echo "$option" | sed 's/--pkglibdir=//'` ;;
--grub-mkimage)
grub_mkimage=`argument $option "$@"`; shift ;;
--grub-mkimage=*) --grub-mkimage=*)
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
-*) -*)
echo "Unrecognized option \`$option'" 1>&2 echo "Unrecognized option \`$option'" 1>&2
usage usage