svn commit: r388791 - in head/sysutils/grub2-pcbsd: . files

Kris Moore kmoore at FreeBSD.org
Sun Jun 7 22:38:37 UTC 2015


Author: kmoore
Date: Sun Jun  7 22:38:33 2015
New Revision: 388791
URL: https://svnweb.freebsd.org/changeset/ports/388791

Log:
  Opps, forgot to delete/add some of the updated patches in files/

Added:
  head/sysutils/grub2-pcbsd/files/patch-grub-core_lib_libgcrypt_src_types.h   (contents, props changed)
  head/sysutils/grub2-pcbsd/files/patch-grub-core_osdep_freebsd_getroot.c   (contents, props changed)
  head/sysutils/grub2-pcbsd/files/patch-grub-core_osdep_unix_getroot.c   (contents, props changed)
  head/sysutils/grub2-pcbsd/files/patch-grub-core_osdep_unix_platform.c   (contents, props changed)
  head/sysutils/grub2-pcbsd/files/patch-include_grub_emu_getroot.h   (contents, props changed)
  head/sysutils/grub2-pcbsd/files/patch-include_grub_gpt__partition.h   (contents, props changed)
  head/sysutils/grub2-pcbsd/files/patch-po_LINGUAS   (contents, props changed)
  head/sysutils/grub2-pcbsd/files/patch-util_grub-install.c   (contents, props changed)
  head/sysutils/grub2-pcbsd/files/patch-util_grub-mkconfig__lib.in   (contents, props changed)
  head/sysutils/grub2-pcbsd/files/patch-util_grub-probe.c   (contents, props changed)
Deleted:
  head/sysutils/grub2-pcbsd/files/patch-geom-label-support
  head/sysutils/grub2-pcbsd/files/patch-grub-core_disk_geli.c
  head/sysutils/grub2-pcbsd/files/patch-include_grub_gpt_partition.h
  head/sysutils/grub2-pcbsd/files/patch-util_grub-mkconfig_lib.in
  head/sysutils/grub2-pcbsd/pkg-install

Added: head/sysutils/grub2-pcbsd/files/patch-grub-core_lib_libgcrypt_src_types.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/grub2-pcbsd/files/patch-grub-core_lib_libgcrypt_src_types.h	Sun Jun  7 22:38:33 2015	(r388791)
@@ -0,0 +1,11 @@
+--- grub-core/lib/libgcrypt/src/types.h.orig	2014-03-03 16:00:26 UTC
++++ grub-core/lib/libgcrypt/src/types.h
+@@ -113,6 +113,8 @@
+ #endif
+ #endif
+ 
++typedef uint64_t u64;
++
+ typedef union {
+     int a;
+     short b;

Added: head/sysutils/grub2-pcbsd/files/patch-grub-core_osdep_freebsd_getroot.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/grub2-pcbsd/files/patch-grub-core_osdep_freebsd_getroot.c	Sun Jun  7 22:38:33 2015	(r388791)
@@ -0,0 +1,108 @@
+--- grub-core/osdep/freebsd/getroot.c.orig	2015-01-23 02:27:45 UTC
++++ grub-core/osdep/freebsd/getroot.c
+@@ -296,6 +296,105 @@ grub_util_get_grub_dev_os (const char *o
+   return grub_dev;
+ }
+ 
++int grub_util_check_geom_label(const char *name)
++{
++  struct gmesh mesh;
++  struct gclass *class;
++  struct ggeom *geom;
++  struct gprovider *pp;
++  struct gprovider *pplabel;
++  struct gconsumer *cp;
++  const char *geom_name;
++  const char *test_name;
++  int err;
++
++  err = geom_gettree (&mesh);
++  if (err != 0)
++    grub_util_error ("%s", _("couldn't open geom"));
++
++  LIST_FOREACH (class, &mesh.lg_class, lg_class)
++    if (strcasecmp (class->lg_name, "label") == 0)
++      break;
++  if (!class)
++    grub_util_error ("%s", _("couldn't find geom `label' class"));
++
++  if (strncmp (name, "/dev/", sizeof ("/dev/") - 1) == 0)
++    test_name = name + sizeof ("/dev/") - 1;
++  else
++    test_name = name;
++
++  LIST_FOREACH (geom, &class->lg_geom, lg_geom)
++    {
++     LIST_FOREACH(pp, &geom->lg_provider, lg_provider)
++       {
++         geom_name = pp->lg_name;
++         if (strcasecmp (geom_name, test_name) != 0)
++           continue;
++
++         LIST_FOREACH(cp, &geom->lg_consumer, lg_consumer)
++           {
++             pplabel = cp->lg_provider;
++             if (pplabel == NULL)
++               continue;
++	     return 1;
++           }
++        }
++    }
++  return 0;
++}
++
++const char *
++grub_util_convert_geom_label_to_dev (const char *name, int *full_path)
++{
++  struct gmesh mesh;
++  struct gclass *class;
++  struct ggeom *geom;
++  struct gprovider *pp;
++  struct gprovider *pplabel;
++  struct gconsumer *cp;
++  static char buf[256];
++  const char *geom_name;
++  int err;
++
++  grub_util_info ("Converting label '%s' to device", name);
++
++  err = geom_gettree (&mesh);
++  if (err != 0)
++    grub_util_error ("%s", _("couldn't open geom"));
++
++  LIST_FOREACH (class, &mesh.lg_class, lg_class)
++    if (strcasecmp (class->lg_name, "label") == 0)
++      break;
++  if (!class)
++    grub_util_error ("%s", _("couldn't find geom `label' class"));
++
++
++  LIST_FOREACH (geom, &class->lg_geom, lg_geom)
++    {
++     LIST_FOREACH(pp, &geom->lg_provider, lg_provider)
++       {
++         geom_name = pp->lg_name;
++         if (strcasecmp (geom_name, name) != 0)
++           continue;
++
++         LIST_FOREACH(cp, &geom->lg_consumer, lg_consumer)
++           {
++             pplabel = cp->lg_provider;
++             if (pplabel == NULL)
++               continue;
++
++             if ( full_path )
++               snprintf(buf, sizeof(buf), "/dev/%s", pplabel->lg_name);
++             else
++               snprintf(buf, sizeof(buf), "%s", pplabel->lg_name);
++	     return buf;
++           }
++        }
++    }
++  grub_util_error ("%s", _("couldn't convert gptid to real device name"));
++  return 0;
++}
++
+ /* FIXME: geom actually gives us the whole container hierarchy.
+    It can be used more efficiently than this.  */
+ void

Added: head/sysutils/grub2-pcbsd/files/patch-grub-core_osdep_unix_getroot.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/grub2-pcbsd/files/patch-grub-core_osdep_unix_getroot.c	Sun Jun  7 22:38:33 2015	(r388791)
@@ -0,0 +1,15 @@
+--- grub-core/osdep/unix/getroot.c.orig	2015-06-03 14:54:01 UTC
++++ grub-core/osdep/unix/getroot.c
+@@ -507,6 +507,12 @@ grub_guess_root_devices (const char *dir
+   if (!os_dev)
+     os_dev = find_root_devices_from_libzfs (dir);
+ 
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
++  if (os_dev)
++    if ( grub_util_check_geom_label(os_dev) )
++      os_dev = grub_util_convert_geom_label_to_dev (os_dev + sizeof ("/dev/") - 1, 1);
++#endif
++
+   if (os_dev)
+     {
+       char **cur;

Added: head/sysutils/grub2-pcbsd/files/patch-grub-core_osdep_unix_platform.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/grub2-pcbsd/files/patch-grub-core_osdep_unix_platform.c	Sun Jun  7 22:38:33 2015	(r388791)
@@ -0,0 +1,100 @@
+--- grub-core/osdep/unix/platform.c.orig	2014-03-03 16:00:26 UTC
++++ grub-core/osdep/unix/platform.c
+@@ -81,52 +81,8 @@ get_ofpathname (const char *dev)
+ 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 @@ grub_install_register_efi (grub_device_t
+ 			   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

Added: head/sysutils/grub2-pcbsd/files/patch-include_grub_emu_getroot.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/grub2-pcbsd/files/patch-include_grub_emu_getroot.h	Sun Jun  7 22:38:33 2015	(r388791)
@@ -0,0 +1,11 @@
+--- include/grub/emu/getroot.h.orig	2015-01-23 02:27:45 UTC
++++ include/grub/emu/getroot.h
+@@ -44,6 +44,8 @@ char *grub_util_get_grub_dev (const char
+ #if defined (__FreeBSD__) || defined(__FreeBSD_kernel__)
+ void grub_util_follow_gpart_up (const char *name, grub_disk_addr_t *off_out,
+ 				char **name_out);
++int grub_util_check_geom_label(const char *name);
++const char *grub_util_convert_geom_label_to_dev (const char *name, int *full_path);
+ #endif
+ 
+ #include <sys/stat.h>

Added: head/sysutils/grub2-pcbsd/files/patch-include_grub_gpt__partition.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/grub2-pcbsd/files/patch-include_grub_gpt__partition.h	Sun Jun  7 22:38:33 2015	(r388791)
@@ -0,0 +1,17 @@
+--- include/grub/gpt_partition.h.orig	2014-03-03 16:00:26 UTC
++++ include/grub/gpt_partition.h
+@@ -43,6 +43,14 @@ typedef struct grub_gpt_part_type grub_g
+     { 0x74, 0x4e, 0x65, 0x65, 0x64, 0x45, 0x46, 0x49 } \
+   }
+ 
++#define GRUB_GPT_PARTITION_TYPE_FREEBSD_BOOT \
++  { grub_cpu_to_le32_compile_time (0x83bd6b9d), \
++      grub_cpu_to_le16_compile_time (0x7f41), \
++      grub_cpu_to_le16_compile_time (0x11dc),	       \
++    { 0xbe, 0x0b, 0x00, 0x15, 0x60, 0xb8, 0x4f, 0x0f } \
++  }
++
++
+ #define GRUB_GPT_PARTITION_TYPE_LDM \
+   { grub_cpu_to_le32_compile_time (0x5808C8AAU),\
+       grub_cpu_to_le16_compile_time (0x7E8F), \

Added: head/sysutils/grub2-pcbsd/files/patch-po_LINGUAS
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/grub2-pcbsd/files/patch-po_LINGUAS	Sun Jun  7 22:38:33 2015	(r388791)
@@ -0,0 +1,5 @@
+--- po/LINGUAS.orig	2015-01-30 16:30:32 UTC
++++ po/LINGUAS
+@@ -1 +1 @@
+-ast ca da de de at hebrew de_CH en at arabic en at cyrillic en at greek en at hebrew en at piglatin en at quot eo es fi fr gl hu id it ja lt nb nl pa pl pt_BR ru sl sv tr uk vi zh_CN zh_TW
++ast ca da de eo es fi fr gl hu id it ja lt nb nl pa pl pt_BR ru sl sv tr uk vi zh_CN zh_TW

Added: head/sysutils/grub2-pcbsd/files/patch-util_grub-install.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/grub2-pcbsd/files/patch-util_grub-install.c	Sun Jun  7 22:38:33 2015	(r388791)
@@ -0,0 +1,19 @@
+--- util/grub-install.c.orig	2015-06-03 14:54:01 UTC
++++ util/grub-install.c
+@@ -236,7 +236,16 @@ argp_parser (int key, char *arg, struct 
+     case ARGP_KEY_ARG:
+       if (install_device)
+ 	grub_util_error ("%s", _("More than one install device?"));
++#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
++    /* Check if passing a FreeBSD geom label */
++    if ( grub_util_check_geom_label(arg) )
++      install_device = \
++        xstrdup(grub_util_convert_geom_label_to_dev (arg + sizeof ("/dev/") - 1, 1));
++    else
++      install_device = xstrdup (arg);
++#else
+       install_device = xstrdup (arg);
++#endif
+       return 0;
+ 
+     default:

Added: head/sysutils/grub2-pcbsd/files/patch-util_grub-mkconfig__lib.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/grub2-pcbsd/files/patch-util_grub-mkconfig__lib.in	Sun Jun  7 22:38:33 2015	(r388791)
@@ -0,0 +1,21 @@
+--- util/grub-mkconfig_lib.in.orig	2015-06-03 14:54:01 UTC
++++ util/grub-mkconfig_lib.in
+@@ -139,7 +139,17 @@ prepare_grub_to_access_device ()
+     echo "insmod ${module}"
+   done
+ 
+-  fs="`"${grub_probe}" --device $@ --target=fs`"
++  # KPM - 6-24-2013
++  # Add this work-around since GRUB doesn't like to identify ZFS
++  # partitions which are in a raidz configuration, gives Unknown FS error
++  # We can instead look at zpool to see if this device is used though
++  zpool status 2>/dev/null | grep -q "`echo ${device} | sed 's|/dev/||g'`"
++  if [ $? -eq 0 ] ; then
++     fs="zfs"
++  else
++     fs="`"${grub_probe}" --device $@ --target=fs`"
++  fi
++
+   for module in ${fs} ; do
+     echo "insmod ${module}"
+   done

Added: head/sysutils/grub2-pcbsd/files/patch-util_grub-probe.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/grub2-pcbsd/files/patch-util_grub-probe.c	Sun Jun  7 22:38:33 2015	(r388791)
@@ -0,0 +1,19 @@
+--- util/grub-probe.c.orig	2015-06-03 14:54:01 UTC
++++ util/grub-probe.c
+@@ -805,7 +805,16 @@ argp_parser (int key, char *arg, struct 
+ 
+     case ARGP_KEY_ARG:
+       assert (arguments->ndevices < arguments->device_max);
++#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
++    /* Check if passing a FreeBSD geom label */
++    if ( grub_util_check_geom_label(arg) )
++      arguments->devices[arguments->ndevices++] = \
++	xstrdup(grub_util_convert_geom_label_to_dev (arg + sizeof ("/dev/") - 1, 1));
++    else
++      arguments->devices[arguments->ndevices++] = xstrdup(arg);
++#else
+       arguments->devices[arguments->ndevices++] = xstrdup(arg);
++#endif
+       break;
+ 
+     default:


More information about the svn-ports-all mailing list