From 3a78b546700baf1311a023d34d5a03d2b88b836c Mon Sep 17 00:00:00 2001 From: Kris Moore Date: Tue, 21 Oct 2014 15:24:01 +0000 Subject: [PATCH] - Update to latest git pull - 2.02_3 - Add support for GELI passphrase kernel passthrough - Patch grub-install / EFI support to disable trying to use Linux 'efibootmgr' --- sysutils/grub2-pcbsd/Makefile | 4 +- sysutils/grub2-pcbsd/distinfo | 4 +- .../files/patch-grub-core_disk_geli.c | 12 ++- .../files/patch-grub-core_fs_zfs_zfs.c | 2 +- .../patch-grub-core_osdep_unix-platform.c | 100 ++++++++++++++++++ 5 files changed, 116 insertions(+), 6 deletions(-) create mode 100644 sysutils/grub2-pcbsd/files/patch-grub-core_osdep_unix-platform.c diff --git a/sysutils/grub2-pcbsd/Makefile b/sysutils/grub2-pcbsd/Makefile index 8c697e138a19..b60c10b1f515 100644 --- a/sysutils/grub2-pcbsd/Makefile +++ b/sysutils/grub2-pcbsd/Makefile @@ -3,11 +3,11 @@ PORTNAME= grub2-pcbsd PORTVERSION= 2.02p -PORTREVISION= 7 +PORTREVISION= 8 CATEGORIES= sysutils MASTER_SITES= http://www.pcbsd.org/~kris/software/ \ ftp://ftp.pcbsd.org/pub/software/ -DISTNAME= grub-2.02_2 +DISTNAME= grub-2.02_3 MAINTAINER= kmoore@FreeBSD.org COMMENT= Multiboot boot loader diff --git a/sysutils/grub2-pcbsd/distinfo b/sysutils/grub2-pcbsd/distinfo index 2a0a3191c5cf..b24b8a68c633 100644 --- a/sysutils/grub2-pcbsd/distinfo +++ b/sysutils/grub2-pcbsd/distinfo @@ -1,2 +1,2 @@ -SHA256 (grub-2.02_2.tar.xz) = 6cc58fa5629e47a512b416810caf148f3659b039d2080fbd0b6b8c9c82958aab -SIZE (grub-2.02_2.tar.xz) = 4463684 +SHA256 (grub-2.02_3.tar.xz) = 207b1d065f4ef18c77061c047b591a9cd2c946f5c320bdbf0fd48f41e02e4711 +SIZE (grub-2.02_3.tar.xz) = 4466580 diff --git a/sysutils/grub2-pcbsd/files/patch-grub-core_disk_geli.c b/sysutils/grub2-pcbsd/files/patch-grub-core_disk_geli.c index 57bf25f10e33..533533e6529c 100644 --- a/sysutils/grub2-pcbsd/files/patch-grub-core_disk_geli.c +++ b/sysutils/grub2-pcbsd/files/patch-grub-core_disk_geli.c @@ -1,5 +1,5 @@ --- grub-core/disk/geli.c.orig 2014-05-15 14:00:10.000000000 -0400 -+++ grub-core/disk/geli.c 2014-05-20 14:46:07.604565349 -0400 ++++ grub-core/disk/geli.c 2014-09-26 10:18:53.325111693 -0400 @@ -225,7 +225,7 @@ /* Look for GELI magic sequence. */ @@ -18,3 +18,13 @@ || grub_le_to_cpu32 (header.version) < 1) { grub_dprintf ("geli", "wrong magic %02x\n", header.magic[0]); +@@ -430,6 +430,9 @@ + if (!grub_password_get (passphrase, MAX_PASSPHRASE)) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "Passphrase not supplied"); + ++ /* Set the GELI passphrase to GRUB env, for passing to FreeBSD kernel */ ++ grub_env_set ("gelipassphrase", passphrase); ++ + /* Calculate the PBKDF2 of the user supplied passphrase. */ + if (grub_le_to_cpu32 (header.niter) != 0) + { diff --git a/sysutils/grub2-pcbsd/files/patch-grub-core_fs_zfs_zfs.c b/sysutils/grub2-pcbsd/files/patch-grub-core_fs_zfs_zfs.c index c514f9fb2349..f89ae15dece3 100644 --- a/sysutils/grub2-pcbsd/files/patch-grub-core_fs_zfs_zfs.c +++ b/sysutils/grub2-pcbsd/files/patch-grub-core_fs_zfs_zfs.c @@ -5,7 +5,7 @@ #define MAX_SUPPORTED_FEATURE_STRLEN 50 static const char *spa_feature_names[] = { - "org.illumos:lz4_compress",NULL -+ "org.illumos:lz4_compress","com.delphix:hole_birth",NULL ++ "org.illumos:lz4_compress","com.delphix:hole_birth","com.delphix:extensible_dataset","com.delphix:embedded_data",NULL }; static int diff --git a/sysutils/grub2-pcbsd/files/patch-grub-core_osdep_unix-platform.c b/sysutils/grub2-pcbsd/files/patch-grub-core_osdep_unix-platform.c new file mode 100644 index 000000000000..6373fe43987a --- /dev/null +++ b/sysutils/grub2-pcbsd/files/patch-grub-core_osdep_unix-platform.c @@ -0,0 +1,100 @@ +--- grub-core/osdep/unix/platform.c.orig 2014-10-21 10:55:38.203922144 -0400 ++++ grub-core/osdep/unix/platform.c 2014-10-21 10:56:54.300915974 -0400 +@@ -81,52 +81,8 @@ + static void + grub_install_remove_efi_entries_by_distributor (const char *efi_distributor) + { +- int fd; +- pid_t pid = grub_util_exec_pipe ((const char * []){ "efibootmgr", NULL }, &fd); +- char *line = NULL; +- size_t len = 0; +- +- if (!pid) +- { +- grub_util_warn (_("Unable to open stream from %s: %s"), +- "efibootmgr", strerror (errno)); +- return; +- } +- +- FILE *fp = fdopen (fd, "r"); +- if (!fp) +- { +- grub_util_warn (_("Unable to open stream from %s: %s"), +- "efibootmgr", strerror (errno)); +- return; +- } +- +- line = xmalloc (80); +- len = 80; +- while (1) +- { +- int ret; +- char *bootnum; +- ret = getline (&line, &len, fp); +- if (ret == -1) +- break; +- if (grub_memcmp (line, "Boot", sizeof ("Boot") - 1) != 0 +- || line[sizeof ("Boot") - 1] < '0' +- || line[sizeof ("Boot") - 1] > '9') +- continue; +- if (!strcasestr (line, efi_distributor)) +- continue; +- bootnum = line + sizeof ("Boot") - 1; +- bootnum[4] = '\0'; +- if (!verbosity) +- grub_util_exec ((const char * []){ "efibootmgr", "-q", +- "-b", bootnum, "-B", NULL }); +- else +- grub_util_exec ((const char * []){ "efibootmgr", +- "-b", bootnum, "-B", NULL }); +- } +- +- free (line); ++ // We don't have efibootmgr on FreeBSD, have to set externally ++ return; + } + + void +@@ -134,40 +90,8 @@ + const char *efifile_path, + const char *efi_distributor) + { +- const char * efidir_disk; +- int efidir_part; +- efidir_disk = grub_util_biosdisk_get_osdev (efidir_grub_dev->disk); +- efidir_part = efidir_grub_dev->disk->partition ? efidir_grub_dev->disk->partition->number + 1 : 1; +- +- if (grub_util_exec_redirect_null ((const char * []){ "efibootmgr", "--version", NULL })) +- { +- /* TRANSLATORS: This message is shown when required executable `%s' +- isn't found. */ +- grub_util_error (_("%s: not found"), "efibootmgr"); +- } +- +- /* On Linux, we need the efivars kernel modules. */ +-#ifdef __linux__ +- grub_util_exec ((const char * []){ "modprobe", "-q", "efivars", NULL }); +-#endif +- /* Delete old entries from the same distributor. */ +- grub_install_remove_efi_entries_by_distributor (efi_distributor); +- +- char *efidir_part_str = xasprintf ("%d", efidir_part); +- +- if (!verbosity) +- grub_util_exec ((const char * []){ "efibootmgr", "-q", +- "-c", "-d", efidir_disk, +- "-p", efidir_part_str, "-w", +- "-L", efi_distributor, "-l", +- efifile_path, NULL }); +- else +- grub_util_exec ((const char * []){ "efibootmgr", +- "-c", "-d", efidir_disk, +- "-p", efidir_part_str, "-w", +- "-L", efi_distributor, "-l", +- efifile_path, NULL }); +- free (efidir_part_str); ++ // We don't have efibootmgr on FreeBSD, have to set externally ++ return; + } + + void