All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] grub-install --debug-image option
@ 2010-06-26 10:05 Colin Watson
  2010-06-28  7:54 ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 1 reply; 2+ messages in thread
From: Colin Watson @ 2010-06-26 10:05 UTC (permalink / raw)
  To: grub-devel

When debugging problems that make GRUB unable to load
/boot/grub/grub.cfg, I often find myself telling people to edit
grub-install to put 'set debug=all' in an embedded configuration file.
I'd like this not to involve editing the grub-install script, and to
just be a simple option.  Does this patch look OK?  It makes it possible
to do --debug-image=all (say).

Like --debug, I've left it undocumented for the moment since it will
spew vast quantities of output that probably require a developer to
interpret them anyway.  (I don't feel strongly about this; if we
document --debug-image, then we should document the existing --debug
too.)

2010-06-26  Colin Watson  <cjwatson@ubuntu.com>

	* util/grub-install.in: Add --debug-image= option.

=== modified file 'util/grub-install.in'
--- util/grub-install.in	2010-06-13 00:36:39 +0000
+++ util/grub-install.in	2010-06-26 10:00:33 +0000
@@ -50,6 +50,7 @@ no_floppy=
 force_lba=
 recheck=no
 debug=no
+debug_image=
 
 if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
     disk_module=biosdisk
@@ -180,6 +181,11 @@ do
     # This is an undocumented feature...
     --debug)
 	debug=yes ;;
+    --debug-image)
+	debug_image=`argument $option "$@"`; shift;;
+    --debug-image=*)
+	debug_image=`echo "$option" | sed 's/--debug-image=//'` ;;
+
     -f | --force)
         setup_force="--force" ;;
 
@@ -349,6 +355,13 @@ fi
 prefix_drive=
 config_opt=
 
+rm -f ${grubdir}/load.cfg
+
+if [ "x${debug_image}" != x ]; then
+    echo "set debug='${debug_image}'" >> ${grubdir}/load.cfg
+    config_opt="-c ${grubdir}/load.cfg "
+fi
+
 if [ "x${devabstraction_module}" = "x" ] ; then
     if [ x"${install_device}" != x ]; then
       if echo "${install_device}" | grep -qx "(.*)" ; then
@@ -369,7 +382,7 @@ if [ "x${devabstraction_module}" = "x" ]
           echo "UUID needed with ata mod, but the filesystem containing ${grubdir} does not support UUIDs." 1>&2
           exit 1
         fi
-        echo "search.fs_uuid ${uuid} root " > ${grubdir}/load.cfg
+        echo "search.fs_uuid ${uuid} root " >> ${grubdir}/load.cfg
 	echo 'set prefix=($root)'"${relative_grubdir}" >> ${grubdir}/load.cfg
 	config_opt="-c ${grubdir}/load.cfg "
         modules="$modules search_fs_uuid"
@@ -379,7 +392,7 @@ if [ "x${devabstraction_module}" = "x" ]
           echo "You attempted a cross-disk install, but the filesystem containing ${grubdir} does not support UUIDs." 1>&2
           exit 1
         fi
-        echo "search.fs_uuid ${uuid} root " > ${grubdir}/load.cfg
+        echo "search.fs_uuid ${uuid} root " >> ${grubdir}/load.cfg
 	echo 'set prefix=($root)'"${relative_grubdir}" >> ${grubdir}/load.cfg
 	config_opt="-c ${grubdir}/load.cfg "
         modules="$modules search_fs_uuid"

Thanks,

-- 
Colin Watson                                       [cjwatson@ubuntu.com]


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] grub-install --debug-image option
  2010-06-26 10:05 [PATCH] grub-install --debug-image option Colin Watson
@ 2010-06-28  7:54 ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 0 replies; 2+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2010-06-28  7:54 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 3087 bytes --]

On 06/26/2010 12:05 PM, Colin Watson wrote:
> When debugging problems that make GRUB unable to load
> /boot/grub/grub.cfg, I often find myself telling people to edit
> grub-install to put 'set debug=all' in an embedded configuration file.
> I'd like this not to involve editing the grub-install script, and to
> just be a simple option.  Does this patch look OK?  It makes it possible
> to do --debug-image=all (say).
>
> Like --debug, I've left it undocumented for the moment since it will
> spew vast quantities of output that probably require a developer to
> interpret them anyway.  (I don't feel strongly about this; if we
> document --debug-image, then we should document the existing --debug
> too.)
>
> 2010-06-26  Colin Watson  <cjwatson@ubuntu.com>
>
> 	* util/grub-install.in: Add --debug-image= option.
>
>   
Go ahead
> === modified file 'util/grub-install.in'
> --- util/grub-install.in	2010-06-13 00:36:39 +0000
> +++ util/grub-install.in	2010-06-26 10:00:33 +0000
> @@ -50,6 +50,7 @@ no_floppy=
>  force_lba=
>  recheck=no
>  debug=no
> +debug_image=
>  
>  if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
>      disk_module=biosdisk
> @@ -180,6 +181,11 @@ do
>      # This is an undocumented feature...
>      --debug)
>  	debug=yes ;;
> +    --debug-image)
> +	debug_image=`argument $option "$@"`; shift;;
> +    --debug-image=*)
> +	debug_image=`echo "$option" | sed 's/--debug-image=//'` ;;
> +
>      -f | --force)
>          setup_force="--force" ;;
>  
> @@ -349,6 +355,13 @@ fi
>  prefix_drive=
>  config_opt=
>  
> +rm -f ${grubdir}/load.cfg
> +
> +if [ "x${debug_image}" != x ]; then
> +    echo "set debug='${debug_image}'" >> ${grubdir}/load.cfg
> +    config_opt="-c ${grubdir}/load.cfg "
> +fi
> +
>  if [ "x${devabstraction_module}" = "x" ] ; then
>      if [ x"${install_device}" != x ]; then
>        if echo "${install_device}" | grep -qx "(.*)" ; then
> @@ -369,7 +382,7 @@ if [ "x${devabstraction_module}" = "x" ]
>            echo "UUID needed with ata mod, but the filesystem containing ${grubdir} does not support UUIDs." 1>&2
>            exit 1
>          fi
> -        echo "search.fs_uuid ${uuid} root " > ${grubdir}/load.cfg
> +        echo "search.fs_uuid ${uuid} root " >> ${grubdir}/load.cfg
>  	echo 'set prefix=($root)'"${relative_grubdir}" >> ${grubdir}/load.cfg
>  	config_opt="-c ${grubdir}/load.cfg "
>          modules="$modules search_fs_uuid"
> @@ -379,7 +392,7 @@ if [ "x${devabstraction_module}" = "x" ]
>            echo "You attempted a cross-disk install, but the filesystem containing ${grubdir} does not support UUIDs." 1>&2
>            exit 1
>          fi
> -        echo "search.fs_uuid ${uuid} root " > ${grubdir}/load.cfg
> +        echo "search.fs_uuid ${uuid} root " >> ${grubdir}/load.cfg
>  	echo 'set prefix=($root)'"${relative_grubdir}" >> ${grubdir}/load.cfg
>  	config_opt="-c ${grubdir}/load.cfg "
>          modules="$modules search_fs_uuid"
>
> Thanks,
>
>   


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-06-28  7:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-26 10:05 [PATCH] grub-install --debug-image option Colin Watson
2010-06-28  7:54 ` Vladimir 'φ-coder/phcoder' Serbinenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.