From owner-freebsd-fs@FreeBSD.ORG Fri Aug 10 01:14:13 2012 Return-Path: Delivered-To: freebsd-fs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 548C4106564A; Fri, 10 Aug 2012 01:14:13 +0000 (UTC) (envelope-from lstewart@freebsd.org) Received: from lauren.room52.net (lauren.room52.net [210.50.193.198]) by mx1.freebsd.org (Postfix) with ESMTP id 0D7248FC0A; Fri, 10 Aug 2012 01:14:12 +0000 (UTC) Received: from lstewart1.loshell.room52.net (ppp59-167-184-191.static.internode.on.net [59.167.184.191]) by lauren.room52.net (Postfix) with ESMTPSA id 1C6DF7E820; Fri, 10 Aug 2012 11:14:11 +1000 (EST) Message-ID: <50246063.2080604@freebsd.org> Date: Fri, 10 Aug 2012 11:14:11 +1000 From: Lawrence Stewart User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:13.0) Gecko/20120613 Thunderbird/13.0 MIME-Version: 1.0 To: "Andrey V. Elsukov" References: <50237B73.9040301@freebsd.org> <5023979B.4010903@yandex.ru> <5023A907.7060800@freebsd.org> <5023C723.90606@FreeBSD.org> In-Reply-To: <5023C723.90606@FreeBSD.org> Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=unavailable version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on lauren.room52.net Cc: "freebsd-fs@freebsd.org" , Marcel Moolenaar Subject: Re: gpart rewrites pmbr in a way which breaks Win 7 EFI bootloader X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Aug 2012 01:14:13 -0000 On 08/10/12 00:20, Andrey V. Elsukov wrote: > On 09.08.2012 16:11, Lawrence Stewart wrote: >>>> - Should gpart be writing 0x80 (active) in the protective MBR entry? >>> >>> AFAIK, this was added because some BIOS could not boot without it. >> >> Makes sense if gpart is writing the pmbr out i.e. "gpart bootcode -b >> /boot/pmbr ", but manipulating an existing pmbr for a GPT specific >> subcommand smells dodgy to me. > > When you create GPT it already has PMBR, because it is part of GPT > metadata. gpart's `bootcode' subcommand writes *bootcode* to specific > area in the PMBR. Right, I had a fundamental misunderstanding about the relationship between the pmbr and GPT. Thanks to you and Marcel for setting me straight on this. >>>> - Why is Windows EFI bootloader so sensitive to 0x80 in pmbr? >>> >>> This question you should ask to the Microsoft. :) >> >> Perhaps I should rephrase my question as: >> >> Is the MS bootloader's behaviour reasonable/unreasonable based on what >> people know of the relevant specs? My current guess why it behaves like >> this is that if it sees an MBR partition marked active, it simply >> assumes another OS is in charge and therefore bails out at the Windows >> EFI boot stage. > > In the EFI system partition might be several boot loaders, and this MS > bootloader's behaviour seems strange to me. > >> Can and should are two different things. I would argue it's a POLA >> violation at the very least to manipulate the pmbr when the user asked >> for something else. I certainly started my hunting expecting to find the >> GPT changing in some subtle way when FreeBSD wrote it out compared to >> what Windows writes. >> >> We have a specific gpart command to put a pmbr in place so I think it's >> reasonable to expect other GPT specific commands not to fiddle with the >> pmbr. > > Don't confuse bootcode in the PMBR and PMBR. Despite my misunderstanding about the relationship between the pmbr and GPT, I still stand by my assertion that gpart is not behaving very well here, but more on that in my follow up to Marcel. Cheers, Lawrence