grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 0/1] osdep/freebsd: Fix partition calculation for EBR entries


From: Colin Watson
Subject: [PATCH v2 0/1] osdep/freebsd: Fix partition calculation for EBR entries
Date: Tue, 26 Feb 2019 18:39:46 +0000
User-agent: NeoMutt/20170113 (1.7.2)

Here's a patch from James Clarke to fix a FreeBSD partition calculation
bug, originally sent to https://bugs.debian.org/923253; I've only
reformatted the commit message slightly.

On FreeBSD, grub uses the "start" rather than the "offset" config
property to calculate the starting sector for partitions, which gives
the wrong value for EBR partitions:

> address@hidden:/home/jrtc27/src/grub2/grub2-2.02+dfsg1# geom part list
> (output trimmed and annotated)
> Geom name: ada0
> scheme: MBR
> Providers:
> 1. Name: ada0s1
>    offset: 1048576 # ie 2048 sectors
>    start: 2048
> 2. Name: ada0s2
>    offset: 64000883712 # ie 125001726 sectors
>    start: 125001726
>
> Geom name: ada0s2
> scheme: EBR
> Providers:
> 1. Name: ada0s5
>    offset: 1024 # ie 2 sectors; add 125001726 from ada0s2 to get 125001728
>    start: 0
> 2. Name: ada0s6
>    offset: 183628727296 # ie 358649858 sectors; add 125001726 from ada0s2 to 
> get 483651584
>    start: 358647810 # add 125001726 from ada0s2 to get 483649536
> address@hidden:~# fdisk -l /dev/ada0
> Disk /dev/ada0: 238.5 GiB, 256060514304 bytes, 500118192 sectors
> Units: sectors of 1 * 512 = 512 bytes
> Sector size (logical/physical): 512 bytes / 512 bytes
> I/O size (minimum/optimal): 512 bytes / 512 bytes
> Disklabel type: dos
> Disk identifier: 0x20b8cc40
>
> Device      Boot     Start       End   Sectors   Size Id Type
> /dev/ada0p1 *         2048 124999679 124997632  59.6G 83 Linux
> /dev/ada0p2      125001726 500117503 375115778 178.9G  5 Extended
> /dev/ada0p5      125001728 483649535 358647808   171G a5 FreeBSD
> /dev/ada0p6      483651584 500117503  16465920   7.9G 82 Linux swap / Solaris

This clearly shows that the "start" field is wrong and "offset" should
be used instead. The attached patch does this and has been tested on the
above system.

[v2: James sent a more concise commit message with their patch, which I
overlooked first time round; so this time the cover letter has the bug
description and the patch itself has that commit message.]

James Clarke (1):
  osdep/freebsd: Fix partition calculation for EBR entries

 grub-core/osdep/freebsd/getroot.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

-- 
2.20.1



reply via email to

[Prev in Thread] Current Thread [Next in Thread]