Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1OeVAB-0007pa-L3 for mharc-grub-devel@gnu.org; Thu, 29 Jul 2010 11:36:51 -0400 Received: from [140.186.70.92] (port=36826 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OeVA6-0007no-Bu for grub-devel@gnu.org; Thu, 29 Jul 2010 11:36:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OeVA1-0000bv-Tn for grub-devel@gnu.org; Thu, 29 Jul 2010 11:36:45 -0400 Received: from caffeine.csclub.uwaterloo.ca ([129.97.134.17]:41242) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OeVA1-0000bo-MO for grub-devel@gnu.org; Thu, 29 Jul 2010 11:36:41 -0400 Received: from caffeine.csclub.uwaterloo.ca (localhost [127.0.0.1]) by caffeine.csclub.uwaterloo.ca (Postfix) with ESMTP id 2212DD06F; Thu, 29 Jul 2010 11:36:41 -0400 (EDT) Received: by caffeine.csclub.uwaterloo.ca (Postfix, from userid 20367) id 12F47D182; Thu, 29 Jul 2010 11:36:41 -0400 (EDT) Date: Thu, 29 Jul 2010 11:36:41 -0400 To: Doug Nazar Message-ID: <20100729153641.GO2632@caffeine.csclub.uwaterloo.ca> References: <4C511DF0.3080306@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4C511DF0.3080306@gmail.com> User-Agent: Mutt/1.5.18 (2008-05-17) From: lsorense@csclub.uwaterloo.ca (Lennart Sorensen) X-Virus-Scanned: ClamAV using ClamSMTP X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: grub-devel@gnu.org, Lennart Sorensen Subject: Re: Fallback to scanning OF tree if no devaliases 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: Thu, 29 Jul 2010 15:36:49 -0000 On Thu, Jul 29, 2010 at 02:21:36AM -0400, Doug Nazar wrote: > Lennart, try giving this patch a whirl. In the case after we scan the > aliases list and we haven't found any block devices it will now try to > scan the entire tree. It kinda worked under OpenBios although I ran into > another bug where it can't open a device path that it gave me for the > pci ide controller. It found the other 2 drives fine. > > I think this maintains the correct balance of using short pretty names > if available but working if they are not available. > > There is a case where it will mess up however. If you only specify an > alias for one device but need another device to build a raid or lvm it > will fail. Although, thinking about it, this already would happen. > > As always, you can specify the either path manually. > > Doug > > === modified file 'disk/ieee1275/ofdisk.c' > --- disk/ieee1275/ofdisk.c 2010-07-29 03:58:16 +0000 > +++ disk/ieee1275/ofdisk.c 2010-07-29 06:02:06 +0000 > @@ -76,6 +76,9 @@ > grub_ofdisk_iterate (int (*hook) (const char *name)) > { > auto int dev_iterate (struct grub_ieee1275_devalias *alias); > + int disks_found = 0; > + int use_path = 0; > + int result; > > int dev_iterate (struct grub_ieee1275_devalias *alias) > { > @@ -110,11 +113,20 @@ > > if (! grub_strcmp (alias->type, "block") && > grub_strncmp (alias->name, "cdrom", 5)) > - ret = hook (alias->name); > + { > + disks_found++; > + ret = hook (use_path ? alias->path : alias->name); > + } > return ret; > } > > - return grub_devalias_iterate (dev_iterate); > + result = grub_devalias_iterate (dev_iterate); > + if (!disks_found) > + { > + use_path = 1; > + result = grub_ieee1275_devices_iterate (dev_iterate); > + } > + return result; > } > > static char * > I removed the nvalias's and got: 0 > boot /pci@800000020000200/pci1014,02BD@1/sas/disk@20000 | Elapsed time since release of system processors: 7 mins 55 secs Welcome to GRUB! Detected bad memory access to address: 727461736261739d Package path = /packages/gscsi/disk Loc-code = Return Stack Trace ------------------ @ - c3e530 find-method - c48b9c (poplocals) - c3c9e8 $call-method - c48c54 (poplocals) - c3c9e8 $CALL-R/W-DEV - d54a70 (EXEC) - d54d24 EXECUTE-COMMAND - d54db4 RETRY-COMMAND - d55ca4 INQUIRY - d55fd0 SCSI-DEVICE-TYPE - d5672c catch - c3aff0 $call-method - c48c78 (poplocals) - c3c9e8 $call-parent - c48e98 SCSI-DEVICE-TYPE - d56df4 OPEN - d58200 catch - c3aff0 $call-method - c48c78 (poplocals) - c3c9e8 Detected bad memory access to address: 727461736261739d Package path = /packages/gscsi/disk Loc-code = Return Stack Trace ------------------ @ - c3e530 find-method - c48b9c (poplocals) - c3c9e8 $call-method - c48c54 (poplocals) - c3c9e8 $CALL-R/W-DEV - d54a70 (EXEC) - d54d24 EXECUTE-COMMAND - d54db4 RETRY-COMMAND - d55ca4 INQUIRY - d55fd0 SCSI-DEVICE-TYPE - d5672c catch - c3aff0 $call-method - c48c78 (poplocals) - c3c9e8 $call-parent - c48e98 SCSI-DEVICE-TYPE - d56df4 OPEN - d58200 catch - c3aff0 $call-method - c48c78 (poplocals) - c3c9e8 diskOPEN: can't find hw device diskOPEN: can't find hw device error: no such disk. Entering rescue mode... grub rescue> Any idea what went wrong? -- Len Sorensen