Skip to contentSkip to conversation

Replacing the legacy "map" command

DISCUSSION Javier Martín 2 participants 2 messages May 27, 2008 – May 28, 2008 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 3 lines
Quoted 3 lines

For grub, i'd suggest
map [olddrive newdrive] ...
eg. map (hd1) (hd0) (hd0) (hd1)

That was the syntax used in GRUB Legacy, it was successful and could be reused, but I'd prefer the "drivemap" command I suggested earlier, with options not just to map drives, but also to show the mappings and to reset them to the BIOS defaults. I'd still consider a "--automap" flag in the "chainloader" command quite useful, but I don't know how could this be set up, since there would be two modules involved: "chain" and the new "map" module. Chainloader would need to check whether the "map" module is available and/or loaded ~_~

Quoted 6 lines
Quoted 6 lines

The map command would just store the given parameters (converted to bios hex drive numbers) to a table/array.
When the boot command is issued, grub would install an int 0x13 handler that uses this data as an lookup table
to convert requests and "forward" them to the original int 0x13 handler.

Again, that was the method used in GRUB Legacy and my original plan:
contrary to what is suggested in other posts, the mappings would not apply immediately, but just be stored in an appropriate table. The required ISRs would be installed only after the boot order is issued, and the logic in grub_chainloader_real_boot.


Quoted 2 lines
Quoted 2 lines

By the way, I can imagine that some kernels not loaded with "chainloader" may benefit from the remapping as well.

If we want the mappings to be applied to loaders other than chain, however, we need to make sure the function installing the ISRs is run before grub_X_real_boot. I'm not sure if installing such a "pre-boot" handler is possible without significantly modifying the in-place structure of GRUB.

Cheers!
Habbit

#2 lore raw

Re: Replacing the legacy 'map' command

Dne 27 Květen 2008, 23:47, Javier Martín napsal(a):

Quoted 10 lines
Quoted 2 lines
Quoted 2 lines

For grub, i'd suggest
map [olddrive newdrive] ... eg. map (hd1) (hd0) (hd0) (hd1)

That was the syntax used in GRUB Legacy, it was successful and could be reused, but I'd prefer the "drivemap" command I suggested earlier, with options not just to map drives, but also to show the mappings and to reset them to the BIOS defaults. I'd still consider a "--automap" flag in the "chainloader" command quite useful, but I don't know how could this be set up, since there would be two modules involved: "chain" and the new "map" module. Chainloader would need to check whether the "map" module is available and/or loaded ~_~

The cooperation between modules is not hard, but I think
map -first (hdx) will be more useful. Such command just swaps hd0 and hdx drives. This also covers the scenarios when we chainload something else than first sector of given partition.

And maybe we can also consider following syntax:
map -pos (hd2) (hd0) (hd4)
with meaning:
hd0->hd1,
hd1->nothing
hd2->hd0,
hd3 not touch,
hd4->hd2
I.e. positional syntax, first argument is mapped to (hd0), second to (hd1),
and so on.

This syntax will be sufficient most times and writing
chainloader --automap (hd1,0)+1
is same as writing
map -first (hd1)
chainloader (hd1,0)+1
or
setting grub root to (hd1,0)
map -root
chainloader +1

Signature · 2 lines
Tomas Ebenlendr
                            http://drak.ucw.cz/~ebik