From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1HwK0r-0007sb-FM for mharc-grub-devel@gnu.org; Thu, 07 Jun 2007 11:35:01 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HwK0p-0007s0-Ri for grub-devel@gnu.org; Thu, 07 Jun 2007 11:34:59 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HwK0o-0007ri-Hi for grub-devel@gnu.org; Thu, 07 Jun 2007 11:34:59 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HwK0o-0007re-BF for grub-devel@gnu.org; Thu, 07 Jun 2007 11:34:58 -0400 Received: from 245.red-80-24-127.staticip.rima-tde.net ([80.24.127.245] helo=manazas.ensanjose.net) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HwK0n-0003c8-Fu for grub-devel@gnu.org; Thu, 07 Jun 2007 11:34:58 -0400 Received: from localhost (manazas.ensanjose.net [127.0.0.1]) by manazas.ensanjose.net (Postfix) with ESMTP id D6E6BD444E for ; Thu, 7 Jun 2007 17:34:55 +0200 (CEST) Received: from manazas.ensanjose.net ([127.0.0.1]) by localhost (manazas.ensanjose.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 29890-10 for ; Thu, 7 Jun 2007 17:34:55 +0200 (CEST) Received: from [192.168.1.8] (162.Red-88-6-150.staticIP.rima-tde.net [88.6.150.162]) by manazas.ensanjose.net (Postfix) with ESMTP id 7C42FD444D for ; Thu, 7 Jun 2007 17:34:55 +0200 (CEST) Message-ID: <4668259D.9090701@raulete.net> Date: Thu, 07 Jun 2007 17:34:53 +0200 From: adrian15 User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: The development of GRUB 2 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-detected-kernel: Linux 2.4-2.6 Subject: map command for grub2 draft 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: Thu, 07 Jun 2007 15:35:00 -0000 I want to implement the map command for grub2 as long as it is an interesting thing for stupid windows oses and because it's the clue for making an "usbshift" equivalent command (See Super Grub Disk usbshift command for more details). 1st) Where to save an array? ============================= If I mimic the grub legacy map command I need to save an array with the map definitions. static unsigned short bios_drive_map[DRIVE_MAP_SIZE + 1]; So that each time I call something like: map (hd0) (hd1) it modifies this vector. Any example on where should I define this vector so that I can use it from each command ? 2nd) boot_func and actual mapping ==================================== If you look at grub legacy boot command case KERNEL_TYPE_CHAINLOADER: /* Chainloader */ /* Check if we should set the int13 handler. */ if (bios_drive_map[0] != 0) { int i; /* Search for SAVED_DRIVE. */ for (i = 0; i < DRIVE_MAP_SIZE; i++) { if (! bios_drive_map[i]) break; else if ((bios_drive_map[i] & 0xFF) == saved_drive) { /* Exchage SAVED_DRIVE with the mapped drive. */ saved_drive = (bios_drive_map[i] >> 8) & 0xFF; break; } } /* Set the handler. This is somewhat dangerous. */ set_int13_handler (bios_drive_map); } gateA20 (0); boot_drive = saved_drive; chain_stage1 (0, BOOTSEC_LOCATION, boot_part_addr); break; you will see that among other things it detects if you want to do a chainloader boot. If you do a chainloader boot it checks the bios_drive_map array,... run some BIOS calls so that there's an actual map and then it finally boots. When I told marco_g that I want to modificy grub2's boot command he became scared because the boot command was arquitecture specific (or maybe not, I actually did not understood what he meant) and as long as I understood I was not meant to modify it. how should I implement this then? adrian15