From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1Z6dQ6-0006dv-5Q for mharc-grub-devel@gnu.org; Sun, 21 Jun 2015 07:28:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60812) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z6dQ2-0006dZ-Hm for grub-devel@gnu.org; Sun, 21 Jun 2015 07:28:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z6dPz-0003rP-9r for grub-devel@gnu.org; Sun, 21 Jun 2015 07:28:10 -0400 Received: from mail-la0-x231.google.com ([2a00:1450:4010:c03::231]:33017) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z6dPy-0003rH-VJ for grub-devel@gnu.org; Sun, 21 Jun 2015 07:28:07 -0400 Received: by laka10 with SMTP id a10so95494424lak.0 for ; Sun, 21 Jun 2015 04:28:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type; bh=T7DhCN9tiCVuLMunacGnxdN8dBf4cn2YLGTMRUFH5sM=; b=iLJvpKcMMHCA7aiexHyQ0BOjt1JNb+4nTsri2pvo5mBa5UvOkDJCcFfIVNxhRvUa9M qNTR9tU29umFv1muML0BgBNFFs3IJ3RXXwMiVXygpeFcm82of4NbT1XUrJpyXrp5uD6b UYE15o8acF1JS1Mq8jw+MCZYBNMd6k4TDklCRT4jGe0PFctt1miUfz2smilrj6LACmK+ vw/CPvwv779HRrdKWVyjZXrzQ/UoNvbvUUkovTxZIO4RvM6eNJY4m1CD2lUStLuPavgE OfvucUdR9enAzvvVS+ijDDpAPFEFzQHQeQUJtY1ahCT/AiILREXX0rQSpMdCxDBJlXzV omBA== X-Received: by 10.112.25.10 with SMTP id y10mr25527737lbf.61.1434886086215; Sun, 21 Jun 2015 04:28:06 -0700 (PDT) Received: from opensuse.site (ppp91-76-14-38.pppoe.mtu-net.ru. [91.76.14.38]) by mx.google.com with ESMTPSA id a7sm3929044lbc.36.2015.06.21.04.28.05 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Jun 2015 04:28:05 -0700 (PDT) Date: Sun, 21 Jun 2015 14:28:03 +0300 From: Andrei Borzenkov To: Ross Lagerwall Subject: Re: [PATCH] core/partmap: Add El Torito boot catalog parsing Message-ID: <20150621142803.74703084@opensuse.site> In-Reply-To: <20150620101647.GA5671@hobo.lan> References: <1433672686-774-1-git-send-email-rosslagerwall@gmail.com> <20150608195144.69ed708c@opensuse.site> <20150608173106.GA9456@hobo.lan> <20150608205048.6f36750a@opensuse.site> <20150608182512.GA10375@hobo.lan> <20150608220117.5d8ce61e@opensuse.site> <20150620101647.GA5671@hobo.lan> X-Mailer: Claws Mail 3.11.0 (GTK+ 2.24.28; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/1.WV10ysv7/aK59Ee5AQzQl"; protocol="application/pgp-signature" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::231 Cc: grub-devel@gnu.org X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2015 11:28:12 -0000 --Sig_/1.WV10ysv7/aK59Ee5AQzQl Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable =D0=92 Sat, 20 Jun 2015 11:16:47 +0100 Ross Lagerwall =D0=BF=D0=B8=D1=88=D0=B5=D1=82: >=20 > 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. >=20 bor@opensuse:~> /usr/sbin/fdisk -l /tmp/usb Disk /tmp/usb: 10 MiB, 10485760 bytes, 20480 sectors Units: sectors of 1 * 512 =3D 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=3D$PWD ./grub-install -d grub-core --boot-d= irectory=3D/mnt --efi-directory=3D/mnt --removable bor@opensuse:~/src/grub> virtvm -drive file=3D/tmp/usb,if=3Dvirtio,media=3D= 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 =20 lists possible command completions. Anywhere else TAB lists possible =20 device or file completions. =20 grub> set cmdpath=3D(hd0,gpt2)/EFI/BOOT color_highlight=3Dblack/light-gray color_normal=3Dlight-gray/black feature_200_final=3Dy feature_all_video_module=3Dy feature_chainloader_bpb=3Dy feature_default_font_path=3Dy feature_menuentry_id=3Dy feature_menuentry_options=3Dy feature_nativedisk_cmd=3Dy feature_ntldr=3Dy feature_platform_search_hint=3Dy feature_timeout_style=3Dy grub_cpu=3Dx86_64 grub_platform=3Defi lang=3D locale_dir=3D pager=3D prefix=3D(hd0,gpt2)/grub root=3Dhd0,gpt2 secondary_locale_dir=3D grub> halt bor@opensuse:~> dd if=3D/dev/loop0p2 of=3D/tmp/efi.img bor@opensuse:~> xorriso -outdev /tmp/efi.iso -as mkisofs -graft-points --ef= i-boot /efi.img -efi-boot-part --efi-boot-image /efi.img=3D/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'=3D'/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 =20 lists possible command completions. Anywhere else TAB lists possible =20 device or file completions. =20 grub> set cmdpath=3D(cd0)/EFI/BOOT color_highlight=3Dblack/light-gray color_normal=3Dlight-gray/black feature_200_final=3Dy feature_all_video_module=3Dy feature_chainloader_bpb=3Dy feature_default_font_path=3Dy feature_menuentry_id=3Dy feature_menuentry_options=3Dy feature_nativedisk_cmd=3Dy feature_ntldr=3Dy feature_platform_search_hint=3Dy feature_timeout_style=3Dy grub_cpu=3Dx86_64 grub_platform=3Defi lang=3D locale_dir=3D pager=3D prefix=3D(cd0,gpt2)/grub root=3Dcd0,gpt2 secondary_locale_dir=3D 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. >=20 > [1]: > "A user once explained me his setup and mentioned > he runs grub-mkimage with "--config=3D", "iso9660" and > and that the "embedded grub.cfg" looks like > search.fs_label RECOVERY root > set prefix=3D($root)/boot/grub" >=20 > Regards --Sig_/1.WV10ysv7/aK59Ee5AQzQl Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlWGn8QACgkQR6LMutpd94xJAQCgr9ZHERFIcIsAYK59s2uiWlVu qEwAnR3c7uzIFqB7LrytwwvoO11Q6aU/ =NIc0 -----END PGP SIGNATURE----- --Sig_/1.WV10ysv7/aK59Ee5AQzQl--