All of lore.kernel.org
 help / color / mirror / Atom feed
* map command for grub2 draft
@ 2007-06-07 15:34 adrian15
  2007-06-11 14:45 ` adrian15
  0 siblings, 1 reply; 7+ messages in thread
From: adrian15 @ 2007-06-07 15:34 UTC (permalink / raw)
  To: The development of GRUB 2

	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




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

end of thread, other threads:[~2007-06-16 17:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-07 15:34 map command for grub2 draft adrian15
2007-06-11 14:45 ` adrian15
2007-06-15 18:22   ` Marco Gerards
2007-06-15 18:45     ` Bean
2007-06-15 18:56       ` Marco Gerards
2007-06-15 19:10         ` Bean
2007-06-16 17:19   ` adrian15

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.