This is a patch series enabling successful boots on machines with old/buggy system firmware that always assumes that hardware is using 512-bytes sectors, but more modern disks (e.g., 4Kn disks).
I will not get into the details in that cover letter, since the commits themselves are supposed to be verbosely explaining what has been done and why exactly, including proper comments within the code, but I will give a short summary of the user-visible features: - it works for me (yay!) - only x86 is supported, the SPARC core.img writing code is so different and weird that was I not able to merge the changes to both platforms (and OFW probably does not suffer from these problems anyway) - as a drive-by fix, stop allocating RS codes space on SPARC which cannot use it - adds disk sector size autodetection in the biosdisk module - adds a new, documented command line option --emu-512b that spaces out core.img in such a way that these buggy machines can read it correctly and enables the former mentioned disk sector size autodetection - as another drive-by fix, make the diskfilter debug output more usable. This stuff is not perfect and it likely also cannot be: - the disk sector size autodetection relies on content being *different* in the first two sectors of a disk, so it will fail to detect the sector size if, for example, the disk is empty - the last few sectors on a disk will not be readable if the system firmware is not very lenient. Lastly, most of this stuff is opt-in. Users will need to explicitly pass the new --emu-512b option to grub-install to get the new behavior. This will also automatically set the biosdisk_autodetect_sector_size environment variable in core.img's embedded config file. The environment variable seems to stick after loading the actual (menu) config file. V2: - unbreak SPARC due to a very, very, very stupid typo - fix a few typos in GPT code comments. Mihai Moldovan (7): biosdisk: autodetect hardware sector size (opt-in) biosdisk: restore LBA mode after read/write failures setup: add support for native sector addressing w/ 512-bytes lengths grub-install: hook up --emu-512b to sector size autodetection in biosdisk docs/grub: document --emu-512b install option diskfilter: write out currently scanned partition gpt: respect native sector size if set/detected docs/grub.texi | 15 + grub-core/disk/diskfilter.c | 54 ++- grub-core/disk/i386/pc/biosdisk.c | 642 +++++++++++++++++++++++++++++- grub-core/disk/ldm.c | 10 +- grub-core/fs/btrfs.c | 9 +- grub-core/fs/zfs/zfs.c | 9 +- grub-core/partmap/gpt.c | 79 +++- grub-core/partmap/msdos.c | 30 +- include/grub/emu/hostdisk.h | 3 +- include/grub/fs.h | 3 +- include/grub/i386/pc/biosdisk.h | 3 + include/grub/partition.h | 3 +- include/grub/util/install.h | 4 +- util/grub-install.c | 44 +- util/grub-setup.c | 10 +- util/setup.c | 349 ++++++++++++++-- 16 files changed, 1204 insertions(+), 63 deletions(-) -- 2.25.1 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel