Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1D0OqU-0005VI-H3 for mharc-grub-devel@gnu.org; Sun, 13 Feb 2005 13:51:51 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1D0OqP-0005TP-Ft for grub-devel@gnu.org; Sun, 13 Feb 2005 13:51:45 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1D0OqI-0005Q5-La for grub-devel@gnu.org; Sun, 13 Feb 2005 13:51:39 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D0OqI-0005PA-Bu for grub-devel@gnu.org; Sun, 13 Feb 2005 13:51:38 -0500 Received: from [145.74.66.11] (helo=mail-cn.han.nl) by monty-python.gnu.org with esmtp (Exim 4.34) id 1D0Oau-0008OR-KN for grub-devel@gnu.org; Sun, 13 Feb 2005 13:35:45 -0500 Received: from vscan-cn.han.nl (venus.han.nl [145.74.65.6]) by mail-cn.han.nl (Postfix) with ESMTP id 2177C8E77 for ; Sun, 13 Feb 2005 19:35:44 +0100 (CET) Received: from mail-cn.han.nl ([145.74.66.11]) by vscan-cn.han.nl (venus.han.nl [145.74.65.6]) (amavisd-new, port 10024) with ESMTP id 04637-05 for ; Sun, 13 Feb 2005 19:35:42 +0100 (CET) Received: from mail1.han.nl (mail1.han.nl [145.74.103.11]) by mail-cn.han.nl (Postfix) with ESMTP id E54398D21 for ; Sun, 13 Feb 2005 19:35:41 +0100 (CET) Received: from marco.marco-g.com (mgerards.xs4all.nl [82.92.27.129]) by mail1.han.nl (Postfix) with ESMTP id A316CC048 for ; Sun, 13 Feb 2005 19:35:41 +0100 (CET) Mail-Copies-To: metgerards@student.han.nl To: The development of GRUB 2 References: <20050213165452.GA4503@miracle> From: Marco Gerards Date: Sun, 13 Feb 2005 18:35:54 +0000 In-Reply-To: <20050213165452.GA4503@miracle> (Hollis Blanchard's message of "Sun, 13 Feb 2005 10:54:52 -0600") Message-ID: <87mzu8tiid.fsf@marco.marco-g.com> User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new (2.2.0) at vscan-cn.han.nl Subject: Re: [patch] set prefix on PPC X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Feb 2005 18:51:48 -0000 Hollis Blanchard writes: Hi, > This code sets the GRUB "prefix" environment variable from the OF > /chosen/bootpath property. It must therefore translate between the two > syntaxes. Personally I don't like setting prefix to the path grubof was loaded from. Mainly because of the way how things work on the macintosh. It has a special HFS[+] boot partition (at least my installation, but I think this is the common practice). I don't like installing all modules and the configuration file on this partition. There were some problems with writing to this partition IIRC and it is not comfortable to use. It should not be touched by a user, I just can't remember why. I will look that up. What I would prefer is a way to encode the prefix into the grubof binary. The only disadvantage is that it might be hard to detect this install time. What I would prefer is this: 1) Set prefix to whatever was set in the binary. 2) If nothing was set, use `bootpath'. 3) Read the arguments and if a prefix was passed to GRUB, use it to override the prefix. For #3 I wrote a patch, but I forgot to send it to grub-devel... It's included with this email. As far as I am concerned #1 is what is really important for us. Perhaps I might be confused by what I read last year and it is not really an issue. I just want to get things right. Thanks, Marco 2005-02-13 Marco Gerards * kern/powerpc/ieee1275/init.c (grub_machine_init): Initialize the prefix env variable with the bootargs when it has a valid value. * loader/powerpc/ieee1275/linux.c (grub_rescue_cmd_linux): Don't initialize `init_addr' yet, set it to 0 instead. Index: kern/powerpc/ieee1275/init.c =================================================================== RCS file: /cvsroot/grub/grub2/kern/powerpc/ieee1275/init.c,v retrieving revision 1.13 diff -u -p -r1.13 init.c --- kern/powerpc/ieee1275/init.c 4 Jan 2005 14:01:45 -0000 1.13 +++ kern/powerpc/ieee1275/init.c 11 Feb 2005 22:41:15 -0000 @@ -48,6 +48,8 @@ grub_machine_init (void) extern char _start; grub_addr_t heap_start; grub_addr_t heap_len; + grub_ieee1275_phandle_t chosen; + grub_size_t proplen; grub_console_init (); @@ -67,6 +69,20 @@ grub_machine_init (void) grub_env_set ("prefix", ""); + /* Try to override the prefix using the argument passed to GRUB. */ + grub_ieee1275_finddevice ("/chosen", &chosen); + grub_ieee1275_get_property_length (chosen, "bootargs", &proplen); + { + char args[proplen]; + grub_size_t actual; + + grub_ieee1275_get_property (chosen, "bootargs", args, proplen, &actual); + + /* If the argument is a valid path, use it. */ + if (actual > 0 && args[0] == '(' && grub_strchr (args, ')')) + grub_env_set ("prefix", args); + } + grub_ofdisk_init (); } Index: loader/powerpc/ieee1275/linux.c =================================================================== RCS file: /cvsroot/grub/grub2/loader/powerpc/ieee1275/linux.c,v retrieving revision 1.5 diff -u -p -r1.5 linux.c --- loader/powerpc/ieee1275/linux.c 31 Jan 2005 21:44:35 -0000 1.5 +++ loader/powerpc/ieee1275/linux.c 11 Feb 2005 22:41:15 -0000 @@ -258,7 +258,7 @@ grub_rescue_cmd_linux (int argc, char *a else { grub_loader_set (grub_linux_boot, grub_linux_unload); - initrd_addr = 0xc0000000; + initrd_addr = 0; loaded = 1; }