grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

map command for grub2 draft


From: adrian15
Subject: map command for grub2 draft
Date: Thu, 07 Jun 2007 17:34:53 +0200
User-agent: Mozilla Thunderbird 1.0.7 (Windows/20050923)

        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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]