Jump to content











Photo
- - - - -

PXE Boot + adding a new hd device next after real ones from image

grub4dos image pxe boot

  • Please log in to reply
5 replies to this topic

#1 Szabolcs Raduly-Zorgo

Szabolcs Raduly-Zorgo
  • Members
  • 7 posts

Posted 23 January 2012 - 08:06 PM

Hi :)
I hope some of U will be able to help me with an unusual request / question:

The thing is, that I'm trying to get the next available free hdX (X should be the next free hd device number) so that I can map a new HD disk image.

ex:
- if I map hd0, then after boot the real hd0 will be invisible (I will see the image instead),
- if I map as hd8 or any other higher number then the real existing hdX+1 then it will not be mapped.

- if I have 2 HDD's I will have hd0, hd1... if I map the image as hd2 it will be OK, but in different systems I have different number of real HDD's...
so I'm trying to find the number X from hdX, where the X is the real existing HDD number (in the last example it is 2)

I would use the line:
map --mem (pd)/test.ima %nexthdx%
map --hook
where %nexthdx% would be the next available hd device

My problem is that I cannot get around how to get the %nexthdx% variable string...

10x in advance for anybody who could help me in this case... :)

Sz.

#2 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 23 January 2012 - 08:52 PM

Why not just pick a high number and map it to that
e.g.
map --mem (pd)/test.ima (hd9)

#3 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 23 January 2012 - 09:45 PM

You can get the number of hard disks from the BIOS parameter at 0x475

This seems to work


#unhook all mappings in case we reload the menu using configfile

map --unhook

map --unmap=0:0xff

# check location 475h for number of HDDs seen by BIOS

checkrange 0x00 calc *0x475 & 0xff && set NEWHD=(hd0)

checkrange 0x01 calc *0x475 & 0xff && set NEWHD=(hd1)

checkrange 0x02 calc *0x475 & 0xff && set NEWHD=(hd2)

checkrange 0x03 calc *0x475 & 0xff && set NEWHD=(hd3)

checkrange 0x04 calc *0x475 & 0xff && set NEWHD=(hd4)

checkrange 0x05 calc *0x475 & 0xff && set NEWHD=(hd5)

checkrange 0x06 calc *0x475 & 0xff && set NEWHD=(hd6)

checkrange 0x07 calc *0x475 & 0xff && set NEWHD=(hd7)



title test mapping

map --unmap=0:0xff

map --unhook

echo Mapping /fd002880.ima as %NEWHD%

map /fd002880.ima %NEWHD%

map --hook

ls %NEWHD%/

root ()

pause

configfile /menu.lst



#4 Szabolcs Raduly-Zorgo

Szabolcs Raduly-Zorgo
  • Members
  • 7 posts

Posted 24 January 2012 - 08:33 AM

Why not just pick a high number and map it to that
e.g.
map --mem (pd)/test.ima (hd9)


this way it is mapping the HD, but after the boot it will not bee seen (as it is not in a continuous list of HD's)

#5 Szabolcs Raduly-Zorgo

Szabolcs Raduly-Zorgo
  • Members
  • 7 posts

Posted 24 January 2012 - 08:36 AM

You can get the number of hard disks from the BIOS parameter at 0x475

This seems to work


#unhook all mappings in case we reload the menu using configfile

map --unhook

map --unmap=0:0xff

# check location 475h for number of HDDs seen by BIOS

checkrange 0x00 calc *0x475 & 0xff && set NEWHD=(hd0)

checkrange 0x01 calc *0x475 & 0xff && set NEWHD=(hd1)

checkrange 0x02 calc *0x475 & 0xff && set NEWHD=(hd2)

checkrange 0x03 calc *0x475 & 0xff && set NEWHD=(hd3)

checkrange 0x04 calc *0x475 & 0xff && set NEWHD=(hd4)

checkrange 0x05 calc *0x475 & 0xff && set NEWHD=(hd5)

checkrange 0x06 calc *0x475 & 0xff && set NEWHD=(hd6)

checkrange 0x07 calc *0x475 & 0xff && set NEWHD=(hd7)



title test mapping

map --unmap=0:0xff

map --unhook

echo Mapping /fd002880.ima as %NEWHD%

map /fd002880.ima %NEWHD%

map --hook

ls %NEWHD%/

root ()

pause

configfile /menu.lst


U gave the best answer in the Grub4dos Guide/Tutorial (pg4)

Thank U for the help :)


this was the magic part, that I could not get around: set/a hdn=*0x475&0xff
so now it is ok (and it is workin' as it follows):

title Map as a new HD from test.ima
set /a hdn=*0x475 & 0xff
map --mem (pd)/test.ima (hd%hdn%)
map --hook

Thank U again :)

#6 tinybit

tinybit

    Gold Member

  • Developer
  • 1175 posts
  •  
    China

Posted 24 January 2012 - 06:48 PM

Try this one:

map   --mem   (pd)/test.ima   (hd)

map   --hook







Also tagged with one or more of these keywords: grub4dos image, pxe boot

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users