Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Apr 2016 13:48:35 -0600 (MDT)
From:      Warren Block <wblock@wonkity.com>
To:        Boris Samorodov <bsam@passap.ru>
Cc:        =?ISO-8859-15?Q?Trond_Endrest=F8l?= <Trond.Endrestol@fagskolen.gjovik.no>,  FreeBSD stable <freebsd-stable@freebsd.org>
Subject:   Re: A gpart(8) mystery on 10.3-RELEASE
Message-ID:  <alpine.BSF.2.20.1604051335141.57361@wonkity.com>
In-Reply-To: <5703B0D5.5060701@passap.ru>
References:  <alpine.BSF.2.20.1604051125030.14591@mail.fig.ol.no> <5703B0D5.5060701@passap.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 5 Apr 2016, Boris Samorodov wrote:

> 05.04.16 12:30, Trond Endrestøl пишет:
>
>> What am I doing wrong? Can't gpart(8) write both the pmbr and the efi
>> image as a single command? Is it an off-by-one error in gpart(8)?
>>
>> gpart bootcode -b /boot/pmbr -p /boot/boot1.efifat -i 1 ada0
>> gpart: /boot/boot1.efifat: file too big (524288 limit)
>
> Do you try to get only UEFI boot? Then do not use "-b" option. It is
> needed for BIOS boot.
>
> Do you need to get a system with both UEFI and BIOS boot? Then use two
> different partitions for UEFI and BIOS booting schemes.
>
>> gpart bootcode -b /boot/pmbr ada0
>> bootcode written to ada0
>
> This is needed only for BIOS boot and together with "-p /boot/gptboot"
> option.

Well... bootcode -b only writes to the PMBR and does not take a 
partition number with -i.  So the short form version I use could be 
refused by a very strict option parser, requiring two separate steps:

   gpart bootcode -b /boot/pmbr ada0
   gpart bootcode -p /boot/gptboot -i1 ada0

The way it parses options when working on EFI partitions might be more 
strict.

Actually, the more I think about it, using bootcode -p to write the 
entire EFI partition seems dangerous.  Unless it is surprisingly smart, 
it will wipe out any existing stuff on that EFI partition, which could 
be any number of important things put there by other utilities or 
operating systems, including device drivers.

The safer way is to mount that partition and copy the boot1.efi file to 
it.
From owner-freebsd-stable@freebsd.org  Tue Apr  5 21:32:18 2016
Return-Path: <owner-freebsd-stable@freebsd.org>
Delivered-To: freebsd-stable@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74B8BB04EAC
 for <freebsd-stable@mailman.ysv.freebsd.org>;
 Tue,  5 Apr 2016 21:32:18 +0000 (UTC)
 (envelope-from killing@multiplay.co.uk)
Received: from mail-wm0-x232.google.com (mail-wm0-x232.google.com
 [IPv6:2a00:1450:400c:c09::232])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (Client CN "smtp.gmail.com",
 Issuer "Google Internet Authority G2" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 23F781DE3
 for <freebsd-stable@freebsd.org>; Tue,  5 Apr 2016 21:32:18 +0000 (UTC)
 (envelope-from killing@multiplay.co.uk)
Received: by mail-wm0-x232.google.com with SMTP id u206so20791612wme.1
 for <freebsd-stable@freebsd.org>; Tue, 05 Apr 2016 14:32:18 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=multiplay-co-uk.20150623.gappssmtp.com; s=20150623;
 h=subject:to:references:from:message-id:date:user-agent:mime-version
 :in-reply-to:content-transfer-encoding;
 bh=3e/VX+bxyfz3Q6k9Yb06RTdtt1eEpe2m3mJkUr5AkbI=;
 b=Fvtypwv8GBmqv7Rz6xZJ2Y0TvoCsqQnd0C9kJqkPCdwN+2sjKr03GSSgWfvcEtsvPU
 9Xv4d9yKu14d1NE3bNmjuod8OQXulZUGZ3qrKMNvSyjhgp1BUDHjRjRHUuzn/sFl7t4o
 vOahc8yJJO0Dqnv4qaB0tai1BcsIyplBecn4mtdMATfBCaWab9TstEIw5q6sn1fNKLIg
 gITJxx2LA+2KuZiv4yUv1c7ukFmExvjrKnDSxG9jgVxCq0sii9+n5CsgnEUzJPzY0mxW
 NRkEuYW83kgtXe104wcvDVxjtLuUXXieQhEJ8+5BwFqw1i1wczIH4MgjQ31N90ULlE8e
 bhPQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:subject:to:references:from:message-id:date
 :user-agent:mime-version:in-reply-to:content-transfer-encoding;
 bh=3e/VX+bxyfz3Q6k9Yb06RTdtt1eEpe2m3mJkUr5AkbI=;
 b=doZJeeRKFPUp/IH+4zjEJmqL8jsIXzqb1OhmI9CIKYUKxEpK1Jijq7DWSmLZxP88rx
 SBRnmLRIb4+8/PIPmRnPkVli0JLSKEp5NP5uOkmDHwPRxQHbTkATaXjLYwmhjPVvF2Gw
 Ks1D6i/B6VFsDqkDF2qu08PWcwpGSzQbU3JyA8YH2n9ux/EJcDG4il8NsLu2vciknaAX
 tpvU7RHSqi2ESCSOm/Pms0eGeT0Vjox+/HlQSf9NhMyUImKZ4SDUlUKjf+BPmpwcUy1X
 hUn8isQ1IANGtYtNk4TXluMUtoDddOX7ohpC3bkZZOZIEypsrsn+1NdIy+hDLcrXbALA
 Dn4w==
X-Gm-Message-State: AD7BkJLXH2cBKnjIZ7T9kX7G4iQ1pQgUQSuYrHcTXN1PNqyMjPnkrrhMnEb7fvVLfrNMTO7Q
X-Received: by 10.28.148.19 with SMTP id w19mr20303196wmd.10.1459891936784;
 Tue, 05 Apr 2016 14:32:16 -0700 (PDT)
Received: from [10.10.1.58] (liv3d.labs.multiplay.co.uk. [82.69.141.171])
 by smtp.gmail.com with ESMTPSA id i201sm208213wmf.23.2016.04.05.14.32.15
 for <freebsd-stable@freebsd.org> (version=TLSv1/SSLv3 cipher=OTHER);
 Tue, 05 Apr 2016 14:32:15 -0700 (PDT)
Subject: Re: A gpart(8) mystery on 10.3-RELEASE
To: freebsd-stable@freebsd.org
References: <alpine.BSF.2.20.1604051125030.14591@mail.fig.ol.no>
 <5703B0D5.5060701@passap.ru>
 <alpine.BSF.2.20.1604051335141.57361@wonkity.com>
From: Steven Hartland <killing@multiplay.co.uk>
Message-ID: <57042EE2.9030304@multiplay.co.uk>
Date: Tue, 5 Apr 2016 22:32:18 +0100
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101
 Thunderbird/38.7.0
MIME-Version: 1.0
In-Reply-To: <alpine.BSF.2.20.1604051335141.57361@wonkity.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
X-BeenThere: freebsd-stable@freebsd.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Production branch of FreeBSD source code <freebsd-stable.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/freebsd-stable>, 
 <mailto:freebsd-stable-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-stable/>;
List-Post: <mailto:freebsd-stable@freebsd.org>
List-Help: <mailto:freebsd-stable-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/freebsd-stable>,
 <mailto:freebsd-stable-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 05 Apr 2016 21:32:18 -0000



On 05/04/2016 20:48, Warren Block wrote:
> On Tue, 5 Apr 2016, Boris Samorodov wrote:
>
>> 05.04.16 12:30, Trond Endrestøl пишет:
>>
>>> What am I doing wrong? Can't gpart(8) write both the pmbr and the efi
>>> image as a single command? Is it an off-by-one error in gpart(8)?
>>>
>>> gpart bootcode -b /boot/pmbr -p /boot/boot1.efifat -i 1 ada0
>>> gpart: /boot/boot1.efifat: file too big (524288 limit)
>>
>> Do you try to get only UEFI boot? Then do not use "-b" option. It is
>> needed for BIOS boot.
>>
>> Do you need to get a system with both UEFI and BIOS boot? Then use two
>> different partitions for UEFI and BIOS booting schemes.
>>
>>> gpart bootcode -b /boot/pmbr ada0
>>> bootcode written to ada0
>>
>> This is needed only for BIOS boot and together with "-p /boot/gptboot"
>> option.
>
> Well... bootcode -b only writes to the PMBR and does not take a 
> partition number with -i.  So the short form version I use could be 
> refused by a very strict option parser, requiring two separate steps:
>
>   gpart bootcode -b /boot/pmbr ada0
>   gpart bootcode -p /boot/gptboot -i1 ada0
>
> The way it parses options when working on EFI partitions might be more 
> strict.
>
> Actually, the more I think about it, using bootcode -p to write the 
> entire EFI partition seems dangerous.  Unless it is surprisingly 
> smart, it will wipe out any existing stuff on that EFI partition, 
> which could be any number of important things put there by other 
> utilities or operating systems, including device drivers.
>
> The safer way is to mount that partition and copy the boot1.efi file 
> to it.
Pretty sure that's not done as you cant guarantee fat support is available.

     Regards
     Steve



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.20.1604051335141.57361>