Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1OSSGB-0000MX-NP for mharc-grub-devel@gnu.org; Sat, 26 Jun 2010 06:05:15 -0400 Received: from [140.186.70.92] (port=60107 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OSSG6-0000L5-7a for grub-devel@gnu.org; Sat, 26 Jun 2010 06:05:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OSSG4-0001oc-8N for grub-devel@gnu.org; Sat, 26 Jun 2010 06:05:09 -0400 Received: from smarthost03.mail.zen.net.uk ([212.23.3.142]:41820) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OSSG4-0001oJ-14 for grub-devel@gnu.org; Sat, 26 Jun 2010 06:05:08 -0400 Received: from [82.69.40.219] (helo=riva.pelham.vpn.ucam.org) by smarthost03.mail.zen.net.uk with esmtp (Exim 4.63) (envelope-from ) id 1OSSG2-00045q-2e for grub-devel@gnu.org; Sat, 26 Jun 2010 10:05:06 +0000 Received: from cjwatson by riva.pelham.vpn.ucam.org with local (Exim 3.36 #1 (Debian)) for grub-devel@gnu.org id 1OSSG1-0006oP-00; Sat, 26 Jun 2010 11:05:05 +0100 Date: Sat, 26 Jun 2010 11:05:05 +0100 From: Colin Watson To: grub-devel@gnu.org Message-ID: <20100626100504.GT21862@riva.ucam.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-Originating-Smarthost03-IP: [82.69.40.219] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: [PATCH] grub-install --debug-image option X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Jun 2010 10:05:13 -0000 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 * 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]