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: Thu, 10 Dec 2015 18:59:41 -0430
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Icedove/42.0

I'm sorry for the lateness of my answer.

On 02/12/15 14:17, Andrei Borzenkov wrote:
02.12.2015 08:20, Emilio Lazo Zaia пишет:
I did it.

Congratulations :)
Thank you!

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:

No, you did not :)
I didn't? :-)

But the code in the embedding area is not core.img? in the case of a bootable iso9660 image, embedding zone contains cdboot.img with core.img, AFAIK.

- 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

Both steps are completely redundant, see below.

I thought I needed the boot binaries (.img files) on KCD to build a core.img that match the compilation, and it is wrong... With the usage of grub-install you pointed at the very end of your mail works perfectly for building a core.img that match the runtime compilation of KCD because we are including .mod files from KCD.


- 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:

You could simply mount partition.

# cp [/path/to/extracted/core.img] i386-pc/core.img
Redundant as well.

# grub-install /dev/sdf31 --boot-directory=/x -d i386-pc

grub-install always creates core.img from scratch, so none of previous
steps was needed.
...And it can take modules from another compilation no matter we are generating a boot code with a newer/older GRUB... This generated code is compilation-independent, and that's what I didn't know. That's why I've extracted the whole core.img from the CD.
You can also spare jumping through indirection hoops and simply create
image file that will point directly to your partition, similar to

address@hidden:~$ lsblk
NAME             MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                8:0    0 465,8G  0 disk
├─sda1             8:1    0   500M  0 part /boot/efi
├─sda2             8:2    0    40M  0 part
├─sda3             8:3    0     3G  0 part
├─sda4             8:4    0 446,5G  0 part /
└─sda5             8:5    0  15,8G  0 part [SWAP]
loop0              7:0    0   512M  0 loop
├─loop0p1        259:0    0   100M  0 loop
├─loop0p2        259:1    0   411M  0 loop
├─loop0p1 (dm-0) 252:0    0   100M  0 part /mnt
└─loop0p2 (dm-1) 252:1    0   411M  0 part /tmp/kasp
address@hidden:~$ cat /mnt/syslinux.cfg
label Kaspersky
        menu Kaspersky
        com32 chain.c32
        append file=kaspersky.img
address@hidden:~$ grub-mkimage -O i386-pc -o /tmp/temp.img -p
'(,msdos2)/boot/grub' -d /tmp/kasp/boot/grub/i386-pc  biosdisk
part_msdos iso9660
address@hidden:~$ cat /tmp/kasp/boot/grub/i386-pc/lnxboot.img
/tmp/temp.img > /tmp/kaspersky.img
address@hidden:~$ sudo mv /tmp/kaspersky.img /mnt

Now selecting Kaspersky in syslinux boots directly into partition2.
Replace "msdos" with "gpt" if needed and adjust partition number.
Indeed, I did include part_gpt and the prefix as '(,gpt20)/boot/grub'... The prefix starting with ',' always means the current disk?

The 20MB helper partition becames a 20KB helper file used to boot Kaspersky.

Thank you!!! You helped me a lot.
Emilio.







reply via email to

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