All of lore.kernel.org
 help / color / mirror / Atom feed
From: phcoder <phcoder@gmail.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: [PATCH] Allow to install in non-default prefixes
Date: Sun, 01 Feb 2009 01:12:14 +0100	[thread overview]
Message-ID: <4984E8DE.2090608@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 156 bytes --]

This patch adds -p option for grub-setup on i386-pc. Without it install 
to any prefix different from /boot/grub failed
Thank
Vladimir 'phcoder' Serbinenko

[-- Attachment #2: prefpatch --]
[-- Type: text/plain, Size: 2676 bytes --]

Index: util/i386/pc/grub-setup.c
===================================================================
--- util/i386/pc/grub-setup.c	(revision 1964)
+++ util/i386/pc/grub-setup.c	(working copy)
@@ -94,6 +94,7 @@
 
 static void
 setup (const char *dir,
+       const char *prefix,
        const char *boot_file, const char *core_file,
        const char *root, const char *dest, int must_embed)
 {
@@ -373,7 +374,7 @@
   
   /* Make sure that GRUB reads the identical image as the OS.  */
   tmp_img = xmalloc (core_size);
-  core_path_dev = grub_util_get_path (DEFAULT_DIRECTORY, core_file);
+  core_path_dev = grub_util_get_path (prefix, core_file);
   
   /* It is a Good Thing to sync two times.  */
   sync ();
@@ -540,6 +541,7 @@
   -b, --boot-image=FILE   use FILE as the boot image [default=%s]\n\
   -c, --core-image=FILE   use FILE as the core image [default=%s]\n\
   -d, --directory=DIR     use GRUB files in the directory DIR [default=%s]\n\
+  -p, --prefix=DIR        specify the name of GRUB directory relative to partition root [default=%s]\n \
   -m, --device-map=FILE   use FILE as the device map [default=%s]\n\
   -r, --root-device=DEV   use DEV as the root device [default=guessed]\n\
   -h, --help              display this message and exit\n\
@@ -548,7 +550,8 @@
 \n\
 Report bugs to <%s>.\n\
 ",
-	    DEFAULT_BOOT_FILE, DEFAULT_CORE_FILE, DEFAULT_DIRECTORY,
+	    DEFAULT_BOOT_FILE, DEFAULT_CORE_FILE, DEFAULT_DIRECTORY, 
+	    DEFAULT_DIRECTORY,
 	    DEFAULT_DEVICE_MAP, PACKAGE_BUGREPORT);
 
   exit (status);
@@ -575,6 +578,7 @@
   char *dev_map = 0;
   char *root_dev = 0;
   char *dest_dev;
+  char *prefix = 0;
   int must_embed = 0;
   
   progname = "grub-setup";
@@ -582,7 +586,7 @@
   /* Check for options.  */
   while (1)
     {
-      int c = getopt_long (argc, argv, "b:c:d:m:r:hVv", options, 0);
+      int c = getopt_long (argc, argv, "p:b:c:d:m:r:hVv", options, 0);
 
       if (c == -1)
 	break;
@@ -603,6 +607,14 @@
 	    core_file = xstrdup (optarg);
 	    break;
 
+	  case 'p':
+	    if (prefix)
+	      free (prefix);
+
+	    prefix = xstrdup (optarg);
+	    break;
+
+
 	  case 'd':
 	    if (dir)
 	      free (dir);
@@ -723,6 +735,7 @@
       for (i = 0; devicelist[i]; i++)
 	{
 	  setup (dir ? : DEFAULT_DIRECTORY,
+		 prefix ? : DEFAULT_DIRECTORY,
 		 boot_file ? : DEFAULT_BOOT_FILE,
 		 core_file ? : DEFAULT_CORE_FILE,
 		 root_dev, grub_util_get_grub_dev (devicelist[i]), 1);
@@ -732,6 +745,7 @@
 #endif
   /* Do the real work.  */
     setup (dir ? : DEFAULT_DIRECTORY,
+	   prefix ? : DEFAULT_DIRECTORY,
 	   boot_file ? : DEFAULT_BOOT_FILE,
 	   core_file ? : DEFAULT_CORE_FILE,
 	   root_dev, dest_dev, must_embed);

             reply	other threads:[~2009-02-01  0:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-01  0:12 phcoder [this message]
2009-02-01 19:11 ` [PATCH] Allow to install in non-default prefixes phcoder
2009-02-04 11:59   ` phcoder
2009-02-12 18:23     ` phcoder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4984E8DE.2090608@gmail.com \
    --to=phcoder@gmail.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.