From owner-freebsd-current@FreeBSD.ORG Tue Jul 15 19:15:55 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0FE0E5B0; Tue, 15 Jul 2014 19:15:55 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC25B29D9; Tue, 15 Jul 2014 19:15:54 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id D5D24B923; Tue, 15 Jul 2014 15:15:52 -0400 (EDT) From: John Baldwin To: freebsd-current@freebsd.org Subject: Re: Boot loader too large Date: Tue, 15 Jul 2014 13:05:32 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20140415; KDE/4.5.5; amd64; ; ) References: <53C06780.8010702@freebsd.org> <20140711225043.GH50976@over-yonder.net> In-Reply-To: <20140711225043.GH50976@over-yonder.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201407151305.32820.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 15 Jul 2014 15:15:52 -0400 (EDT) Cc: Nathan Whitehorn , "Matthew D. Fuller" X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jul 2014 19:15:55 -0000 On Friday, July 11, 2014 6:50:43 pm Matthew D. Fuller wrote: > On Fri, Jul 11, 2014 at 03:38:56PM -0700 I heard the voice of > Nathan Whitehorn, and lo! it spake thus: > > > > I don't honestly remember where that number came from. It's at line > > 72 of usr.sbin/bsdinstall/partedit/partedit_x86.c. If 128 works > > better, I'm happy to change it, but it would be nice to know what > > the actual bounds here are before putting in a new arbitrary number. > > src/sys/boot/i386/pmbr/pmbr.s says > > ------------- > next_boot:. incl (%si). . . # Next LBA > . . adcl $0,4(%si) > . . mov %es,%ax. . . # Adjust segment for next > . . addw $SECSIZE/16,%ax. . # sector > . . cmp $0x9000,%ax.. . # Don't load past 0x90000, > . . jae err_big. . . # 545k should be enough for > . . mov %ax,%es. . . # any boot code. :) > ------------- > > (err_big being printing the "Boot loader too large" message). Though > 0x90000 is actually 576k, not 545, but presumably there's some other > adjustment lopping off bits somewhere; that's 62 sectors diff. The boot code is not loaded at offset 0, it is loaded at offset 0x7c00 (the same address the BIOS loads boot loaders): .set LOAD,0x7c00 # Load address ... # # We found a boot partition. Load it into RAM starting at 0x7c00. # movw %bx,%di # Save partition pointer in %di leaw PART_START_LBA(%di),%si movw $LOAD/16,%bx > Regardless, I settled on 512k for my boot partitions (after finding > the above error when I previously decided "it's a few dozen k, I'll > just set aside a meg to be safe" and then discovered the whole > "not-booting" thing that caused. 512k should be fine even if it is a bit excessive. Also, larger partitions might actually increase boot time, but perhaps not noticably. -- John Baldwin