From owner-freebsd-stable@freebsd.org Tue Apr 5 19:50:13 2016 Return-Path: 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 4129CB04FDA for ; Tue, 5 Apr 2016 19:50:13 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (wonkity.com [67.158.26.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "wonkity.com", Issuer "wonkity.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id E96621AF8 for ; Tue, 5 Apr 2016 19:50:12 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.15.2/8.15.2) with ESMTPS id u35JmaLX012227 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 5 Apr 2016 13:48:36 -0600 (MDT) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.15.2/8.15.2/Submit) with ESMTP id u35JmZl2012224; Tue, 5 Apr 2016 13:48:36 -0600 (MDT) (envelope-from wblock@wonkity.com) Date: Tue, 5 Apr 2016 13:48:35 -0600 (MDT) From: Warren Block To: Boris Samorodov cc: =?ISO-8859-15?Q?Trond_Endrest=F8l?= , FreeBSD stable Subject: Re: A gpart(8) mystery on 10.3-RELEASE In-Reply-To: <5703B0D5.5060701@passap.ru> Message-ID: References: <5703B0D5.5060701@passap.ru> User-Agent: Alpine 2.20 (BSF 67 2015-01-07) MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (wonkity.com [127.0.0.1]); Tue, 05 Apr 2016 13:48:36 -0600 (MDT) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8BIT X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 19:50:13 -0000 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: 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 ; 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 ; 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 ; 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 (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: <5703B0D5.5060701@passap.ru> From: Steven Hartland 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: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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