From: Andrei Borzenkov <arvidjaar@gmail.com>
To: Ross Lagerwall <rosslagerwall@gmail.com>
Cc: grub-devel@gnu.org
Subject: Re: [PATCH] core/partmap: Add El Torito boot catalog parsing
Date: Sun, 21 Jun 2015 14:28:03 +0300 [thread overview]
Message-ID: <20150621142803.74703084@opensuse.site> (raw)
In-Reply-To: <20150620101647.GA5671@hobo.lan>
[-- Attachment #1: Type: text/plain, Size: 5048 bytes --]
В Sat, 20 Jun 2015 11:16:47 +0100
Ross Lagerwall <rosslagerwall@gmail.com> пишет:
>
> GRUB calculates a boot device based on the device path given by the
> firmware so:
It is not quite true. GRUB will auofill device part if it is not
present, keeping partition.
> With a normal CD, the firmware gives it something like
> /ACPI(a3401d0,0)/PCI(1,1)/ATAPI(0,0,0)/CD,1,899,1838) which points to
> the embedded ESP. GRUB doesn't know how to use that because it doesn't
> know how to read the El Torito catalog so it just uses the root of the
> CD as the boot device, i.e. (cd0), so the prefix becomes
> (cd0)/path/to/grub.
> With a hybrid USB, the firmware gives it something like
> /ACPI(a3401d0,0)/PCI(1,1)/ATA(0)/HD(1,MBR,0x769FCE30,172,63488) which
> GRUB finds and matches with the embedded ESP pointed to by the MBR e.g.
> (hd0,msdos2), so the prefix becomes (hd0,msdos2)/path/to/grub. In other
> words, the image will _not_ look at the same place whichever way it is
> booted.
>
bor@opensuse:~> /usr/sbin/fdisk -l /tmp/usb
Disk /tmp/usb: 10 MiB, 10485760 bytes, 20480 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: A89483C6-73F0-43C7-B35E-1D62107C7362
Device Start End Sectors Size Type
/tmp/usb2 2048 20446 18399 9M Linux filesystem
bor@opensuse:~> sudo losetup
NAME SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE
/dev/loop0 0 0 0 0 /tmp/usb
bor@opensuse:~> sudo mount /dev/loop0p2 /mnt
bor@opensuse:~> sudo pkgdatadir=$PWD ./grub-install -d grub-core --boot-directory=/mnt --efi-directory=/mnt --removable
bor@opensuse:~/src/grub> virtvm -drive file=/tmp/usb,if=virtio,media=disk,readonly -bios /usr/share/qemu/ovmf-x86_64.bin -serial stdio
...
GNU GRUB version 2.02~beta2
Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists possible
device or file completions.
grub> set
cmdpath=(hd0,gpt2)/EFI/BOOT
color_highlight=black/light-gray
color_normal=light-gray/black
feature_200_final=y
feature_all_video_module=y
feature_chainloader_bpb=y
feature_default_font_path=y
feature_menuentry_id=y
feature_menuentry_options=y
feature_nativedisk_cmd=y
feature_ntldr=y
feature_platform_search_hint=y
feature_timeout_style=y
grub_cpu=x86_64
grub_platform=efi
lang=
locale_dir=
pager=
prefix=(hd0,gpt2)/grub
root=hd0,gpt2
secondary_locale_dir=
grub> halt
bor@opensuse:~> dd if=/dev/loop0p2 of=/tmp/efi.img
bor@opensuse:~> xorriso -outdev /tmp/efi.iso -as mkisofs -graft-points --efi-boot /efi.img -efi-boot-part --efi-boot-image /efi.img=/tmp/efi.img
xorriso 1.3.8 : RockRidge filesystem manipulator, libburnia project.
Drive current: -outdev '/tmp/efi.iso'
Media current: stdio file, overwriteable
Media status : is blank
Media summary: 0 sessions, 0 data blocks, 0 data, 39.5g free
Added to ISO image: file '/efi.img'='/tmp/efi.img'
xorriso : UPDATE : 1 files added in 1 seconds
xorriso : UPDATE : 1 files added in 1 seconds
ISO image produced: 4800 sectors
Written to medium : 4800 sectors at LBA 0
Writing to '/tmp/efi.iso' completed successfully.
bor@opensuse:~/src/grub> virtvm -cd /tmp/efi.iso -bios /usr/share/qemu/ovmf-x86_64.bin -serial stdio
...
GNU GRUB version 2.02~beta2
Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists possible
device or file completions.
grub> set
cmdpath=(cd0)/EFI/BOOT
color_highlight=black/light-gray
color_normal=light-gray/black
feature_200_final=y
feature_all_video_module=y
feature_chainloader_bpb=y
feature_default_font_path=y
feature_menuentry_id=y
feature_menuentry_options=y
feature_nativedisk_cmd=y
feature_ntldr=y
feature_platform_search_hint=y
feature_timeout_style=y
grub_cpu=x86_64
grub_platform=efi
lang=
locale_dir=
pager=
prefix=(cd0,gpt2)/grub
root=cd0,gpt2
secondary_locale_dir=
grub> halt
> While Thomas's suggestion [1] does work around the issue, I think
> reading the catalog is a better-engineered solution.
What's wrong with the above? Note that it works using standard commands
and does not even require manual image creation. What is missing here?
BTW using explicit el-torito partition grub-install could not be used.
The reason to use GPT is block size difference. In principle it may be
possible to rewrite BPB when adding it to ISO to adjust for different
sector size.
>
> [1]:
> "A user once explained me his setup and mentioned
> he runs grub-mkimage with "--config=", "iso9660" and
> and that the "embedded grub.cfg" looks like
> search.fs_label RECOVERY root
> set prefix=($root)/boot/grub"
>
> Regards
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
next prev parent reply other threads:[~2015-06-21 11:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-07 10:24 [PATCH] core/partmap: Add El Torito boot catalog parsing Ross Lagerwall
2015-06-08 16:51 ` Andrei Borzenkov
2015-06-08 17:31 ` Ross Lagerwall
2015-06-08 17:50 ` Andrei Borzenkov
2015-06-08 18:25 ` Ross Lagerwall
2015-06-08 19:01 ` Andrei Borzenkov
2015-06-20 10:16 ` Ross Lagerwall
2015-06-20 10:19 ` Vladimir 'phcoder' Serbinenko
2015-06-20 13:52 ` Thomas Schmitt
2015-06-21 11:28 ` Andrei Borzenkov [this message]
2016-02-12 18:31 ` Vladimir 'φ-coder/phcoder' Serbinenko
2015-06-08 19:31 ` Thomas Schmitt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150621142803.74703084@opensuse.site \
--to=arvidjaar@gmail.com \
--cc=grub-devel@gnu.org \
--cc=rosslagerwall@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.