All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mihai Moldovan <ionic@ionic.de>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: [PATCH 0/7] support >512b sector disks with old/buggy firmware
Date: Sun, 24 May 2020 13:43:01 +0200	[thread overview]
Message-ID: <20200524114308.1009-1-ionic@ionic.de> (raw)

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.


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



             reply	other threads:[~2020-05-24 11:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-24 11:43 Mihai Moldovan [this message]
2020-05-24 11:43 ` [PATCH 1/7] biosdisk: autodetect hardware sector size (opt-in) Mihai Moldovan
2020-05-24 11:43 ` [PATCH 2/7] biosdisk: restore LBA mode after read/write failures Mihai Moldovan
2020-05-24 11:43 ` [PATCH 3/7] setup: add support for native sector addressing w/ 512-bytes lengths Mihai Moldovan
2020-05-24 11:43 ` [PATCH 4/7] grub-install: hook up --emu-512b to sector size autodetection in biosdisk Mihai Moldovan
2020-05-24 11:43 ` [PATCH 5/7] docs/grub: document --emu-512b install option Mihai Moldovan
2020-05-24 11:43 ` [PATCH 6/7] diskfilter: write out currently scanned partition Mihai Moldovan
2020-05-24 11:43 ` [PATCH 7/7] gpt: respect native sector size if set/detected Mihai Moldovan

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=20200524114308.1009-1-ionic@ionic.de \
    --to=ionic@ionic.de \
    --cc=grub-devel@gnu.org \
    /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.