[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Booting El Torito image from a partition table
From: |
Andrei Borzenkov |
Subject: |
Re: Booting El Torito image from a partition table |
Date: |
Wed, 2 Dec 2015 21:47:29 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 |
02.12.2015 08:20, Emilio Lazo Zaia пишет:
> I did it.
>
Congratulations :)
> 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 :)
> - 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 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.
But that is quite different. You mentioned that ISO was created by
grub-mkrescue, and grub-mkrescue does not copy source files necessary to
create core.img. But if these files are present, everything becomes far
more simple.
> - 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. :-)
>
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.
> As a side question: which filesystems supports embeeding other than btrfs?
>
zfs