aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils
diff options
context:
space:
mode:
authorpgollucci <pgollucci@FreeBSD.org>2010-12-12 09:11:24 +0800
committerpgollucci <pgollucci@FreeBSD.org>2010-12-12 09:11:24 +0800
commit014136507466f9337a26d5f2c7dcf4be25fd9b27 (patch)
treed5d9cf7a7d5aa85bd29cbc95c48f921d392cb4f6 /sysutils
parente07d91a80aa15d3e4f9ce1020aa3e7e715ad3f6d (diff)
downloadfreebsd-ports-gnome-014136507466f9337a26d5f2c7dcf4be25fd9b27.tar.gz
freebsd-ports-gnome-014136507466f9337a26d5f2c7dcf4be25fd9b27.tar.zst
freebsd-ports-gnome-014136507466f9337a26d5f2c7dcf4be25fd9b27.zip
- Allow grub to recognize bsdlabel disklabels.
- Bump PORTREVISION PR: ports/152978 Submitted by: Rick Richard <rick@lgarchitecture.com> (maintainer)
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/grub2/Makefile1
-rw-r--r--sysutils/grub2/files/patch-bsd-partmap47
2 files changed, 48 insertions, 0 deletions
diff --git a/sysutils/grub2/Makefile b/sysutils/grub2/Makefile
index 0bea68c2605f..77c900865778 100644
--- a/sysutils/grub2/Makefile
+++ b/sysutils/grub2/Makefile
@@ -7,6 +7,7 @@
PORTNAME= grub2
PORTVERSION= 1.98
+PORTREVISION= 1
CATEGORIES= sysutils
MASTER_SITES= ftp://alpha.gnu.org/gnu/grub/
DISTNAME= grub-${PORTVERSION}
diff --git a/sysutils/grub2/files/patch-bsd-partmap b/sysutils/grub2/files/patch-bsd-partmap
new file mode 100644
index 000000000000..563e61005149
--- /dev/null
+++ b/sysutils/grub2/files/patch-bsd-partmap
@@ -0,0 +1,47 @@
+--- include/grub/msdos_partition.h 2010-03-06 20:51:37.000000000 +0000
++++ include/grub/msdos_partition.h 2010-11-17 18:22:29.000000000 +0000
+@@ -57,6 +57,7 @@
+ #define GRUB_PC_PARTITION_BSD_LABEL_SECTOR 1
+ #define GRUB_PC_PARTITION_BSD_LABEL_MAGIC 0x82564557
+ #define GRUB_PC_PARTITION_BSD_MAX_ENTRIES 8
++#define GRUB_PC_PARTITION_BSD_RAW_PART 2
+
+ /* BSD partition types. */
+ #define GRUB_PC_PARTITION_BSD_TYPE_UNUSED 0
+--- partmap/msdos.c 2010-03-06 20:51:37.000000000 +0000
++++ partmap/msdos.c 2010-11-17 18:26:26.000000000 +0000
+@@ -176,6 +176,8 @@
+ /* Check if this is a BSD partition. */
+ if (grub_msdos_partition_is_bsd (e->type))
+ {
++ grub_uint32_t slice_offset = 0, raw_offset = 0;
++
+ /* Check if the BSD label is within the DOS partition. */
+ if (p.len <= GRUB_PC_PARTITION_BSD_LABEL_SECTOR)
+ {
+@@ -200,6 +202,15 @@
+ label.magic, p.index);
+ continue;
+ }
++
++ /* Compensate for relative addressing in FreeBSD. */
++ if (e->type == GRUB_PC_PARTITION_TYPE_FREEBSD
++ && GRUB_PC_PARTITION_BSD_RAW_PART < grub_cpu_to_le16 (label.num_partitions))
++ {
++ slice_offset = p.start;
++ raw_offset = grub_le_to_cpu32 (label.entries[GRUB_PC_PARTITION_BSD_RAW_PART].offset);
++ }
++
+ for (pcdata.bsd_part = 0;
+ pcdata.bsd_part < grub_cpu_to_le16 (label.num_partitions);
+ pcdata.bsd_part++)
+@@ -207,7 +218,9 @@
+ struct grub_msdos_partition_bsd_entry *be
+ = label.entries + pcdata.bsd_part;
+
++ if (grub_le_to_cpu32 (be->offset) < raw_offset)
++ continue;
+- p.start = grub_le_to_cpu32 (be->offset);
++ p.start = grub_le_to_cpu32 (be->offset) - raw_offset + slice_offset;
+ p.len = grub_le_to_cpu32 (be->size);
+ pcdata.bsd_type = be->fs_type;