Bug 186515 - [gptboot] Doesn't boot with GPT when # of entries over than 128.
Summary: [gptboot] Doesn't boot with GPT when # of entries over than 128.
Status: Closed DUPLICATE of bug 175086
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 10.0-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-fs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-06 17:50 UTC by Yeong.Hun, Jo
Modified: 2015-12-10 10:48 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yeong.Hun, Jo 2014-02-06 17:50:00 UTC
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.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2014-02-06 17:54:43 UTC
Responsible Changed
From-To: freebsd-amd64->freebsd-fs

reclassify.
Comment 2 John Baldwin freebsd_committer freebsd_triage 2014-02-06 18:41:04 UTC
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
Comment 3 Yeong.Hun, Jo 2014-02-08 00:07:43 UTC
That's right. Actually there's no any differences - between "free" sectors
to "empty entries". In most cases 128 entries will be sufficient I said
before. And I know that's not preferred way to align partitions. But, GRUB2
works even that cases. Of course that isn't GNU extension. Because of
there's no any differences except total entry count, I think it should be
work.

I think there's some problem loading freebsd-boot partition. When I
selected USB stick at boot menu, I can't see anything except black screen
and it reboots immediately. If it boots correctly, it should display
loading screen - rotating animation - and (if freebsd-ufs partition exists
and /boot populated) Greeting message such as "BTX Loader 1.00 BTX Version
is 1.02", then "Welcome to FreeBSD". I checked that behavior with work
cases(128 entries, different boot partition's start location), and I found
that it should display "rotating animation" even there's not exist
later-step bootloader files in /boot; In that case, it automatically
reboots after shows that animation because there's no freebsd-ufs partition.



* I'm first use of FreeBSD's bug reporting system and it causes some
confusion to me. I replied same mail to John, but not bug-followup system
and I guess it is what my reply doesn't seen on bug tracking system. I hope
that send reply mail to this address is right...
Comment 4 Andrey V. Elsukov freebsd_committer freebsd_triage 2015-12-10 10:48:36 UTC

*** This bug has been marked as a duplicate of bug 175086 ***