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

John Baldwin jhb at freebsd.org
Thu Feb 6 19:22:16 UTC 2014


On Thursday, February 06, 2014 12:43:48 pm Yeong.Hun at freebsd.org, Jo wrote:
> 
> >Number:         186515
> >Category:       amd64
> >Synopsis:       Doesn't boot with GPT when # of entries over than 128.
> >Confidential:   no
> >Severity:       non-critical
> >Priority:       low
> >Responsible:    freebsd-amd64
> >State:          open
> >Quarter:        
> >Keywords:       
> >Date-Required:
> >Class:          sw-bug
> >Submitter-Id:   current-users
> >Arrival-Date:   Thu Feb 06 17:50:00 UTC 2014
> >Closed-Date:
> >Last-Modified:
> >Originator:     Yeong Hun, Jo
> >Release:        FreeBSD 10.0-RELEASE
> >Organization:
> -
> >Environment:
> FreeBSD localhost 10.0-RELEASE FreeBSD 10.0-RELEASE #0 r260789: Thu Jan 1 
22:34:59 UTC 2014     root at snap.freebsd.org:/usr/obj/usr/src/sys/GENERIC  
amd64
> >Description:
> I tried to making USB memory stick using GPT partition table scheme. I 
usually use 152 entries to aligning 4KB boundary for data disk(start location) 
and use 156 entries to aligning 4KB boundary for system disk(end location, 
misalignment of start location is used for boot code and make 4KB aligned root 
partition). I don't like that some "free" sectors on disk :-)
> 
> But, it failed to boot when partition entry count is adjusted to more than 
128.
> 
> * WORKS : 128 entries GPT(1st usable sector = 34) with freebsd-boot 
partition at sector 34, 40.
> 
> * DOESN'T WORK : 152 entries GPT(1st usable sector = 40) with freebsd-boot 
partition at sector 40, 156 entries GPT(1st usable sector = 41) with freebsd-
boot partition at sector 41.
> 
> 
> 
> Yes, There's no problem with default size GPT partition table. "128 entires" 
- minimum entry count by spec. - seems to be sufficient at most cases. But, 
that can be arbitrary size and should be supported even that cases. I think 
there's some issue on gpart or early-stage boot loader(/boot/pmbr).
> 
> >How-To-Repeat:
> * For example, USB disk is da0 here.
> 
> # gpart create -s gpt -n 152 da0
> # gpart add -t freebsd-boot -b 40 -s 32 -i 1 da0
> # gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 da0
> 
> and try to boot USB. It should be show "clockwise" loading screen even no 
freebsd-ufs partition on USB, but it doesn't show anything and reboot 
immediately. It(doesn't say anything and reboot) occurs with /boot populated 
freebsd-ufs partition, too.

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?

-- 
John Baldwin


More information about the freebsd-amd64 mailing list