2006-10-14 Robert Millan <rmh@aybabtu.com>
* util/i386/pc/getroot.c (grub_guess_root_device): Stop using grub_util_biosdisk_get_grub_dev to convert system device to GRUB device. * util/grub-emu.c (main): Use grub_util_biosdisk_get_grub_dev with the string returned by grub_guess_root_device. * util/i386/pc/grub-setup.c: Likewise. * util/i386/pc/grub-probefs.c: Likewise. * util/i386/pc/grub-probefs.c: Rename to ... * util/i386/pc/grub-probe.c: ... this. * DISTLIST: Remove grub-probefs, add grub-probe. * conf/i386-efi.rmk: Likewise. * conf/i386-pc.rmk: Likewise. * util/i386/pc/grub-install.in: Likewise. * util/i386/pc/grub-probe.c: Add --target=(fs|device|drive) option to choose which information we want to print.
This commit is contained in:
parent
2b00217369
commit
ddd5cee9a9
9 changed files with 80 additions and 22 deletions
19
ChangeLog
19
ChangeLog
|
@ -1,3 +1,22 @@
|
|||
2006-10-14 Robert Millan <rmh@aybabtu.com>
|
||||
|
||||
* util/i386/pc/getroot.c (grub_guess_root_device): Stop using
|
||||
grub_util_biosdisk_get_grub_dev to convert system device to GRUB device.
|
||||
* util/grub-emu.c (main): Use grub_util_biosdisk_get_grub_dev with the
|
||||
string returned by grub_guess_root_device.
|
||||
* util/i386/pc/grub-setup.c: Likewise.
|
||||
* util/i386/pc/grub-probefs.c: Likewise.
|
||||
|
||||
* util/i386/pc/grub-probefs.c: Rename to ...
|
||||
* util/i386/pc/grub-probe.c: ... this.
|
||||
* DISTLIST: Remove grub-probefs, add grub-probe.
|
||||
* conf/i386-efi.rmk: Likewise.
|
||||
* conf/i386-pc.rmk: Likewise.
|
||||
* util/i386/pc/grub-install.in: Likewise.
|
||||
|
||||
* util/i386/pc/grub-probe.c: Add --target=(fs|device|drive) option to
|
||||
choose which information we want to print.
|
||||
|
||||
2006-10-14 Yoshinori K. Okuji <okuji@enbug.org>
|
||||
|
||||
* DISTLIST: Added commands/echo.c, disk/lvm.c, disk/raid.c,
|
||||
|
|
2
DISTLIST
2
DISTLIST
|
@ -264,7 +264,7 @@ util/i386/pc/getroot.c
|
|||
util/i386/pc/grub-install.in
|
||||
util/i386/pc/grub-mkdevicemap.c
|
||||
util/i386/pc/grub-mkimage.c
|
||||
util/i386/pc/grub-probefs.c
|
||||
util/i386/pc/grub-probe.c
|
||||
util/i386/pc/grub-setup.c
|
||||
util/i386/pc/misc.c
|
||||
util/powerpc/ieee1275/grub-install.in
|
||||
|
|
|
@ -6,7 +6,7 @@ COMMON_LDFLAGS = -melf_i386 -nostdlib
|
|||
|
||||
# Utilities.
|
||||
bin_UTILITIES = grub-mkimage
|
||||
#sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probefs
|
||||
#sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probe
|
||||
|
||||
# For grub-mkimage.
|
||||
grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \
|
||||
|
@ -23,8 +23,8 @@ grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \
|
|||
# For grub-mkdevicemap.
|
||||
#grub_mkdevicemap_SOURCES = util/i386/pc/grub-mkdevicemap.c util/misc.c
|
||||
|
||||
# For grub-probefs.
|
||||
#grub_probefs_SOURCES = util/i386/pc/grub-probefs.c \
|
||||
# For grub-probe.
|
||||
#grub_probe_SOURCES = util/i386/pc/grub-probe.c \
|
||||
# util/i386/pc/biosdisk.c util/misc.c util/i386/pc/getroot.c \
|
||||
# kern/device.c kern/disk.c kern/err.c kern/misc.c fs/fat.c \
|
||||
# fs/ext2.c kern/parser.c kern/partition.c partmap/pc.c fs/ufs.c \
|
||||
|
|
|
@ -51,7 +51,7 @@ kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genke
|
|||
|
||||
# Utilities.
|
||||
bin_UTILITIES = grub-mkimage
|
||||
sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probefs
|
||||
sbin_UTILITIES = grub-setup grub-emu grub-mkdevicemap grub-probe
|
||||
|
||||
# For grub-mkimage.
|
||||
grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \
|
||||
|
@ -69,8 +69,8 @@ grub_setup_SOURCES = util/i386/pc/grub-setup.c util/i386/pc/biosdisk.c \
|
|||
# For grub-mkdevicemap.
|
||||
grub_mkdevicemap_SOURCES = util/i386/pc/grub-mkdevicemap.c util/misc.c
|
||||
|
||||
# For grub-probefs.
|
||||
grub_probefs_SOURCES = util/i386/pc/grub-probefs.c \
|
||||
# For grub-probe.
|
||||
grub_probe_SOURCES = util/i386/pc/grub-probe.c \
|
||||
util/i386/pc/biosdisk.c util/misc.c util/i386/pc/getroot.c \
|
||||
kern/device.c kern/disk.c kern/err.c kern/misc.c fs/fat.c \
|
||||
fs/ext2.c kern/parser.c kern/partition.c partmap/pc.c fs/ufs.c \
|
||||
|
|
|
@ -185,7 +185,7 @@ main (int argc, char *argv[])
|
|||
/* Make sure that there is a root device. */
|
||||
if (! args.root_dev)
|
||||
{
|
||||
args.root_dev = grub_guess_root_device (args.dir ? : DEFAULT_DIRECTORY);
|
||||
args.root_dev = grub_util_biosdisk_get_grub_dev (grub_guess_root_device (args.dir ? : DEFAULT_DIRECTORY));
|
||||
if (! args.root_dev)
|
||||
{
|
||||
grub_util_info ("guessing the root device failed, because of `%s'",
|
||||
|
|
|
@ -245,5 +245,5 @@ grub_guess_root_device (const char *dir)
|
|||
}
|
||||
#endif
|
||||
|
||||
return grub_util_biosdisk_get_grub_dev (os_dev);
|
||||
return os_dev;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ pkglibdir=${libdir}/${PACKAGE_TARNAME}/${target_cpu}-${platform}
|
|||
grub_setup=${sbindir}/grub-setup
|
||||
grub_mkimage=${bindir}/grub-mkimage
|
||||
grub_mkdevicemap=${sbindir}/grub-mkdevicemap
|
||||
grub_probefs=${sbindir}/grub-probefs
|
||||
grub_probe=${sbindir}/grub-probe
|
||||
rootdir=
|
||||
grub_prefix=/boot/grub
|
||||
modules=
|
||||
|
@ -59,7 +59,7 @@ Install GRUB on your drive.
|
|||
--grub-setup=FILE use FILE as grub-setup
|
||||
--grub-mkimage=FILE use FILE as grub-mkimage
|
||||
--grub-mkdevicemap=FILE use FILE as grub-mkdevicemap
|
||||
--grub-probefs=FILE use FILE as grub-probefs
|
||||
--grub-probe=FILE use FILE as grub-probe
|
||||
--no-floppy do not probe any floppy drive
|
||||
--recheck probe a device map even if it already exists
|
||||
|
||||
|
@ -92,8 +92,8 @@ for option in "$@"; do
|
|||
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
|
||||
--grub-mkdevicemap=*)
|
||||
grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;;
|
||||
--grub-probefs=*)
|
||||
grub_probefs=`echo "$option" | sed 's/--grub-probefs=//'` ;;
|
||||
--grub-probe=*)
|
||||
grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;;
|
||||
--no-floppy)
|
||||
no_floppy="--no-floppy" ;;
|
||||
--recheck)
|
||||
|
@ -207,7 +207,7 @@ for file in ${pkglibdir}/*.mod ${pkglibdir}/*.lst ${pkglibdir}/*.img; do
|
|||
done
|
||||
|
||||
# Create the core image. First, auto-detect the filesystem module.
|
||||
fs_module=`$grub_probefs --device-map=${device_map} ${grubdir}`
|
||||
fs_module=`$grub_probe --target=fs --device-map=${device_map} ${grubdir}`
|
||||
if test "x$fs_module" = x -a "x$modules" = x; then
|
||||
echo "Auto-detection of a filesystem module failed." 1>&2
|
||||
echo "Please specify the module with the option \`--modules' explicitly." 1>&2
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* grub-probefs.c - probe a filesystem module for a given path */
|
||||
/* grub-probe.c - probe device information for a given path */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2005,2006 Free Software Foundation, Inc.
|
||||
|
@ -47,6 +47,12 @@
|
|||
|
||||
#define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map"
|
||||
|
||||
#define PRINT_FS 0
|
||||
#define PRINT_DRIVE 1
|
||||
#define PRINT_DEVICE 2
|
||||
|
||||
int print = PRINT_FS;
|
||||
|
||||
void
|
||||
grub_putchar (int c)
|
||||
{
|
||||
|
@ -74,13 +80,33 @@ static void
|
|||
probe (const char *path)
|
||||
{
|
||||
char *device_name;
|
||||
char *drive_name;
|
||||
grub_device_t dev;
|
||||
grub_fs_t fs;
|
||||
|
||||
device_name = grub_guess_root_device (path);
|
||||
if (! device_name)
|
||||
{
|
||||
fprintf (stderr, "cannot find a GRUB device for %s.\n", path);
|
||||
fprintf (stderr, "cannot find a device for %s.\n", path);
|
||||
return;
|
||||
}
|
||||
|
||||
if (print == PRINT_DEVICE)
|
||||
{
|
||||
printf ("%s\n", device_name);
|
||||
return;
|
||||
}
|
||||
|
||||
drive_name = grub_util_biosdisk_get_grub_dev (device_name);
|
||||
if (! drive_name)
|
||||
{
|
||||
fprintf (stderr, "cannot find a GRUB drive for %s.\n", drive_name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (print == PRINT_DRIVE)
|
||||
{
|
||||
printf ("(%s)\n", drive_name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -102,6 +128,7 @@ probe (const char *path)
|
|||
static struct option options[] =
|
||||
{
|
||||
{"device-map", required_argument, 0, 'm'},
|
||||
{"target", required_argument, 0, 't'},
|
||||
{"help", no_argument, 0, 'h'},
|
||||
{"version", no_argument, 0, 'V'},
|
||||
{"verbose", no_argument, 0, 'v'},
|
||||
|
@ -113,14 +140,15 @@ usage (int status)
|
|||
{
|
||||
if (status)
|
||||
fprintf (stderr,
|
||||
"Try ``grub-probefs --help'' for more information.\n");
|
||||
"Try ``grub-probe --help'' for more information.\n");
|
||||
else
|
||||
printf ("\
|
||||
Usage: grub-probefs [OPTION]... PATH\n\
|
||||
Usage: grub-probe [OPTION]... PATH\n\
|
||||
\n\
|
||||
Probe a filesystem module for a given path.\n\
|
||||
Probe device information for a given path.\n\
|
||||
\n\
|
||||
-m, --device-map=FILE use FILE as the device map [default=%s]\n\
|
||||
-t, --target=(fs|drive|device) print filesystem module, GRUB drive or system device [default=fs]\n\
|
||||
-h, --help display this message and exit\n\
|
||||
-V, --version print version information and exit\n\
|
||||
-v, --verbose print verbose messages\n\
|
||||
|
@ -138,12 +166,12 @@ main (int argc, char *argv[])
|
|||
char *dev_map = 0;
|
||||
char *path;
|
||||
|
||||
progname = "grub-probefs";
|
||||
progname = "grub-probe";
|
||||
|
||||
/* Check for options. */
|
||||
while (1)
|
||||
{
|
||||
int c = getopt_long (argc, argv, "m:hVv", options, 0);
|
||||
int c = getopt_long (argc, argv, "m:t:hVv", options, 0);
|
||||
|
||||
if (c == -1)
|
||||
break;
|
||||
|
@ -157,6 +185,17 @@ main (int argc, char *argv[])
|
|||
dev_map = xstrdup (optarg);
|
||||
break;
|
||||
|
||||
case 't':
|
||||
if (!strcmp (optarg, "fs"))
|
||||
print = PRINT_FS;
|
||||
else if (!strcmp (optarg, "drive"))
|
||||
print = PRINT_DRIVE;
|
||||
else if (!strcmp (optarg, "device"))
|
||||
print = PRINT_DEVICE;
|
||||
else
|
||||
usage (1);
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
usage (0);
|
||||
break;
|
||||
|
|
|
@ -683,7 +683,7 @@ main (int argc, char *argv[])
|
|||
}
|
||||
else
|
||||
{
|
||||
root_dev = grub_guess_root_device (dir ? : DEFAULT_DIRECTORY);
|
||||
root_dev = grub_util_biosdisk_get_grub_dev (grub_guess_root_device (dir ? : DEFAULT_DIRECTORY));
|
||||
if (! root_dev)
|
||||
{
|
||||
grub_util_info ("guessing the root device failed, because of `%s'",
|
||||
|
|
Loading…
Reference in a new issue