On 4/10/22 09:56, Thomas Schmitt wrote:
Hi,

Nikolay Nikolov wrote:
Maybe I should try adapting my code, so that it finds the GRUB BIOS boot
partition and loads it?
This would be a nice stunt for which we would have to find a use case.
As stated yesterday, the GRUB El Torito image contains a core.img which
serves the same purpose as a BIOS partition.
The use case I'm thinking about is not for the install image, but for hard disk installations in legacy BIOS mode, that use the GPT partition scheme, instead of the MBR partition scheme. In this case, with my MBR bootloader code, you still need the extra GRUB BIOS boot partition, but it can be moved anywhere on the disk, without breaking the bootloader. In the case of the traditional GRUB MBR code, you would need to boot from a rescue media and reinstall the bootloader, every time this partition is moved (or partition tools should treat it as unmovable, which reduces your flexibility). The disadvantage of my MBR boot code is that it doesn't support really old systems without the INT 13h LBA extensions. And you cannot detect in the distro installer whether the system supports these extensions or not, so if it's installed by default, some old systems would be rendered unbootable. In theory, anything that supports x86_64 should support these extensions (they were introduced in the Windows 95/98 times, when hard drives started hitting the 8 GB mark, while x86_64 appeared much later, in 2003, at the time hard drives were hitting 160GB-200GB as far as I can remember, and the 8 GB limit was becoming a joke), however I don't know what's the reality, BIOSes are surprisingly buggy.


the main obstacle is
that I'm not familiar with GRUB's code and I don't know what GRUB's next
stage needs
I myself only learn about GRUB at occasions like this here.
There is a vivid community at grub-de...@gnu.org. If you have an
interesting use case they might be willing to explain things. But on the
other hand the BIOS stuff is old and Vladimir Serbinenko, who created it,
is not very busy with GRUB any more.
Yeah, I'll join that mailing list and explain the use case I have in mind (the one that I described above).


Unfortunately, I'm not familiar with how El Torito works,
Roughly:

At 2048-byte-LBA 17 (decimal) there is the Boot Record, which points to
the El Torito Boot Catalog. The catalog contains entries, which describe
boot images. In case of Fedora Live there are three of them: One for BIOS,
and two for EFI.

The boot image for BIOS is a plain x86 program. The first EFI image is
a FAT filesystem with boot programs /EFI/BOOT/BOOT*.EFI for the intended
processor architectures (x86-32bit, x86-64bit, ARM-32bit, ... ).

The second boot image for EFI (macboot.img) is actually a HFS+ filesystem
image which should not be listed in the catalog. That's a hack by Matthew
J. Garrett to let the rather dumb ISOLINUX program isohybrid.c find the
HFS+ image and mark it by an Apple Partition Map. isohybrid.c does not
understand ISO 9660 but it knows the El Torito boot catalog.
Fedora does not use isohybrid.c any more, but rather lets libisofs under
xorriso create the Apple Partition Map, if at all. Nevertheless, xorriso
produces the same inappropriate catalog entry for EFI, which the firmware
ignores in favor of the appropriate EFI boot image.
(Who am i to change mjg's invention ?)

My knowledge about boot lures for various processors and firmwares is
compiled at
   
https://dev.lovelyhq.com/libburnia/libisofs/raw/branch/master/doc/boot_sectors.txt

Original specs:

El Torito:
   
http://web.archive.org/web/20010706014919/http://www.ibm.com/products/surepath/documents/standard/cdrom7.pdf
UEFI:
   https://uefi.org/sites/default/files/resources/UEFI_Spec_2_8_final.pdf
Legacy BIOS:
   Only rumors around. Start exploring at Wikipedia. Re-use your knowledge
   about BIOS booting from floppy/hard disk/USB flash drive.
Thanks for the explanation and the links. I'll check them out.


This hybrid USB stick/DVD iso image has always seemed
like black magic to me :)
It's just a matter of outmost cramming of boot lures which are barely
compatible. (The unusual block size 2048 for Apple Partition Map
gives room for GPT. Some noop-x86 code at the start of the MBR lets
it look like the first block of an Apple Partition Map. It's just weird
from the view of specs and BIOS tradition. But it works since 10 years.)

I imagine it is like those polyglot programs, that are simultaneously valid in several totally different programming languages:

https://en.wikipedia.org/wiki/Polyglot_(computing)



AFAIK, Windows only
provides an ISO download, that is suitable for burning on optical media and
then it boots, but it doesn't work, when you "dd" it to an USB flash drive.
I think you need to use special tool, to write it to a USB stick,
You are supposed to create a FAT filesystem in a MBR partition of the
USB stick with a traditional partition type like 0x0C. Then you copy all
files from the ISO 9660 filesystem into that FAT filesystem.
Et voila: An undocumented property of EFI implementations will find
and start /EFI/BOOT/BOOT*.EFI to boot MS-Windows.
(M$-Knowledge gained from Pete Batard, developer of program Rufus.)

Interestingly, Fedora Live ISOs have a /EFI/BOOT/ tree in the ISO 9660
filesystem, probably to support this feature. I learned about it from
Pete Batard's protests when Ubuntu began to produce ISOs which omitted
this copy of the EFI System Partition FAT content.
Interesting and weird, like all things, related to the PC booting process :)


And what's worse,
they now require the rarer and more expensive DVD+R DL discs, since their
install image exceeds 4.7 GB :)
Consider to invest in a Blu-ray burner. Single layer BD-R and BD-RE are
much more reliable than DVD+R DL and meanwhile at least BD-R are cheaper
than DVD+R DL. BD-RE cost about the same as DVD+RW with more than 5 times
the storage capacity. Still cheaper than 16 GB USB sticks.
Actually, I have already invested in a Blu-ray burner, I just haven't purchased any BD-R or BD-RE install media, so I haven't even tested the Blu-ray burning :) BD-R is hard to find and more expensive than DVD-R/DVD+R here, so I should order online. The other reason I'm using DVD+R DL is compatibility, not all computers have a Blu-ray drive. I have only one on my desktop, while all virtually all my laptops that have an optical drive can read DVD (and for the ones that don't have an optical drive, I have an external USB DVD drive). I guess, I should also invest in an external USB Blu-ray drive, but it's not a high priority purchase for me. :)


Have a nice day :)

Thomas
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure

Reply via email to