amd64/186515: Doesn't boot with GPT when # of entries over than 128.

John Baldwin jhb at freebsd.org
Fri Feb 7 17:18:33 UTC 2014


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


More information about the freebsd-fs mailing list