Jump to content











Photo
- - - - -

Script for easy conversion of syslinux configuration files to grub4dos

grub syslinux isolinux

  • Please log in to reply
6 replies to this topic

#1 Lazza

Lazza
  • Members
  • 4 posts
  •  
    Italy

Posted 13 July 2014 - 09:39 AM

Hi, this is my first post here so I apologize in case this is the wrong section.

 

I've been working for a while on a multi-recovery live DVD/USB and from the start I decided to use grub4dos. The final result allowed me to include tool such as Trinity Rescue Kit, Parted Magic, Kaspersky Rescue CD and other tools. A problem I faced from the start was that many distros use syslinux, even if it's not so easy to use if you plan to move files around.  :rolleyes:

 

My idea of setup, for many distros, is this:

  1. make a subdirectory
  2. put all the ISO contents in that subdirectory
  3. build a menu.lst file (or tweak the existing one to point to the correct subdirectory)
  4. Add an entry in the root menu.lst file

Step 3 is what takes most of the time if you are about to convert a syslinux file with, say, 20 entries. This is why I decided to write a Python script called syslinux2menulst. You can download it on Google Code:

 

http://code.google.c...slinux2menulst/

 

Here is the usage:

usage: syslinux2menulst.py [-h] FILE PATH DIRECTORY

Convert a syslinux/isolinux file to a GRUB menu.lst.

positional arguments:
  FILE        Input file
  PATH        Absolute path in the disk structure, e.g. /menu.lst
  DIRECTORY   Output root directory (will be created if not present)

optional arguments:
  -h, --help  show this help message and exit

An example of execution, for RIPLinuX, would be:

syslinux2menulst.py syslinux.cfg /partedmagic/menu-pmagic.lst ./output

In this case the output would be something like:

WARNING: ignoring unknown entry
----
LABEL localboot
MENU LABEL ^5. Local boot
TEXT HELP
Bypass the SYSLINUX loader, and use the boot loader on your hard disk.
ENDTEXT
localboot 0x80
----
WARNING: ignoring unknown entry
----
LABEL reboot
MENU LABEL ^6. Reboot
TEXT HELP
Restart the computer.
ENDTEXT
COM32 /boot/syslinux/reboot.c32
----
Saved file ./output/partedmagic/menu-pmagic_0.lst
Saved file ./output/partedmagic/menu-pmagic_1.lst
Saved file ./output/partedmagic/menu-pmagic_2.lst
Saved file ./output/partedmagic/menu-pmagic_3.lst
Saved file ./output/partedmagic/menu-pmagic.lst

Some entries may need manual tweaking, but the rest (including the submenus) should work without much trouble. All the entries are tweaked so that they work after the files have been put in the partedmagic directory.

 

I will be glad to hear from you if you have any feedback or suggestion. Thank you.  :)



#2 steve6375

steve6375

    Platinum Member

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

Posted 13 July 2014 - 11:13 AM

This approach is similar to that used by YUMI  and XBOOT. I think there are quite a few more things you need to consider to make this truly universal for both DVD and USB booting.

e.g. where cheat codes (kernel parameters) used include UUID=, MEDIA= and  LABEL= is used, archisolabel=, pmedia=, boot=cdrom, live-media=removable, misolabel=, livecd=, bootid=

 

for some of these your app needs to know the volume label of the DVD or USB drive and also needs to know if you are going to use a DVD or USB drive.

 

This whole issue is why I developed Easy2Boot and use the partnew method to boot linux ISOs directly (originally mentioned by cdob). However, this does not work when booting from a DVD, only a writeable USB drive. It would be easier for you to support DVD booting only with your app and not cater for USB booting. You will still need to do some cheat code conversion however.



#3 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 13 July 2014 - 11:32 AM

However, this does not work when booting from a DVD, only a writeable USB drive. It would be easier for you to support DVD booting only with your app and not cater for USB booting. You will still need to do some cheat code conversion however.

Well, given the growing sizes of every distro, the multiboot from DVD is going to be called "few-boot" ;).

On the other hand, systems have every day more RAM, so it could not be (anymore) completely stupid to load the whole DVD in RAM and then do some tricks (like using a hard disk emulation image, or somethng like that).

@Lazza
Maybe it could be of interest to you a completely different approach, the COSMIAS one (shameless plug ;)):
http://reboot.pro/to...-to-g4d-images/
the idea is to write the actual grub4dos booting commands into first sector of the actual .iso, and then simply invoke from the "main" menu.lst the name of the .iso (and since the .iso, unlike a HD image, has lot of usable space at the beginning, and so it allows any kind of "tricks", including the Partnew one)
The advantage (if any) is that the main menu.lst is extremely simplified/simple while the "complexities" are "embedded" into the .iso, that, once modified, is easily "movable" to (say) another stick, or to a hard disk, and updating the menu.lst to add the item is trivial also manually.

:duff:
Wonko

#4 Lazza

Lazza
  • Members
  • 4 posts
  •  
    Italy

Posted 13 July 2014 - 11:33 AM

Thank you for your feedback. :)

I think there are quite a few more things you need to consider to make this truly universal for both DVD and USB booting.

Actually I am not claiming that the software will generate a bootable medium for you. In fact the script is just about converting syslinux files. Then the user has to check the generated files, tweak if necessary, and compile the main menu.lst file (this step should be the easiest).

Let’s say it’s a time saver, more than a one-click solution. What I wanted to achieve is to reduce the time between when you start your project and when you run the mkisofs command.

also needs to know if you are going to use a DVD or USB drive

You are absolutely right, but I think it depends on the single distro. E.g. Kaspersky Rescue Disc works only if the root of the disk has a file called livecd. The good news is that it works also if you copy the files on a USB drive and use bootlace.com to install the bootloader.

IMHO this is something I don’t have to worry about, in the sense that it’s a bit outside of the (limited) scope of my script: converting from syslinux to GRUB legacy. Up to know I’ve used it to create a multiboot system with:

  • Trinity Rescue Kit (tweaking the vollabel= parameter manually)
  • RIPLinuX

  • System Rescue CD

  • Parted Magic

  • Ophcrack LiveCD

  • Kaspersky Rescue Disk

  • Paragon Rescue Kit

  • Paragon Rescue Kit for Mac

Then I added a bunch of Windows Recovery ISOs using the map --hook trick I discovered on this forum. On different machines I tried, everything works both from DVD and from USB. By the way, grub4dos is really neat for the purpose, it’s a pity that many distros only have a syslinux file.

 



#5 Lazza

Lazza
  • Members
  • 4 posts
  •  
    Italy

Posted 13 July 2014 - 11:38 AM

 

 

the idea is to write the actual grub4dos booting commands into first sector of the actual .iso, and then simply invoke from the "main" menu.lst the name of the .iso

 

I am not sure I understood what you mean. What process do you follow when your original ISO uses syslinux?

 

 

 

the main menu.lst is extremely simplified/simple while the "complexities" are "embedded" into the .iso, that, once modified, is easily "movable" to (say) another stick

 

That's a good point. It is more or less what I tried to do with my multiboot system, the main menu.lst file contains this:

splashimage /lemur.bmp.gz
font /unifont.hex.gz
/menuset	0	0	0	0	0	0	4	73	4	15	19

title Trinity Rescue Kit 3.4 build 372
find --set-root /trk3/trinity/menu-trk.lst
configfile /trk3/trinity/menu-trk.lst

title RIPLinuX 13.7
find --set-root /RIPLinuX/grub4dos/menu-cd.lst
configfile /RIPLinuX/grub4dos/menu-cd.lst

title System Rescue CD 2.8.1
find --set-root /sysrescue/isolinux/menu-sys.lst
configfile /sysrescue/isolinux/menu-sys.lst

[...]


#6 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 13 July 2014 - 12:11 PM

I am not sure I understood what you mean. What process do you follow when your original ISO uses syslinux?

"manual" translation (or actually find the valid way of booting it from grub4dos), but of course one could use a script or your python thingy.
 

That's a good point. It is more or less what I tried to do with my multiboot system, the main menu.lst file contains this:

Yes, the difference would be that:
1) you would have no other .lst files (if you prefer a simplified layout on the stick)
2) the entry (example) for Riplinux could become (say):

title RIPLinuX 13.7
/isos/Riplinux317.iso

Instead of:

title RIPLinuX 13.7
find --set-root /RIPLinuX/grub4dos/menu-cd.lst
configfile /RIPLinuX/grub4dos/menu-cd.lst



:duff:
Wonko

#7 Lazza

Lazza
  • Members
  • 4 posts
  •  
    Italy

Posted 13 July 2014 - 05:37 PM

I see. Thanks for the information.







Also tagged with one or more of these keywords: grub, syslinux, isolinux

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users