help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Booting El Torito image from a partition table


From: Emilio Lazo Zaia
Subject: Re: Booting El Torito image from a partition table
Date: Wed, 2 Dec 2015 00:50:18 -0430
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Icedove/42.0

I did it.

On 01/12/15 11:57, Andrei Borzenkov wrote:
30.11.2015 23:16, Emilio Lazo Zaia пишет:
Did you consider using syslinux loopback driver? This way ISO would
appear as ISO (or at least non-partitioned device) to GRUB. It may
work ...

I don't know how loopback on syslinux works. I guess is like the GRUB
loopback module, i.e. make a device from a file and boot from it. I'll
try it...

Sorry, it is memdisk

http://www.syslinux.org/wiki/index.php/MEMDISK

I have another idea: Make another -small and auxiliary- GRUB partition
in the same USB drive and chainload it from syslinux's master partition.
It worked in the sense of that I have the GRUB prompt/menu from the
"auxiliary" new partition.

What I thought is changing root=, prefix= to the Kaspersky partition (or
SG2D if applies) and execute GRUB2's configfile directive to the main
grub.cfg on that media. It didn't worked because of some 'unknown
symbols' in the case of Kaspersky... Kaspersky includes other self-made
GRUB modules (e.g. a module for displaying the EULA text) and these
files were compiled against the version of GRUB included in their CD,
naturally.

Yes. GRUB modules must match GRUB run-time (which is compiled into
single kernel.img).

The core.img on that CD can be extracted to be concatenated with
boot.img to be able to boot the same version of GRUB included in
Kaspersky disk but from the helper partition? I mean installing on the
32MB helper partition the version of GRUB2 included on the Kaspersky CD.
In that case I'll be able to change root and prefix variables pointing
to the Kaspersky partition and loading the correct grub.cfg with
'configfile'.

That way we can get rid of El Torito code, which don't understand
partitioned devices, if I am right, and we'll not have unknown symbols
because both GRUBs will be the same.

No, you misunderstand. The problem is not boot block, but core.img
itself - it lacks partition driver(s) and so is not able to access
partitions. It simply does not see them.

It is theoretically possible to decompose core.img (actually,
eltorito.img in this case) and add more drivers and adjust prefix as
needed and pack back into single executable. But I would try memdisk
first :)


Yes, I mean eltorito.img code, which is cdboot.img + core.img concatenated; right? So the code that lacks partition drivers is the core.img part... I've extracted core.img from Kaspersky CD:

- In Kaspersky CD (kav_rescue_10.iso) I've extracted the boot code + core.img, located at the embedding area, just after the MBR of the hybrid image:

# dd if=kav_rescue_10.iso bs=512 skip=1 count=54 of=eltorito.img

- Dropped the cdboot.img part:

# dd if=eltorito.img bs=2048 skip=1 of=core.img

- I created a helper partition (20MB, on /dev/sdf31) in btrfs and mounted it on /x. - Extracted all contents of kav_rescue_10.iso on my home, cd to boot/grub and copy extracted core.img to i386-pc to be used with grub-install:

# cp [/path/to/extracted/core.img] i386-pc/core.img
# grub-install /dev/sdf31 --boot-directory=/x -d i386-pc

- Now we have a GRUB installation in /dev/sdf31. This GRUB is the same as the Kaspersky, so the modules on CD will match the compilation.
- Copy all files from /boot/grub on Kaspersky to /x
- Edited a new grub.cfg on helper partition (/x) to search for a file on the real Kaspersky CD, set root, prefix and load the config file, with something like:

search -f /rescue/KRD.VERSION --set=root
set prefix=($root)/boot/grub
configfile=/boot/grub/grub.cfg

Now, in the master syslinux partition, simply chainloading to the helper's partition boot sector will execute GRUB boot code and load config file on the real Kaspersky CD. The result: Kaspersky splash screen is shown from within syslinux. :-)

As a side question: which filesystems supports embeeding other than btrfs?

Thanks a lot.
Emilio

PS: I'll try also with memdisk, but I guess the whole kav_rescue_10.iso must lie on syslinux master partition.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]