mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Patrick J. LoPresti" <patl@users.sourceforge.net>
To: Sean Estabrooks <seanlkml@sympatico.ca>
Cc: szepe@pinerecords.com, Andries.Brouwer@cwi.nl,
	linux-kernel@vger.kernel.org
Subject: Re: 2.6.x partition breakage and dual booting
Date: 01 Jun 2004 11:10:27 -0400	[thread overview]
Message-ID: <s5gfz9f2vok.fsf@patl=users.sf.net> (raw)
In-Reply-To: <20040531170347.425c2584.seanlkml@sympatico.ca>

Sean Estabrooks <seanlkml@sympatico.ca> writes:

> Just don't alter partition table entries of non Linux partitions?  

I have not been very clear, so let me try once more.

Yes, using the existing partition table geometry will work if you
install Windows before you install Linux.  But it will fail if you do
things the other way around.

I am suggesting an approach which will work either way; namely,
determine the Windows-compatible geometry and use it.

The Windows-compatible geometry is the one reported by the "legacy
INT13 BIOS interface"; i.e., INT13/AH=08h.

Because this legacy BIOS interface can only be invoked from real mode,
Linux 2.2.x and 2.4.x tried to infer the legacy geometry by parsing
CMOS tables.  This did not always work, both because the tables are
poorly specified and buggy and vendor-specific, and because it
requires mapping between BIOS disk numbers and Linux devices, which is
tricky.  So the old code was gutted for 2.6.x, and now the kernel
simply reports the geometry as reported by the disk controller.
(Linux itself does not care about the geometry, because it does
everything in "linear" mode.)

This means partitions created under Linux are incompatible with
Windows, unless you get lucky and your BIOS uses (or can be configured
to use) the geometry reported by the controller.

Now, starting with 2.6.5 Linux actually invokes INT13/AH=08h during
real-mode startup and stashes the values away.  They are available via
Dell's EDD module.  So, to find the Windows-compatible geometry, you
simply:

  modprobe edd
  cat /sys/firmware/edd/int13_dev80/{legacy_heads,legacy_sectors}

(And add 1 to the "heads" value because the legacy BIOS interface is
freaky.)

There is just one catch.  This assumes BIOS device 80h (the boot
device) is the disk you care about.  If not, you need to figure out
which BIOS device corresponds to the disk you do care about.  This is
the hard part, but it is not THAT hard, because the /sys/firmware/edd
interface exposes lots of information which will help you deduce this
correspondence.  It exports the extended (controller) geometry, the
disk size, and the MBR signature (see
http://seclists.org/lists/linux-kernel/2004/Jan/5257.html).  For a
sufficiently modern (EDD 3.0) BIOS, it will even include the exact
information (PCI device etc.) identifying the disk.

This is not surprising, because the EDD module was specifically
designed with this mapping goal in mind; one of Dell's interests is
automatically finding the boot disk on systems with lots of drives.

So, if we write a decent library routine to map between BIOS device
numbers and Linux devices, then we will be finished, and everything
will work fine no matter which OS the user installs first.

 - Pat

  reply	other threads:[~2004-06-01 15:11 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-30 18:04 Jeff Garzik
2004-05-30 18:36 ` Andries Brouwer
2004-05-30 18:56   ` Jeff Garzik
2004-05-30 20:03     ` Andries Brouwer
2004-05-30 20:47       ` viro
2004-05-30 21:06         ` Andries Brouwer
2004-05-30 21:08         ` Andreas Schwab
2004-05-30 21:14           ` viro
2004-05-30 21:02       ` Patrick J. LoPresti
2004-05-30 22:20         ` Andries Brouwer
     [not found]           ` <mit.lcs.mail.linux-kernel/20040530222001.GD4681@apps.cwi.nl>
2004-05-30 22:54             ` Patrick J. LoPresti
2004-05-31 18:08         ` Tomas Szepe
2004-05-31 19:19           ` Frediano Ziglio
2004-05-31 20:06           ` Patrick J. LoPresti
2004-05-31 21:03             ` Sean Estabrooks
2004-06-01 15:10               ` Patrick J. LoPresti [this message]
2004-06-01 23:55                 ` Andries Brouwer
2004-06-02 13:02                   ` Patrick J. LoPresti
2004-06-02 15:00                     ` Matt Domsch
2004-06-02 21:22                       ` [PATCH] Better names for EDD legacy_* fields Patrick J. LoPresti
2004-06-02 23:03                         ` Andries Brouwer
2004-06-02 23:38                           ` Patrick J. LoPresti
2004-06-02 23:53                       ` [PATCH] Use decimal instead of hex for EDD values Patrick J. LoPresti
2004-06-01 16:28           ` 2.6.x partition breakage and dual booting Stephen Hemminger
2004-06-03  6:51           ` Frediano Ziglio
2004-06-03 10:39             ` Andries Brouwer
2004-06-03 12:30               ` Frediano Ziglio
2004-06-03 14:35                 ` Bartlomiej Zolnierkiewicz
2004-06-03 15:11                   ` Andries Brouwer
2004-06-03 14:46               ` Patrick J. LoPresti
2004-06-03 15:32                 ` Bartlomiej Zolnierkiewicz
2004-06-03 15:55                   ` Patrick J. LoPresti
2004-05-30 19:35 ` Patrick J. LoPresti

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='s5gfz9f2vok.fsf@patl=users.sf.net' \
    --to=patl@users.sourceforge.net \
    --cc=Andries.Brouwer@cwi.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=seanlkml@sympatico.ca \
    --cc=szepe@pinerecords.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®