1 --- a/util/grub-setup.c
2 +++ b/util/grub-setup.c
3 @@ -141,12 +141,11 @@ write_rootdev (char *core_img, grub_devi
5 setup (const char *dir,
6 const char *boot_file, const char *core_file,
7 - const char *dest, int force,
8 + const char *root, const char *dest, int force,
9 int fs_probe, int allow_floppy)
11 char *boot_path, *core_path, *core_path_dev, *core_path_dev_full;
12 char *boot_img, *core_img;
14 size_t boot_size, core_size;
15 grub_uint16_t core_sectors;
16 grub_device_t root_dev = 0, dest_dev, core_dev;
17 @@ -253,7 +252,10 @@ setup (const char *dir,
23 + root_dev = grub_device_open(root);
26 char **root_devices = grub_guess_root_devices (dir);
29 @@ -263,6 +265,8 @@ setup (const char *dir,
31 grub_device_t try_dev;
35 drive = grub_util_get_grub_dev (*cur);
38 @@ -956,6 +960,8 @@ static struct argp_option options[] = {
39 N_("install even if problems are detected"), 0},
40 {"skip-fs-probe",'s',0, 0,
41 N_("do not probe for filesystems in DEVICE"), 0},
42 + {"root-device", 'r', N_("DEVICE"), 0,
43 + N_("use DEVICE as the root device"), 0},
44 {"verbose", 'v', 0, 0, N_("print verbose messages."), 0},
45 {"allow-floppy", 'a', 0, 0,
46 /* TRANSLATORS: The potential breakage isn't limited to floppies but it's
47 @@ -993,6 +999,7 @@ struct arguments
55 @@ -1040,6 +1047,13 @@ argp_parser (int key, char *arg, struct
56 arguments->dev_map = xstrdup (arg);
60 + if (arguments->root_dev)
61 + free (arguments->root_dev);
63 + arguments->root_dev = xstrdup (arg);
69 @@ -1172,7 +1186,7 @@ main (int argc, char *argv[])
70 setup (arguments.dir ? : DEFAULT_DIRECTORY,
71 arguments.boot_file ? : DEFAULT_BOOT_FILE,
72 arguments.core_file ? : DEFAULT_CORE_FILE,
73 - dest_dev, arguments.force,
74 + arguments.root_dev, dest_dev, arguments.force,
75 arguments.fs_probe, arguments.allow_floppy);