grub-probefs --root-device
PATCH 1/1 grub-probefs --root-device
This would be very useful to get rid of ugly kludges in Debian, such as this one:
http://svn.debian.org/wsvn/pkg-grub/grub2/trunk/debian/update-grub?op=file&rev=0&sc=0
(look for convert() here)
Fortunately grub-probefs is already doing what we need, we just need a way to tell it to print the information.
2006-09-22 Robert Millan <[email protected]>
* util/i386/pc/grub-probefs.c: Add -r|--root-device option (print guessed root device and exit).
Signature · 4 lines
Robert Millan My spam trap is [email protected]. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list.
2006-09-22 Robert Millan <[email protected]>
* util/i386/pc/grub-probefs.c: Add -r|--root-device option (print guessed root device and exit).
Index: util/i386/pc/grub-probefs.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-probefs.c,v retrieving revision 1.3
i386/pc/grub-probefs.c +14 -1
@@ -47,6 +47,8 @@#define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map" +int print_root =0 ; +void grub_putchar (int c) {
@@ -84,6 +86,12 @@return ; } +if (print_root) + { +printf ("(%s)\n" , device_name); +return ; + } +grub_util_info ("opening %s" , device_name); dev =grub_device_open (device_name);if (! dev)
@@ -121,6 +129,7 @@ Probe a filesystem module for a given path.\n\ \n\ -m, --device-map=FILE use FILE as the device map [default=%s]\n\ + -r, --root-device print guessed root device and exit\n\ -h, --help display this message and exit\n\ -V, --version print version information and exit\n\ -v, --verbose print verbose messages\n\
@@ -143,7 +152,7 @@/* Check for options. */ while (1 ) { -int c =getopt_long (argc, argv,"m:hVv" , options,0 ); +int c =getopt_long (argc, argv,"m:rhVv" , options,0 );if (c ==-1 )break ;
@@ -157,6 +166,10 @@ dev_map =xstrdup (optarg);break ; +case 'r' : + print_root=1 ; +break ; +case 'h' :usage (0 );break ;
Quoted 8 lines · Robert Millan
This would be very useful to get rid of ugly kludges in Debian, such as this one:
http://svn.debian.org/wsvn/pkg-grub/grub2/trunk/debian/update-grub?op=file&rev=0&sc=0
(look forconvert()here)Fortunately grub-probefs is already doing what we need, we just need a way to tell it to print the information.
Uhm it seems I need the system device name as well. Please look at this new patch with an additional option (I had to rework the grub_guess_root_device interface to get the info yet unprocessed by grub_util_biosdisk_get_grub_dev).
2006-09-22 Robert Millan <[email protected]>
* 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: Use grub_util_biosdisk_get_grub_dev with the string returned by grub_guess_root_device.
* util/i386/pc/grub-setup.c: Ditto.
* util/i386/pc/grub-probefs.c: Ditto.
* util/i386/pc/grub-probefs.c: Add two options (--grub-root-device and --root-device) to print GRUB or system device and exit.
Signature · 4 lines
Robert Millan My spam trap is [email protected]. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list.
2006-09-22 Robert Millan <[email protected]>
* 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: Use grub_util_biosdisk_get_grub_dev with the string returned by grub_guess_root_device.
* util/i386/pc/grub-setup.c: Ditto.
* util/i386/pc/grub-probefs.c: Ditto.
* util/i386/pc/grub-probefs.c: Add two options (--grub-root-device and --root-device) to print GRUB or system device and exit.
Index: util/grub-emu.c
===================================================================
RCS file: /sources/grub/grub2/util/grub-emu.c,v
retrieving revision 1.30
grub-emu.c +1 -1
@@ -185,7 +185,7 @@/* 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'",
Index: util/i386/pc/getroot.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/getroot.c,v retrieving revision 1.5
i386/pc/getroot.c +1 -1
@@ -223,5 +223,5 @@if (! os_dev)return 0 ; -return grub_util_biosdisk_get_grub_dev (os_dev); +return os_dev; }
Index: util/i386/pc/grub-probefs.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-probefs.c,v retrieving revision 1.3
i386/pc/grub-probefs.c +37 -2
@@ -47,6 +47,9 @@#define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map" +int print_root =0 ; +int print_grub_root =0 ; +void grub_putchar (int c) {
@@ -74,13 +77,33 @@ probe (const char *path) {char *device_name; +char *grub_device_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 ; + } + + grub_device_name =grub_util_biosdisk_get_grub_dev (device_name); +if (! grub_device_name) + { +fprintf (stderr,"cannot find a GRUB device for %s.\n" , device_name); +return ; + } + +if (print_root) + { +printf ("%s\n" , device_name); +return ; + } + +if (print_grub_root) + { +printf ("(%s)\n" , grub_device_name);return ; }
@@ -102,6 +125,8 @@static struct option options[] = { {"device-map" , required_argument,0 ,'m' }, + {"root-device" , no_argument,0 ,'r' }, + {"grub-root-device" , no_argument,0 ,'g' }, {"help" , no_argument,0 ,'h' }, {"version" , no_argument,0 ,'V' }, {"verbose" , no_argument,0 ,'v' },
@@ -121,6 +146,8 @@ Probe a filesystem module for a given path.\n\ \n\ -m, --device-map=FILE use FILE as the device map [default=%s]\n\ + -r, --root-device print guessed root device and exit\n\ + -g, --grub-root-device print guessed GRUB root device and exit\n\ -h, --help display this message and exit\n\ -V, --version print version information and exit\n\ -v, --verbose print verbose messages\n\
@@ -143,7 +170,7 @@/* Check for options. */ while (1 ) { -int c =getopt_long (argc, argv,"m:hVv" , options,0 ); +int c =getopt_long (argc, argv,"m:rghVv" , options,0 );if (c ==-1 )break ;
@@ -157,6 +184,14 @@ dev_map =xstrdup (optarg);break ; +case 'r' : + print_root=1 ; +break ; + +case 'g' : + print_grub_root=1 ; +break ; +case 'h' :usage (0 );break ;
Index: util/i386/pc/grub-setup.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-setup.c,v retrieving revision 1.18
i386/pc/grub-setup.c +1 -1
@@ -669,7 +669,7 @@ }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'",
Quoted 8 lines · Robert Millan
This would be very useful to get rid of ugly kludges in Debian, such as this one:
http://svn.debian.org/wsvn/pkg-grub/grub2/trunk/debian/update-grub?op=file&
rev=0&sc=0 (look forconvert()here)Fortunately grub-probefs is already doing what we need, we just need a way to tell it to print the information.
However, this usage is against the original meaning, thus the naming is not appropriate any longer. In addition, I don't like that we make an ad-hoc text output (the first line is a fs module name, the second line is a root device name, etc.).
So I propose that we rename the utility to "grub-probe" and add some options to change the target of grub-probe. The default should be probing a fs to help people who are used to grub-probefs. Here is an example:
$ grub-probe --target=fs ufs $ grub-probe ufs $ grub-probe --target=drive (hd0,1) $ grub-probe --target=device /dev/hda1
What do you think?
Okuji
Quoted 19 lines · Yoshinori K. Okuji
However, this usage is against the original meaning, thus the naming is not appropriate any longer. In addition, I don't like that we make an ad-hoc text output (the first line is a fs module name, the second line is a root device name, etc.).
So I propose that we rename the utility to "grub-probe" and add some options to change the target of grub-probe. The default should be probing a fs to help people who are used to grub-probefs. Here is an example:
$ grub-probe --target=fs ufs $ grub-probe ufs $ grub-probe --target=drive (hd0,1) $ grub-probe --target=device /dev/hda1
Quoted 1 line
What do you think?
Fine with me. Please see attached patch (note: for readability I omitted the rename itself from my patch).
2006-09-23 Robert Millan <[email protected]>
* 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: Use grub_util_biosdisk_get_grub_dev with the string returned by grub_guess_root_device.
* util/i386/pc/grub-setup.c: Ditto.
* util/i386/pc/grub-probefs.c: Ditto.
* util/i386/pc/grub-probefs.c: Rename to ...
* util/i386/pc/grub-probe.c: ... this.
* DISTLIST: Update reference to grub-probefs.
* conf/i386-efi.mk: Ditto.
* conf/i386-efi.rmk: Ditto.
* conf/i386-pc.mk: Ditto.
* conf/i386-pc.rmk: Ditto.
* util/i386/pc/grub-install.in: Ditto.
* util/i386/pc/grub-probe.c: Add --target=(fs|device|drive) option to choose which information we want to print.
Signature · 4 lines
Robert Millan My spam trap is [email protected]. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list.
2006-09-23 Robert Millan <[email protected]>
* 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: Use grub_util_biosdisk_get_grub_dev with the string returned by grub_guess_root_device.
* util/i386/pc/grub-setup.c: Ditto.
* util/i386/pc/grub-probefs.c: Ditto.
* util/i386/pc/grub-probefs.c: Rename to ...
* util/i386/pc/grub-probe.c: ... this.
* DISTLIST: Update reference to grub-probefs.
* conf/i386-efi.mk: Ditto.
* conf/i386-efi.rmk: Ditto.
* conf/i386-pc.mk: Ditto.
* conf/i386-pc.rmk: Ditto.
* util/i386/pc/grub-install.in: Ditto.
* util/i386/pc/grub-probe.c: Add --target=(fs|device|drive) option to choose which information we want to print.
Index: DISTLIST
===================================================================
RCS file: /sources/grub/grub2/DISTLIST,v
retrieving revision 1.36
DISTLIST +1 -1
@@ -253,7 +253,7 @@ 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
Index: conf/i386-efi.mk
===================================================================
RCS file: /sources/grub/grub2/conf/i386-efi.mk,v
retrieving revision 1.15
i386-efi.mk +3 -3
@@ -6,7 +6,7 @@ # 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 \
@@ -41,8 +41,8 @@ # 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_probefs_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 \
Index: conf/i386-efi.rmk
===================================================================
RCS file: /sources/grub/grub2/conf/i386-efi.rmk,v
retrieving revision 1.9
i386-efi.rmk +3 -3
@@ -6,7 +6,7 @@ # 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 @@ # 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_probefs_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 \
Index: conf/i386-pc.mk
===================================================================
RCS file: /sources/grub/grub2/conf/i386-pc.mk,v
retrieving revision 1.78
i386-pc.mk +6 -6
@@ -183,7 +183,7 @@ # 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 \
@@ -339,20 +339,20 @@ -include grub_mkdevicemap-util_misc.d -# For grub-probefs. -grub_probefs_SOURCES = util/i386/pc/grub-probefs.c \ +# For grub-probe. +grub_probefs_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 \ fs/minix.c fs/hfs.c fs/jfs.c kern/fs.c kern/env.c fs/fshelp.c \ fs/xfs.c fs/affs.c fs/sfs.c fs/hfsplus.c -CLEANFILES += grub-probefs grub_probefs-util_i386_pc_grub_probefs.o grub_probefs-util_i386_pc_biosdisk.o grub_probefs-util_misc.o grub_probefs-util_i386_pc_getroot.o grub_probefs-kern_device.o grub_probefs-kern_disk.o grub_probefs-kern_err.o grub_probefs-kern_misc.o grub_probefs-fs_fat.o grub_probefs-fs_ext2.o grub_probefs-kern_parser.o grub_probefs-kern_partition.o grub_probefs-partmap_pc.o grub_probefs-fs_ufs.o grub_probefs-fs_minix.o grub_probefs-fs_hfs.o grub_probefs-fs_jfs.o grub_probefs-kern_fs.o grub_probefs-kern_env.o grub_probefs-fs_fshelp.o grub_probefs-fs_xfs.o grub_probefs-fs_affs.o grub_probefs-fs_sfs.o grub_probefs-fs_hfsplus.o +CLEANFILES += grub-probe grub_probefs-util_i386_pc_grub_probefs.o grub_probefs-util_i386_pc_biosdisk.o grub_probefs-util_misc.o grub_probefs-util_i386_pc_getroot.o grub_probefs-kern_device.o grub_probefs-kern_disk.o grub_probefs-kern_err.o grub_probefs-kern_misc.o grub_probefs-fs_fat.o grub_probefs-fs_ext2.o grub_probefs-kern_parser.o grub_probefs-kern_partition.o grub_probefs-partmap_pc.o grub_probefs-fs_ufs.o grub_probefs-fs_minix.o grub_probefs-fs_hfs.o grub_probefs-fs_jfs.o grub_probefs-kern_fs.o grub_probefs-kern_env.o grub_probefs-fs_fshelp.o grub_probefs-fs_xfs.o grub_probefs-fs_affs.o grub_probefs-fs_sfs.o grub_probefs-fs_hfsplus.o MOSTLYCLEANFILES += grub_probefs-util_i386_pc_grub_probefs.d grub_probefs-util_i386_pc_biosdisk.d grub_probefs-util_misc.d grub_probefs-util_i386_pc_getroot.d grub_probefs-kern_device.d grub_probefs-kern_disk.d grub_probefs-kern_err.d grub_probefs-kern_misc.d grub_probefs-fs_fat.d grub_probefs-fs_ext2.d grub_probefs-kern_parser.d grub_probefs-kern_partition.d grub_probefs-partmap_pc.d grub_probefs-fs_ufs.d grub_probefs-fs_minix.d grub_probefs-fs_hfs.d grub_probefs-fs_jfs.d grub_probefs-kern_fs.d grub_probefs-kern_env.d grub_probefs-fs_fshelp.d grub_probefs-fs_xfs.d grub_probefs-fs_affs.d grub_probefs-fs_sfs.d grub_probefs-fs_hfsplus.d -grub-probefs: $(grub_probefs_DEPENDENCIES) grub_probefs-util_i386_pc_grub_probefs.o grub_probefs-util_i386_pc_biosdisk.o grub_probefs-util_misc.o grub_probefs-util_i386_pc_getroot.o grub_probefs-kern_device.o grub_probefs-kern_disk.o grub_probefs-kern_err.o grub_probefs-kern_misc.o grub_probefs-fs_fat.o grub_probefs-fs_ext2.o grub_probefs-kern_parser.o grub_probefs-kern_partition.o grub_probefs-partmap_pc.o grub_probefs-fs_ufs.o grub_probefs-fs_minix.o grub_probefs-fs_hfs.o grub_probefs-fs_jfs.o grub_probefs-kern_fs.o grub_probefs-kern_env.o grub_probefs-fs_fshelp.o grub_probefs-fs_xfs.o grub_probefs-fs_affs.o grub_probefs-fs_sfs.o grub_probefs-fs_hfsplus.o +grub-probe: $(grub_probefs_DEPENDENCIES) grub_probefs-util_i386_pc_grub_probefs.o grub_probefs-util_i386_pc_biosdisk.o grub_probefs-util_misc.o grub_probefs-util_i386_pc_getroot.o grub_probefs-kern_device.o grub_probefs-kern_disk.o grub_probefs-kern_err.o grub_probefs-kern_misc.o grub_probefs-fs_fat.o grub_probefs-fs_ext2.o grub_probefs-kern_parser.o grub_probefs-kern_partition.o grub_probefs-partmap_pc.o grub_probefs-fs_ufs.o grub_probefs-fs_minix.o grub_probefs-fs_hfs.o grub_probefs-fs_jfs.o grub_probefs-kern_fs.o grub_probefs-kern_env.o grub_probefs-fs_fshelp.o grub_probefs-fs_xfs.o grub_probefs-fs_affs.o grub_probefs-fs_sfs.o grub_probefs-fs_hfsplus.o $(CC) -o $@ grub_probefs-util_i386_pc_grub_probefs.o grub_probefs-util_i386_pc_biosdisk.o grub_probefs-util_misc.o grub_probefs-util_i386_pc_getroot.o grub_probefs-kern_device.o grub_probefs-kern_disk.o grub_probefs-kern_err.o grub_probefs-kern_misc.o grub_probefs-fs_fat.o grub_probefs-fs_ext2.o grub_probefs-kern_parser.o grub_probefs-kern_partition.o grub_probefs-partmap_pc.o grub_probefs-fs_ufs.o grub_probefs-fs_minix.o grub_probefs-fs_hfs.o grub_probefs-fs_jfs.o grub_probefs-kern_fs.o grub_probefs-kern_env.o grub_probefs-fs_fshelp.o grub_probefs-fs_xfs.o grub_probefs-fs_affs.o grub_probefs-fs_sfs.o grub_probefs-fs_hfsplus.o $(LDFLAGS) $(grub_probefs_LDFLAGS) -grub_probefs-util_i386_pc_grub_probefs.o: util/i386/pc/grub-probefs.c +grub_probefs-util_i386_pc_grub_probefs.o: util/i386/pc/grub-probe.c $(CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_probefs_CFLAGS) -MD -c -o $@ $< -include grub_probefs-util_i386_pc_grub_probefs.d
Index: conf/i386-pc.rmk
===================================================================
RCS file: /sources/grub/grub2/conf/i386-pc.rmk,v
retrieving revision 1.69
i386-pc.rmk +3 -3
@@ -51,7 +51,7 @@ # 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 @@ # 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_probefs_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 \
Index: util/grub-emu.c
===================================================================
RCS file: /sources/grub/grub2/util/grub-emu.c,v
retrieving revision 1.30
grub-emu.c +1 -1
@@ -185,7 +185,7 @@/* 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'",
Index: util/i386/pc/getroot.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/getroot.c,v retrieving revision 1.5
i386/pc/getroot.c +1 -1
@@ -223,5 +223,5 @@if (! os_dev)return 0 ; -return grub_util_biosdisk_get_grub_dev (os_dev); +return os_dev; }
Index: util/i386/pc/grub-install.in
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-install.in,v retrieving revision 1.9
i386/pc/grub-install.in +4 -4
@@ -33,7 +33,7 @@ grub_setup=${sbindir}/grub-setup grub_mkimage=${bindir}/grub-mkimage grub_mkdevicemap=${sbindir}/grub-mkdevicemap -grub_probefs=${sbindir}/grub-probefs +grub_probefs=${sbindir}/grub-probe rootdir= grub_prefix=/boot/grub modules=
@@ -59,7 +59,7 @@ --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 @@ 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_probefs=`echo "$option" | sed 's/--grub-probe=//'` ;; --no-floppy) no_floppy="--no-floppy" ;; --recheck)
Index: util/i386/pc/grub-probefs.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-probefs.c,v retrieving revision 1.3
i386/pc/grub-probefs.c +46 -7
107 lines not on this page · raw message
Index: util/i386/pc/grub-setup.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-setup.c,v retrieving revision 1.18
i386/pc/grub-setup.c +1 -1
@@ -669,7 +669,7 @@ }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'",
Uhm actualy, I'll need this on non-i386 too. Can we enable grub-probe.c for all platforms? If the last part (about PC/BIOS translation) is i386-specific, perhaps it could be conditionalised so that non-i386 can use --target=(drive|device) ?
Signature · 4 lines
Robert Millan My spam trap is [email protected]. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list.
Quoted 5 lines · Robert Millan
Uhm actualy, I'll need this on non-i386 too. Can we enable
grub-probe.cfor all platforms? If the last part (about PC/BIOS translation) is i386-specific, perhaps it could be conditionalised so that non-i386 can use --target=(drive|device) ?
Looking at how grub-probefs depends on other pc/i386 stuff, perhaps it would make more sense to merge this first and then try writing a different grub-probe for the other arches.
Does my last patch look fine for commit?
Signature · 4 lines
Robert Millan My spam trap is [email protected]. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list.
grub 2 on debian amd64
Hi,
I set out to install grub 2 on a debian/amd64, win2k, xp machine just for fun, kinda like the jackass of computing. I don't see any simple way, has anyone put together an easy 2 step proc yet? Kew code btw, must be difficult to debug, good luck!
thanks!
Colin
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Re: grub 2 on debian amd64
Quoted 6 lines · Colin Lamarre
Hi,
I set out to install grub 2 on a debian/amd64, win2k, xp machine just for fun, kinda like the jackass of computing. I don't see any simple way, has anyone put together an easy 2 step proc yet? Kew code btw, must be difficult to debug, good luck!
Have you seen the wiki at http://grub.enbug.org ?
-Hollis
Re: grub 2 on debian amd64
In reply to Colin LamarreQuoted 6 lines · Colin Lamarre
Hi,
I set out to install grub 2 on a debian/amd64, win2k, xp machine just for fun, kinda like the jackass of computing. I don't see any simple way, has anyone put together an easy 2 step proc yet? Kew code btw, must be difficult to debug, good luck!
If you're using the debian package, grub-install "(hd0)" && update-grub -y should do.
Except it's broken now =), so wait for next upload or use CVS.
Signature · 4 lines
Robert Millan My spam trap is [email protected]. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list.
Hi,
Here are some comments about your patch. As requested :)
Quoted 6 lines · Robert Millan
2006-09-23 Robert Millan <[email protected]>
*
util/i386/pc/getroot.c(grub_guess_root_device): Stop usinggrub_util_biosdisk_get_grub_devto convert system device to GRUB device.
*util/grub-emu.c: Usegrub_util_biosdisk_get_grub_devwith the string returned bygrub_guess_root_device.
Method name missing from grub-emu.
Quoted 11 lines
*
util/i386/pc/grub-setup.c: Ditto.
*util/i386/pc/grub-probefs.c: Ditto.*
util/i386/pc/grub-probefs.c: Rename to ...
*util/i386/pc/grub-probe.c: ... this.
* DISTLIST: Update reference to grub-probefs.
*conf/i386-efi.mk: Ditto.
* conf/i386-efi.rmk: Ditto.
*conf/i386-pc.mk: Ditto.
* conf/i386-pc.rmk: Ditto.
* util/i386/pc/grub-install.in: Ditto.
Describe what changed in terms of source code not in terms of "english".
Eg. DISTLIST: Removed grub-probefs. Added grub-probe.
I am not sure is "ditto" a good term.. I have seen "Likewise." in other entries and used that myself too.
And no need to inform about changes to .mk as they are generated files. Just make sure on commit they are there.
Quoted 2 lines
*
util/i386/pc/grub-probe.c: Add --target=(fs|device|drive) option to choose which information we want to print.
Method...
Quoted 34 lines
Index: DISTLIST
===================================================================
RCS file: /sources/grub/grub2/DISTLIST,v
retrieving revision 1.36
diff -u -r1.36 DISTLISTDISTLIST +1
-1@@ -253,7 +253,7 @@ 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.inIndex: conf/i386-efi.rmk
===================================================================
RCS file: /sources/grub/grub2/conf/i386-efi.rmk,v
retrieving revision 1.9
diff -u -r1.9 i386-efi.rmki386-efi.rmk +1
-1@@ -6,7 +6,7 @@ # 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 \
i386-efi.rmk line 27
Quoted 7 lines
i386-efi.rmk +2
-2@@ -23,8 +23,8 @@ # 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_probefs_SOURCES = util/i386/pc/grub-probe.c \
Should be grub_probe_SOURCES.
Quoted 20 lines
i386-efi.rmk +0
-0# 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 \Index: conf/i386-pc.rmk
===================================================================
RCS file: /sources/grub/grub2/conf/i386-pc.rmk,v
retrieving revision 1.69
diff -u -r1.69 i386-pc.rmki386-pc.rmk +1
-1@@ -51,7 +51,7 @@ # 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 \
i386-pc.rmk line 73
Quoted 7 lines
i386-pc.rmk +2
-2@@ -69,8 +69,8 @@ # 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_probefs_SOURCES = util/i386/pc/grub-probe.c \
Same here.
Quoted 41 lines
i386-pc.rmk +0
-0util/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 \Index:
util/grub-emu.c
===================================================================
RCS file: /sources/grub/grub2/util/grub-emu.c,v
retrieving revision 1.30
diff -u -r1.30grub-emu.cgrub-emu.c +1
-1@@ -185,7 +185,7 @@/* 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'",Index:
util/i386/pc/getroot.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/getroot.c,v retrieving revision 1.5
diff -u -r1.5getroot.ci386/pc/getroot.c +1
-1@@ -223,5 +223,5 @@if (! os_dev)return 0 ; -return grub_util_biosdisk_get_grub_dev (os_dev); +return os_dev; }Index: util/i386/pc/grub-install.in
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-install.in,v retrieving revision 1.9
diff -u -r1.9 grub-install.in
i386/pc/grub-install.in line 36
Quoted 5 lines
i386/pc/grub-install.in +1
-1@@ -33,7 +33,7 @@ grub_setup=${sbindir}/grub-setup grub_mkimage=${bindir}/grub-mkimage grub_mkdevicemap=${sbindir}/grub-mkdevicemap -grub_probefs=${sbindir}/grub-probefs +grub_probefs=${sbindir}/grub-probe
Should be grub_probe as name changes... May need changes to other places too.
i386/pc/grub-install.in line 62
Quoted 9 lines
i386/pc/grub-install.in +1
-1rootdir= grub_prefix=/boot/grub modules=@@ -59,7 +59,7 @@ --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
At least here we are missing couple of spaces.
i386/pc/grub-install.in line 96
Quoted 11 lines
i386/pc/grub-install.in +2
-2--no-floppy do not probe any floppy drive --recheck probe a device map even if it already exists@@ -92,8 +92,8 @@ 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_probefs=`echo "$option" | sed 's/--grub-probe=//'` ;;
Needs change here at least...
Quoted 140 lines
i386/pc/grub-install.in +0
-0--no-floppy) no_floppy="--no-floppy" ;; --recheck)Index:
util/i386/pc/grub-probefs.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-probefs.c,v retrieving revision 1.3
diff -u -r1.3grub-probefs.ci386/pc/grub-probefs.c +46
-7@@ -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 @@ 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 @@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 @@ {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 @@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 @@ 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 ;Index:
util/i386/pc/grub-setup.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-setup.c,v retrieving revision 1.18
diff -u -r1.18grub-setup.ci386/pc/grub-setup.c +1
-1@@ -669,7 +669,7 @@ }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'",
Quoted 3 lines · Vesa Jääskeläinen
Hi,
Here are some comments about your patch. As requested :)
Thanks for the corrections. Some of them make me ashamed, I should have looked better at all those grub-probefs instances... ;)
Quoted 9 lines
Quoted 6 lines · Robert Millan
2006-09-23 Robert Millan <[email protected]>
*
util/i386/pc/getroot.c(grub_guess_root_device): Stop usinggrub_util_biosdisk_get_grub_devto convert system device to GRUB device.
*util/grub-emu.c: Usegrub_util_biosdisk_get_grub_devwith the string returned bygrub_guess_root_device.Method name missing from grub-emu.
Ok (main).
Quoted 12 lines
Quoted 11 lines
*
util/i386/pc/grub-setup.c: Ditto.
*util/i386/pc/grub-probefs.c: Ditto.*
util/i386/pc/grub-probefs.c: Rename to ...
*util/i386/pc/grub-probe.c: ... this.
* DISTLIST: Update reference to grub-probefs.
*conf/i386-efi.mk: Ditto.
* conf/i386-efi.rmk: Ditto.
*conf/i386-pc.mk: Ditto.
* conf/i386-pc.rmk: Ditto.
* util/i386/pc/grub-install.in: Ditto.
Quoted 8 lines
Describe what changed in terms of source code not in terms of "english".
Eg. DISTLIST: Removed grub-probefs. Added grub-probe.I am not sure is "ditto" a good term.. I have seen "Likewise." in other entries and used that myself too.
And no need to inform about changes to .mk as they are generated files. Just make sure on commit they are there.
Ok. I'm also omitting .mk files from my patch. I'll take care of regenerating later.
Quoted 4 lines
Quoted 2 lines
*
util/i386/pc/grub-probe.c: Add --target=(fs|device|drive) option to choose which information we want to print.Method...
This change applies in various places of the file (main, probe, options..)
Quoted 2 lines
Should be
grub_probeas name changes... May need changes to other places too.
Checked them all this time.
Quoted 13 lines
Review line 96
Quoted 11 lines
--no-floppy do not probe any floppy drive
--recheck probe a device map even if it already exists(quoted diff) +2
-2@@ -92,8 +92,8 @@ 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_probefs=`echo "$option" | sed 's/--grub-probe=//'` ;;Needs change here at least...
Done. Also added an explicit --target=fs option in grub-install (better be safe).
Please let me know if it's ok now:
2006-09-28 Robert Millan <[email protected]>
* 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.
Signature · 4 lines
Robert Millan My spam trap is [email protected]. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list.
2006-09-28 Robert Millan <[email protected]>
* 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.
Index: DISTLIST
===================================================================
RCS file: /sources/grub/grub2/DISTLIST,v
retrieving revision 1.36
DISTLIST +1 -1
@@ -253,7 +253,7 @@ 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
Index: conf/i386-efi.rmk
===================================================================
RCS file: /sources/grub/grub2/conf/i386-efi.rmk,v
retrieving revision 1.10
i386-efi.rmk +3 -3
@@ -6,7 +6,7 @@ # 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 @@ # 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 \
Index: conf/i386-pc.rmk
===================================================================
RCS file: /sources/grub/grub2/conf/i386-pc.rmk,v
retrieving revision 1.70
i386-pc.rmk +3 -3
@@ -51,7 +51,7 @@ # 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 @@ # 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 \
Index: util/grub-emu.c
===================================================================
RCS file: /sources/grub/grub2/util/grub-emu.c,v
retrieving revision 1.30
grub-emu.c +1 -1
@@ -185,7 +185,7 @@/* 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'",
Index: util/i386/pc/getroot.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/getroot.c,v retrieving revision 1.5
i386/pc/getroot.c +1 -1
@@ -223,5 +223,5 @@if (! os_dev)return 0 ; -return grub_util_biosdisk_get_grub_dev (os_dev); +return os_dev; }
Index: util/i386/pc/grub-install.in
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-install.in,v retrieving revision 1.9
i386/pc/grub-install.in +5 -5
@@ -33,7 +33,7 @@ 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 @@ --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 @@ 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 @@ 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
Index: util/i386/pc/grub-probefs.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-probefs.c,v retrieving revision 1.3
i386/pc/grub-probefs.c +46 -7
107 lines not on this page · raw message
Index: util/i386/pc/grub-setup.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-setup.c,v retrieving revision 1.18
i386/pc/grub-setup.c +1 -1
@@ -669,7 +669,7 @@ }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'",
Is it alright for commit now?
Quoted 407 lines · Robert Millan
Quoted 3 lines · Vesa Jääskeläinen
Hi,
Here are some comments about your patch. As requested :)
Thanks for the corrections. Some of them make me ashamed, I should have looked better at all those grub-probefs instances... ;)
Quoted 9 lines
Quoted 6 lines · Robert Millan
2006-09-23 Robert Millan <[email protected]>
*
util/i386/pc/getroot.c(grub_guess_root_device): Stop usinggrub_util_biosdisk_get_grub_devto convert system device to GRUB device.
*util/grub-emu.c: Usegrub_util_biosdisk_get_grub_devwith the string returned bygrub_guess_root_device.Method name missing from grub-emu.
Ok (main).
Quoted 12 lines
Quoted 11 lines
*
util/i386/pc/grub-setup.c: Ditto.
*util/i386/pc/grub-probefs.c: Ditto.*
util/i386/pc/grub-probefs.c: Rename to ...
*util/i386/pc/grub-probe.c: ... this.
* DISTLIST: Update reference to grub-probefs.
*conf/i386-efi.mk: Ditto.
* conf/i386-efi.rmk: Ditto.
*conf/i386-pc.mk: Ditto.
* conf/i386-pc.rmk: Ditto.
* util/i386/pc/grub-install.in: Ditto.Quoted 8 lines
Describe what changed in terms of source code not in terms of "english".
Eg. DISTLIST: Removed grub-probefs. Added grub-probe.I am not sure is "ditto" a good term.. I have seen "Likewise." in other entries and used that myself too.
And no need to inform about changes to .mk as they are generated files. Just make sure on commit they are there.
Ok. I'm also omitting .mk files from my patch. I'll take care of regenerating later.
Quoted 4 lines
Quoted 2 lines
*
util/i386/pc/grub-probe.c: Add --target=(fs|device|drive) option to choose which information we want to print.Method...
This change applies in various places of the file (main, probe, options..)
Quoted 2 lines
Should be
grub_probeas name changes... May need changes to other places too.Checked them all this time.
Quoted 13 lines
i386/pc/grub-install.in line 96
Quoted 11 lines
--no-floppy do not probe any floppy drive
--recheck probe a device map even if it already existsi386/pc/grub-install.in +2
-2@@ -92,8 +92,8 @@ 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_probefs=`echo "$option" | sed 's/--grub-probe=//'` ;;Needs change here at least...
Done. Also added an explicit --target=fs option in grub-install (better be safe).
Please let me know if it's ok now:
2006-09-28 Robert Millan <[email protected]>
*
util/i386/pc/getroot.c(grub_guess_root_device): Stop usinggrub_util_biosdisk_get_grub_devto convert system device to GRUB device.
*util/grub-emu.c(main): Usegrub_util_biosdisk_get_grub_devwith the string returned bygrub_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.Signature · 30 lines
Robert Millan My spam trap is [email protected]. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list. 2006-09-28 Robert Millan <[email protected]> * 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. Index: DISTLIST =================================================================== RCS file: /sources/grub/grub2/DISTLIST,v retrieving revision 1.36 diff -u -r1.36 DISTLISTDISTLIST +1
-1@@ -253,7 +253,7 @@ 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.inIndex: conf/i386-efi.rmk
===================================================================
RCS file: /sources/grub/grub2/conf/i386-efi.rmk,v
retrieving revision 1.10
diff -u -r1.10 i386-efi.rmki386-efi.rmk +3
-3@@ -6,7 +6,7 @@ # 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 @@ # 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 \Index: conf/i386-pc.rmk
===================================================================
RCS file: /sources/grub/grub2/conf/i386-pc.rmk,v
retrieving revision 1.70
diff -u -r1.70 i386-pc.rmki386-pc.rmk +3
-3@@ -51,7 +51,7 @@ # 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 @@ # 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 \Index:
util/grub-emu.c
===================================================================
RCS file: /sources/grub/grub2/util/grub-emu.c,v
retrieving revision 1.30
diff -u -r1.30grub-emu.cgrub-emu.c +1
-1@@ -185,7 +185,7 @@/* 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'",Index:
util/i386/pc/getroot.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/getroot.c,v retrieving revision 1.5
diff -u -r1.5getroot.ci386/pc/getroot.c +1
-1@@ -223,5 +223,5 @@if (! os_dev)return 0 ; -return grub_util_biosdisk_get_grub_dev (os_dev); +return os_dev; }Index: util/i386/pc/grub-install.in
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-install.in,v retrieving revision 1.9
diff -u -r1.9 grub-install.ini386/pc/grub-install.in +5
-5@@ -33,7 +33,7 @@ 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 @@ --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 @@ 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 @@ 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>&2Index:
util/i386/pc/grub-probefs.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-probefs.c,v retrieving revision 1.3
diff -u -r1.3grub-probefs.ci386/pc/grub-probefs.c +46
-7@@ -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 @@ 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 @@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 @@ {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 @@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 @@ 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 ;Index:
util/i386/pc/grub-setup.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-setup.c,v retrieving revision 1.18
diff -u -r1.18grub-setup.ci386/pc/grub-setup.c +1
-1@@ -669,7 +669,7 @@ }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'",_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 4 lines
Robert Millan My spam trap is [email protected]. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list.
ping (Re: [PATCH] grub-probefs --root-device)
Ping :)
Quoted 425 lines · Robert Millan
Is it alright for commit now?
Quoted 407 lines · Robert Millan
Quoted 3 lines · Vesa Jääskeläinen
Hi,
Here are some comments about your patch. As requested :)
Thanks for the corrections. Some of them make me ashamed, I should have looked better at all those grub-probefs instances... ;)
Quoted 9 lines
Quoted 6 lines · Robert Millan
2006-09-23 Robert Millan <[email protected]>
*
util/i386/pc/getroot.c(grub_guess_root_device): Stop usinggrub_util_biosdisk_get_grub_devto convert system device to GRUB device.
*util/grub-emu.c: Usegrub_util_biosdisk_get_grub_devwith the string returned bygrub_guess_root_device.Method name missing from grub-emu.
Ok (main).
Quoted 12 lines
Quoted 11 lines
*
util/i386/pc/grub-setup.c: Ditto.
*util/i386/pc/grub-probefs.c: Ditto.*
util/i386/pc/grub-probefs.c: Rename to ...
*util/i386/pc/grub-probe.c: ... this.
* DISTLIST: Update reference to grub-probefs.
*conf/i386-efi.mk: Ditto.
* conf/i386-efi.rmk: Ditto.
*conf/i386-pc.mk: Ditto.
* conf/i386-pc.rmk: Ditto.
* util/i386/pc/grub-install.in: Ditto.Quoted 8 lines
Describe what changed in terms of source code not in terms of "english".
Eg. DISTLIST: Removed grub-probefs. Added grub-probe.I am not sure is "ditto" a good term.. I have seen "Likewise." in other entries and used that myself too.
And no need to inform about changes to .mk as they are generated files. Just make sure on commit they are there.
Ok. I'm also omitting .mk files from my patch. I'll take care of regenerating later.
Quoted 4 lines
Quoted 2 lines
*
util/i386/pc/grub-probe.c: Add --target=(fs|device|drive) option to choose which information we want to print.Method...
This change applies in various places of the file (main, probe, options..)
Quoted 2 lines
Should be
grub_probeas name changes... May need changes to other places too.Checked them all this time.
Quoted 13 lines
i386/pc/grub-install.in line 96
Quoted 11 lines
--no-floppy do not probe any floppy drive
--recheck probe a device map even if it already existsi386/pc/grub-install.in +2
-2@@ -92,8 +92,8 @@ 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_probefs=`echo "$option" | sed 's/--grub-probe=//'` ;;Needs change here at least...
Done. Also added an explicit --target=fs option in grub-install (better be safe).
Please let me know if it's ok now:
2006-09-28 Robert Millan <[email protected]>
*
util/i386/pc/getroot.c(grub_guess_root_device): Stop usinggrub_util_biosdisk_get_grub_devto convert system device to GRUB device.
*util/grub-emu.c(main): Usegrub_util_biosdisk_get_grub_devwith the string returned bygrub_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.Signature · 30 lines
Robert Millan My spam trap is [email protected]. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list. 2006-09-28 Robert Millan <[email protected]> * 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. Index: DISTLIST =================================================================== RCS file: /sources/grub/grub2/DISTLIST,v retrieving revision 1.36 diff -u -r1.36 DISTLISTDISTLIST +1
-1@@ -253,7 +253,7 @@ 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.inIndex: conf/i386-efi.rmk
===================================================================
RCS file: /sources/grub/grub2/conf/i386-efi.rmk,v
retrieving revision 1.10
diff -u -r1.10 i386-efi.rmki386-efi.rmk +3
-3@@ -6,7 +6,7 @@ # 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 @@ # 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 \Index: conf/i386-pc.rmk
===================================================================
RCS file: /sources/grub/grub2/conf/i386-pc.rmk,v
retrieving revision 1.70
diff -u -r1.70 i386-pc.rmki386-pc.rmk +3
-3@@ -51,7 +51,7 @@ # 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 @@ # 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 \Index:
util/grub-emu.c
===================================================================
RCS file: /sources/grub/grub2/util/grub-emu.c,v
retrieving revision 1.30
diff -u -r1.30grub-emu.cgrub-emu.c +1
-1@@ -185,7 +185,7 @@/* 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'",Index:
util/i386/pc/getroot.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/getroot.c,v retrieving revision 1.5
diff -u -r1.5getroot.ci386/pc/getroot.c +1
-1@@ -223,5 +223,5 @@if (! os_dev)return 0 ; -return grub_util_biosdisk_get_grub_dev (os_dev); +return os_dev; }Index: util/i386/pc/grub-install.in
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-install.in,v retrieving revision 1.9
diff -u -r1.9 grub-install.ini386/pc/grub-install.in +5
-5@@ -33,7 +33,7 @@ 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 @@ --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 @@ 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 @@ 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>&2Index:
util/i386/pc/grub-probefs.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-probefs.c,v retrieving revision 1.3
diff -u -r1.3grub-probefs.ci386/pc/grub-probefs.c +46
-7@@ -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 @@ 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 @@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 @@ {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 @@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 @@ 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 ;Index:
util/i386/pc/grub-setup.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-setup.c,v retrieving revision 1.18
diff -u -r1.18grub-setup.ci386/pc/grub-setup.c +1
-1@@ -669,7 +669,7 @@ }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'",_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-develSignature · 10 lines
Robert Millan My spam trap is [email protected]. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list. _______________________________________________ Grub-devel mailing list [email protected] http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 4 lines
Robert Millan My spam trap is [email protected]. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list.
Re: ping (Re: [PATCH] grub-probefs --root-device)
Quoted 1 line · Robert Millan
Ping :)
Thank you for prompting me. ;)
Please check it in. I have no objection.
Okuji
Re: ping (Re: [PATCH] grub-probefs --root-device)
Quoted 6 lines · Yoshinori K. Okuji
Quoted 1 line · Robert Millan
Ping :)
Thank you for prompting me. ;)
Please check it in. I have no objection.
Committed, thanks!
Signature · 4 lines
Robert Millan My spam trap is [email protected]. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list.
Re: ping (Re: [PATCH] grub-probefs --root-device)
Quoted 2 lines · Robert Millan
Committed, thanks!
Btw, for --target=device and --target=drive, the new grub-probe command should also be usable on non-i386. I think we just need to disable some code. Any powerpc user wants to give that a try?
Signature · 4 lines
Robert Millan My spam trap is [email protected]. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list.