Skip to contentSkip to conversation

grub-install: Install PV Xen binaries into the upstream specified path

PATCH In review Ian Campbell 3 participants 3 messages Oct 23, 2014 – May 13, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 grub-install: Install PV Xen binaries into the upstream specified path

Upstream have defined a specification for where guests ought to place their xenpv grub binaries in order to facilitate chainloading from a stage 1 grub loaded from dom0.

http://xenbits.xen.org/docs/unstable-staging/misc/x86-xenpv-bootloader.html

The spec calls for installation into /boot/xen/pvboot-i386.elf or /boot/xen/pvboot-x86_64.elf.

---
v2: Respect bootdir, create /boot/xen as needed.

---
 util/grub-install.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)
util/grub-install.c +22 -2
index 70f514c..7a7734e 100644
@@ -1979,6 +1979,28 @@ main (int argc, char *argv[])
 	}
       break;
 
+    case GRUB_INSTALL_PLATFORM_I386_XEN:
+      {
+	char *path = grub_util_path_concat (2, bootdir, "xen");
+	char *dst = grub_util_path_concat (2, path, "pvboot-i386.elf");
+	grub_install_mkdir_p (path);
+	grub_install_copy_file (imgfile, dst, 1);
+	free (dst);
+	free (path);
+      }
+      break;
+
+    case GRUB_INSTALL_PLATFORM_X86_64_XEN:
+      {
+	char *path = grub_util_path_concat (2, bootdir, "xen");
+	char *dst = grub_util_path_concat (2, path, "pvboot-x86_64.elf");
+	grub_install_mkdir_p (path);
+	grub_install_copy_file (imgfile, dst, 1);
+	free (dst);
+	free (path);
+      }
+      break;
+
     case GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON:
     case GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS:
     case GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS:
@@ -1987,8 +2009,6 @@ main (int argc, char *argv[])
     case GRUB_INSTALL_PLATFORM_MIPSEL_ARC:
     case GRUB_INSTALL_PLATFORM_ARM_UBOOT:
     case GRUB_INSTALL_PLATFORM_I386_QEMU:
-    case GRUB_INSTALL_PLATFORM_I386_XEN:
-    case GRUB_INSTALL_PLATFORM_X86_64_XEN:
       grub_util_warn ("%s",
 		      _("WARNING: no platform-specific install was performed"));
       break;
Signature · 1 line
2.1.0
#1 lore raw
Quoted 29 lines · Ian Campbell

Upstream have defined a specification for where guests ought to place their xenpv grub binaries in order to facilitate chainloading from a stage 1 grub loaded from dom0.

http://xenbits.xen.org/docs/unstable-staging/misc/x86-xenpv-bootloader.html

The spec calls for installation into /boot/xen/pvboot-i386.elf or /boot/xen/pvboot-x86_64.elf.

---
v2: Respect bootdir, create /boot/xen as needed.

---
  util/grub-install.c | 24 ++++++++++++++++++++++--
  1 file changed, 22 insertions(+), 2 deletions(-)
util/grub-install.c +4 -0
index 70f514c..7a7734e 100644
@@ -1979,6 +1979,28 @@ main (int argc, char *argv[])
  	}
        break;
 
+    case GRUB_INSTALL_PLATFORM_I386_XEN:
+      {
+	char *path = grub_util_path_concat (2, bootdir, "xen");
+	char *dst = grub_util_path_concat (2, path, "pvboot-i386.elf");

util/grub-install.c main (int argc, char *argv[]) · line 1995

Quoted 10 lines
util/grub-install.c +10 -0
+	grub_install_mkdir_p (path);
+	grub_install_copy_file (imgfile, dst, 1);
+	free (dst);
+	free (path);
+      }
+      break;
+
+    case GRUB_INSTALL_PLATFORM_X86_64_XEN:
+      {
+	char *path = grub_util_path_concat (2, bootdir, "xen");

Bootdir is not necessarily /boot. We also might want to specify xen dir to e.g. /mnt/ext2/boot/xen while still keeping GRUB itself in /boot/grub. Can you update patch to allow separate specification of bootdir and xendir?

Quoted 21 lines
util/grub-install.c +8 -2
+	char *dst = grub_util_path_concat (2, path, "pvboot-x86_64.elf");
+	grub_install_mkdir_p (path);
+	grub_install_copy_file (imgfile, dst, 1);
+	free (dst);
+	free (path);
+      }
+      break;
+
      case GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON:
      case GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS:
      case GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS:
@@ -1987,8 +2009,6 @@ main (int argc, char *argv[])
      case GRUB_INSTALL_PLATFORM_MIPSEL_ARC:
      case GRUB_INSTALL_PLATFORM_ARM_UBOOT:
      case GRUB_INSTALL_PLATFORM_I386_QEMU:
-    case GRUB_INSTALL_PLATFORM_I386_XEN:
-    case GRUB_INSTALL_PLATFORM_X86_64_XEN:
        grub_util_warn ("%s",
  		      _("WARNING: no platform-specific install was performed"));
        break;
#2 lore raw

В Fri, 27 Mar 2015 16:40:14 +0100
Vladimir 'φ-coder/phcoder' Serbinenko <[email protected]> пишет:

Quoted 36 lines · Ian Campbell
Quoted 35 lines

Upstream have defined a specification for where guests ought to place their xenpv grub binaries in order to facilitate chainloading from a stage 1 grub loaded from dom0.

http://xenbits.xen.org/docs/unstable-staging/misc/x86-xenpv-bootloader.html

The spec calls for installation into /boot/xen/pvboot-i386.elf or /boot/xen/pvboot-x86_64.elf.

---
v2: Respect bootdir, create /boot/xen as needed.

---
  util/grub-install.c | 24 ++++++++++++++++++++++--
  1 file changed, 22 insertions(+), 2 deletions(-)
util/grub-install.c +10 -0
index 70f514c..7a7734e 100644
@@ -1979,6 +1979,28 @@ main (int argc, char *argv[])
  	}
        break;
 
+    case GRUB_INSTALL_PLATFORM_I386_XEN:
+      {
+	char *path = grub_util_path_concat (2, bootdir, "xen");
+	char *dst = grub_util_path_concat (2, path, "pvboot-i386.elf");
+	grub_install_mkdir_p (path);
+	grub_install_copy_file (imgfile, dst, 1);
+	free (dst);
+	free (path);
+      }
+      break;
Quoted 8 lines

util/grub-install.c main (int argc, char *argv[]) · line 1995

Quoted 4 lines
util/grub-install.c +4 -0
+
+    case GRUB_INSTALL_PLATFORM_X86_64_XEN:
+      {
+	char *path = grub_util_path_concat (2, bootdir, "xen");

Bootdir is not necessarily /boot. We also might want to specify xen dir to e.g. /mnt/ext2/boot/xen while still keeping GRUB itself in /boot/grub. Can you update patch to allow separate specification of bootdir and xendir?

I think similar to --efi-directory it has to refer to mount point, not to final destination; --xen-directory=/mnt will install into /mnt/boot/xen. We do not have control over /boot/xen part.

It also means that grub-install needs to strip off relative path off bootdir to build xendir on the same filesystem to get sane default.

Quoted 27 lines
Quoted 13 lines
util/grub-install.c +8 -0
+	char *dst = grub_util_path_concat (2, path, "pvboot-x86_64.elf");
+	grub_install_mkdir_p (path);
+	grub_install_copy_file (imgfile, dst, 1);
+	free (dst);
+	free (path);
+      }
+      break;
+
      case GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON:
      case GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS:
      case GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS:

util/grub-install.c main (int argc, char *argv[]) · line 2014

Quoted 8 lines
util/grub-install.c +0 -2
@@ -1987,8 +2009,6 @@ main (int argc, char *argv[])
      case GRUB_INSTALL_PLATFORM_MIPSEL_ARC:
      case GRUB_INSTALL_PLATFORM_ARM_UBOOT:
      case GRUB_INSTALL_PLATFORM_I386_QEMU:
-    case GRUB_INSTALL_PLATFORM_I386_XEN:
-    case GRUB_INSTALL_PLATFORM_X86_64_XEN:
        grub_util_warn ("%s",
  		      _("WARNING: no platform-specific install was performed"));
        break;

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel