Date: Fri, 7 Feb 2014 12:18:19 -0500 From: John Baldwin <jhb@freebsd.org> To: Warren Block <wblock@wonkity.com> Cc: freebsd-fs@freebsd.org Subject: Re: amd64/186515: Doesn't boot with GPT when # of entries over than 128. Message-ID: <201402071218.19221.jhb@freebsd.org> In-Reply-To: <alpine.BSF.2.00.1402070907440.5476@wonkity.com> References: <201402061930.s16JU2Pi052495@freefall.freebsd.org> <52F4D4C9.3060902@yandex.ru> <alpine.BSF.2.00.1402070907440.5476@wonkity.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Friday, February 07, 2014 11:24:43 am Warren Block wrote:
> On Fri, 7 Feb 2014, Andrey V. Elsukov wrote:
>
> > On 06.02.2014 23:30, John Baldwin wrote:
> >> Using more entries to pad out the table isn't the normal way to handle 4k
> >> alignment. You can just leave a gap before the start of freebsd-boot. Having
> >> the sectors "free" vs having them contain zero'd GPT entries doesn't really
> >> make a difference. One question is when does the boot break? Does it make it
> >> into the loader and break trying to boot the kernel? Does it make it into
> >> gptboot and break trying to load the loader?
> >
> > Hi John,
> >
> > this is gptboot's restriction. Look at the sys/boot/common/gpt.c.
>
> It is mentioned at the start of gptboot(8) under Implementation Notes,
> too.
>
> Alignment of freebsd-boot is usually not very important. It is only
> rarely written, and the bootcode is so small that it will probably not
> take appreciably longer to read or write even when misaligned.
> Filesystem partitions are where alignment really matters.
We could at least emit an error message when this happens instead of blowing up.
Ah, I think the problem is that gptboot tries to return from main() which it
shouldn't do. This was introduced a while ago when the GPT code was
rototilled. See if this patch forces an error and then drops to a prompt
rather than a silent reboot:
Index: sys/boot/i386/gptboot/gptboot.c
===================================================================
--- sys/boot/i386/gptboot/gptboot.c (revision 261528)
+++ sys/boot/i386/gptboot/gptboot.c (working copy)
@@ -156,7 +156,7 @@
/* Process configuration file */
if (gptinit() != 0)
- return (-1);
+ goto prompt;
autoboot = 1;
*cmd = '\0';
@@ -204,6 +204,7 @@
/* Present the user with the boot2 prompt. */
+prompt:
for (;;) {
if (!OPT_CHECK(RBX_QUIET)) {
printf("\nFreeBSD/x86 boot\n"
--
John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201402071218.19221.jhb>
