Jump to content











Photo
- - - - -

grub4dos WENV


  • Please log in to reply
12 replies to this topic

#1 steve6375

steve6375

    Platinum Member

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

Posted 30 April 2011 - 04:31 PM

Attached is the wenv binary from chenall and some test files and a (new today!) translated version of the readme file in English.
I have tested 90% of the examples in the english readme file and also tested the script file run.bat and the example menu.lst.

Using wenv allows the user to use variables and calculate values or even dynamically construct a configfile (new menu.lst file).
If you have a lot of ISO files, you now don't need to make a new menu.lst entry every time you add another iso!


(p.s. sorry for the double post - I thought I would start a new thread for anyone who wants to try this at home!)




under grub4dos shell environmant type /wenv:



  VARIABLE is made of characters "_/A-Z/a-z/0-9"

   max length=8, and the first character is not 0-9

 



 WENV SET VARIABLE=[$U|L,] [$input,] STRING

   	SET VARIABLE=[[$U|L, ] <[[STRING] [${VARIABLE}]] | [*ADDR]>]

   	SET [PREFIX[*]]

 WENV GET [VARIABLE] | [PREFIX[*]]

 WENV RESET [VARIABLE] | [PREFIX[*]]

 WENV CALC <${VAR}|*ADDR> [=<${VAR}|[*]INT...> [OPERATOR <${VAR}|[*]INT...>]]

 WENV READ <FILE>

 WENV CALL <grub4dos-builtincmd | ${VARIABLE} | *ADDR>

 WENV EXEC <command | ${VARIABLE} | *ADDR>

 WENV CHECK <string|${VAR}|[*]INTEGER> compare-op <string|${VAR}|[*]INTEGER>

	compare-op support ==,<>,>=,<=

 WENV FOR /L %i IN (start,step,end) DO wenv-command

 			FOR /F ["options"] %i IN ( file ) DO wenv-command

 			FOR /F ["options"] %i IN ("string") DO wenv-command

 WENV ECHO [string]





default 0

timeout 5

clear



/wenv echo Today is ${@DATE} ${@TIME}



pause --wait=3





title 0. Auto-make menu for /BOOT/IMGS/ folder

# call the RUN batch file and create a configfile in the ramdrive for all image files

/RUN.bat .Automenu

# Load the new configfile

configfile (md)0x3000+0x10



title 1. Boot dos

# call the RUN batch file with the file we want to load in the /BOOT/IMGS folder specified

/RUN.bat DOS622.IMA

# Add the boot command so the user can use the cursor keys to select this menu entry

boot



title 2. Specify an iso file to run

# list all files in the /boot/imgs folder so the user can see

ls /boot/imgs/

echo

# Ask user which iso they want (converts to uppercase as $U is specified)

/WENV set ask=$U,$input,Enter iso name with no extension (e.g. dban) :  

/WENV get ask || echo No iso file specified! && configfile /menu.lst

clear

/WENV echo Loading /boot/imgs/${ask}.iso - please wait ...

# run the grub4dos map command and specify the iso file we want

/WENV call map --mem (bd)/boot/imgs/${ask}.iso (0xff)

map --hook

chainloader (0xff)



Attached Files

  • Attached File  wenv.zip   21.82KB   920 downloads


#2 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 30 April 2011 - 04:39 PM

Wonko approves of this post. :cheers:

The ones that should be anyway prevented to do this at home are nonetheless the kids. :) :)

And of course :) WHAT about the remaining 10%? :P

:cheers:
Wonko

#3 Holmes.Sherlock

Holmes.Sherlock

    Gold Member

  • Team Reboot
  • 1444 posts
  • Location:Santa Barbara, California
  •  
    United States

Posted 04 April 2013 - 04:39 PM

configfile (md)0x3000+0x10

 

What does 'md' and the hex value represent?



#4 steve6375

steve6375

    Platinum Member

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

Posted 04 April 2013 - 04:46 PM

I could tell you, but I would have to shoot you... or you could search my grub4dos tutorial...



#5 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 04 April 2013 - 06:46 PM

I could tell you, but I would have to shoot you... or you could search my grub4dos tutorial...

...which is not "fully-fully" explicative/accurate :w00t::

 

 

The syntax used for a device (md)0x220+1 means device=memory, address = sector 220 hex = byte position 272Kb in memory, first sector (first 512 bytes)

(more correctly :unsure: offset 544*512=278528  bytes for the length of 1*512= 512 bytes)

 

The generic syntax is:

 

 

(device)offset+length

 

where both the offset and length are expressed in 512 bytes sectors.

md means memory drive just like fd means floppy drive, hd means harddisk drive and cd means cd drive ( and rd means ram drive).

 

the (device)offset+length is not "peculiar" to WENV it is the normal way grub4dos addresses a part of a device, as a more known example, is:

http://diddy.boot-la.../map.htm#direct

 

 

chainloader (fd0)+1

which actually is a short form for:

 

 

chainloader (fd0)0+1

 

i.e. you can omit the offset if it is 0, the command will chainload the first sector of the device (fd0), i.e. the *whatever* is at offset 0 for the length of 1 sector.

 

:cheers:

Wonko



#6 Holmes.Sherlock

Holmes.Sherlock

    Gold Member

  • Team Reboot
  • 1444 posts
  • Location:Santa Barbara, California
  •  
    United States

Posted 04 April 2013 - 06:49 PM

where both the offset and length are expressed in 512 bytes sectors.

md means memory drive just like fd means floppy drive, hd means harddisk drive and cd means cd drive ( and rd means ram drive).

 

How is 'md' and 'rd' different?



#7 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 04 April 2013 - 07:00 PM

How is 'md' and 'rd' different?

I could tell you, but I would have to kill you afterwards..... :whistling:

 

How long have you been here? :dubbio:

 

Haven't you learned that the idea of a Topic is that posts in it should stay on Topic?  :ranting2:

 

Do you want me to rename ALSO this topic as "post here anything that crosses your mind about grub4dos"? :unsure:

 

Do you suggest to rename all friggin' threads in the grub4dos sub-forum like that? :frusty:

 

:cheers:

Wonko



#8 steve6375

steve6375

    Platinum Member

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

Posted 04 April 2013 - 07:00 PM

see link I gave! rd is memory but not in sectors. You can set the base address, etc.



#9 Holmes.Sherlock

Holmes.Sherlock

    Gold Member

  • Team Reboot
  • 1444 posts
  • Location:Santa Barbara, California
  •  
    United States

Posted 04 April 2013 - 07:11 PM

How long have you been here? :dubbio:

 

Nearly 84,412,800 seconds :D



#10 steve6375

steve6375

    Platinum Member

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

Posted 04 April 2013 - 07:27 PM

memory4grub.jpg

 

http://www.rmprepusb...y-and-ramdrives



#11 Holmes.Sherlock

Holmes.Sherlock

    Gold Member

  • Team Reboot
  • 1444 posts
  • Location:Santa Barbara, California
  •  
    United States

Posted 05 April 2013 - 02:34 AM

@steve6375

 

What I understood is, you have use three memdrives in run.bat

  1. (md)0x3800+0x80 : To hold the directory listing to iterate over later
  2. (md)0x3000+0x10 : You keep on appending the dynamically generated menu.lst at the end
  3. (md)4+8 : BUT, what is it about?


#12 steve6375

steve6375

    Platinum Member

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

Posted 05 April 2013 - 09:49 AM

grub4dos loads the default embedded menu at (md)4 when it first boots. The embedded menu is something like...

 

pxe detect
configfile
default 0
timeout 1

title find /menu.lst, /boot/grub/menu/lst, /grub/menu.lst
errorcheck off
configfile /boot/grub/menu.lst
etc
etc

 

you can see this by typing cat (md)4+1  in the grub4dos console.

 

so basically, configfile (md)4+8 just reloads the same menu.lst file again without needing to reboot.



#13 steve6375

steve6375

    Platinum Member

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

Posted 05 April 2013 - 10:28 AM

If you add the partnew command to the ISO section in run.bat, then you will have an even better success rate  (assumes ptn entry 4 is unused on your boot device).

 

 

:.iso
map --mem (bd)/BOOT/IMGS/%1 (0xff)
map --hook
partnew (hd0,3) 0x0 (bd)/BOOT/IMGS/%1
chainloader (0xff)
exit
 





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users