Jump to content











Photo
- - - - -

Grub4DOS behaves weird on menu.lst compared to typing command by hand (for my ugly hack)


  • Please log in to reply
1 reply to this topic

#1 wean_irdeh

wean_irdeh

    Newbie

  • Members
  • 29 posts
  •  
    Vietnam

Posted 13 September 2016 - 08:13 AM

 
After I've completed writing loopboot hook script for arch linux loopback booting, Wonko came up with an idea to use UUID instead of figuring out drives and partition and edit menu.lst manually
 
 

Very good  :).

 

Grub4dos (latest) is on Chenall pages:
http://grub4dos.chen...ries/downloads/

Latest 0.4.6a:
http://grub4dos.chen....6a-2016-08-06/

Latest 0.4.5c:
http://grub4dos.chen....5c-2015-12-31/

 

I believe you can use - instead of hardcoding a disk,partition for the root command, a tag file or a UUID and use again find --set-root, and use the batch capabilities of grub4dos to derive the loop0pn and /dev/sdmn  :dubbio: but possibly it is not worth the time/effort.

 

Good work.  :thumbsup:

 

:duff:

Wonko

 
 
 
So I'm playing around with grub4dos, but I can't figure out how to find a file specifically in a drive, since I have two Arch Linux installation, so I map a RAW image into the first drive (hd0) (step 4) so Grub4DOS can find the file in the RAW image partition (step 5) and save the UUID in the variable (step 6). 
 
Then I unmap the RAW image (step 7), map it again into (hd3) (step 9),
here's the problem: step 10 doesn't work on menu.lst, but it does work when I type the command by hand. How does this work?
 
Because of this the user had to manually edit the partition in the menu.lst (Sorry Wonko!)
 
I know this is an ugly hack, so if you have better idea rather than this ugly hack let me know
 
title Arch loopback booting with UUID
echo 1
set FILEPATH=/ada.vhd
echo 2
find --set-root %FILEPATH%
echo 3
uuid () && call set UUIDHOST=%^?%
echo 4
map --heads=0 --sectors-per-track=0 %FILEPATH% (hd0) 
map --hook
echo 5
find --set-root /boot/vmlinuz-linux
echo 6
uuid () && call set UUIDLOOP=%^?% 
echo 7
map (hd0) (hd0)
map --rehook
echo 8
find --set-root uuid () %UUIDHOST%
echo 9
map --heads=0 --sectors-per-track=0 %FILEPATH% (hd3)
map --hook
uuid (hd3,0)
echo %UUIDLOOP%
echo 10
find --set-root uuid () %UUIDLOOP%
kernel /boot/vmlinuz-linux root=UUID=%UUIDLOOP% rw loop_file_path=%FILEPATH% loop_dev_path=UUID=%UUIDHOST%
initrd /boot/initramfs-linux.img
 
Here's the video if anyone curious

 

Very good  :).

 

Grub4dos (latest) is on Chenall pages:
http://grub4dos.chen...ries/downloads/

Latest 0.4.6a:
http://grub4dos.chen....6a-2016-08-06/

Latest 0.4.5c:
http://grub4dos.chen....5c-2015-12-31/

 

I believe you can use - instead of hardcoding a disk,partition for the root command, a tag file or a UUID and use again find --set-root, and use the batch capabilities of grub4dos to derive the loop0pn and /dev/sdmn  :dubbio: but possibly it is not worth the time/effort.

 

Good work.  :thumbsup:

 

:duff:

Wonko

 


#2 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 13 September 2016 - 09:34 AM

Usually one uses a "tag" file to make sure to get the right volume.

 

If I get this right, the issue is with:
find --set-root /boot/vmlinuz-linux

as you have more than one volume with \boot\vmlinuz-linux file, the idea could be to put a unique file "thisistherighone.tag" file on the chosen volume.

As is, the grub4dos will find the first volume in scanning order containing the file and provide that as a result.(which should be however fine on most setups). 

 

With modern grub4dos  you don't normally need to use --rehook, you can re-use --hook.

But what is the reason for the:

 

map (hd0) (hd0)
map --rehook

 

:unsure:

 

For the "ada.vhd" the .vhd itself is the "tag file", for the "main" OS volume you could add one.

 

The:
find --set-root uuid () %UUIDHOST%

could be simplified to :dubbio::

uuid %UUIDHOST%

 

http://reboot.pro/to...-code/?p=130034

 

:duff:

Wonko






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users