grub2: bump to 2.06-rc1
[openwrt/openwrt.git] / package / boot / grub2 / patches / 100-grub_setup_root.patch
1 --- a/include/grub/util/install.h
2 +++ b/include/grub/util/install.h
3 @@ -198,13 +198,13 @@ grub_install_get_image_target (const cha
4 void
5 grub_util_bios_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,
10 int add_rs_codes, int warn_short_mbr_gap);
11 void
12 grub_util_sparc_setup (const char *dir,
13 const char *boot_file, const char *core_file,
14 - const char *dest, int force,
15 + const char *root, const char *dest, int force,
16 int fs_probe, int allow_floppy,
17 int add_rs_codes, int warn_short_mbr_gap);
18
19 --- a/util/grub-install.c
20 +++ b/util/grub-install.c
21 @@ -1720,7 +1720,7 @@ main (int argc, char *argv[])
22 /* Now perform the installation. */
23 if (install_bootsector)
24 grub_util_bios_setup (platdir, "boot.img", "core.img",
25 - install_drive, force,
26 + NULL, install_drive, force,
27 fs_probe, allow_floppy, add_rs_codes,
28 !grub_install_is_short_mbrgap_supported ());
29 break;
30 @@ -1747,7 +1747,7 @@ main (int argc, char *argv[])
31 /* Now perform the installation. */
32 if (install_bootsector)
33 grub_util_sparc_setup (platdir, "boot.img", "core.img",
34 - install_drive, force,
35 + NULL, install_drive, force,
36 fs_probe, allow_floppy,
37 0 /* unused */, 0 /* unused */ );
38 break;
39 --- a/util/grub-setup.c
40 +++ b/util/grub-setup.c
41 @@ -87,6 +87,8 @@ static struct argp_option options[] = {
42 N_("install even if problems are detected"), 0},
43 {"skip-fs-probe",'s',0, 0,
44 N_("do not probe for filesystems in DEVICE"), 0},
45 + {"root-device", 'r', N_("DEVICE"), 0,
46 + N_("use DEVICE as the root device"), 0},
47 {"verbose", 'v', 0, 0, N_("print verbose messages."), 0},
48 {"allow-floppy", 'a', 0, 0,
49 /* TRANSLATORS: The potential breakage isn't limited to floppies but it's
50 @@ -130,6 +132,7 @@ struct arguments
51 char *core_file;
52 char *dir;
53 char *dev_map;
54 + char *root_dev;
55 int force;
56 int fs_probe;
57 int allow_floppy;
58 @@ -178,6 +181,13 @@ argp_parser (int key, char *arg, struct
59 arguments->dev_map = xstrdup (arg);
60 break;
61
62 + case 'r':
63 + if (arguments->root_dev)
64 + free (arguments->root_dev);
65 +
66 + arguments->root_dev = xstrdup (arg);
67 + break;
68 +
69 case 'f':
70 arguments->force = 1;
71 break;
72 @@ -313,7 +323,7 @@ main (int argc, char *argv[])
73 GRUB_SETUP_FUNC (arguments.dir ? : DEFAULT_DIRECTORY,
74 arguments.boot_file ? : DEFAULT_BOOT_FILE,
75 arguments.core_file ? : DEFAULT_CORE_FILE,
76 - dest_dev, arguments.force,
77 + arguments.root_dev, dest_dev, arguments.force,
78 arguments.fs_probe, arguments.allow_floppy,
79 arguments.add_rs_codes, 0);
80
81 --- a/util/setup.c
82 +++ b/util/setup.c
83 @@ -252,14 +252,13 @@ identify_partmap (grub_disk_t disk __att
84 void
85 SETUP (const char *dir,
86 const char *boot_file, const char *core_file,
87 - const char *dest, int force,
88 + const char *root, const char *dest, int force,
89 int fs_probe, int allow_floppy,
90 int add_rs_codes __attribute__ ((unused)), /* unused on sparc64 */
91 int warn_small)
92 {
93 char *core_path;
94 char *boot_img, *core_img, *boot_path;
95 - char *root = 0;
96 size_t boot_size, core_size;
97 grub_uint16_t core_sectors;
98 grub_device_t root_dev = 0, dest_dev, core_dev;
99 @@ -311,7 +310,10 @@ SETUP (const char *dir,
100
101 core_dev = dest_dev;
102
103 - {
104 + if (root)
105 + root_dev = grub_device_open(root);
106 +
107 + if (!root_dev) {
108 char **root_devices = grub_guess_root_devices (dir);
109 char **cur;
110 int found = 0;
111 @@ -324,6 +326,8 @@ SETUP (const char *dir,
112 char *drive;
113 grub_device_t try_dev;
114
115 + if (root_dev)
116 + break;
117 drive = grub_util_get_grub_dev (*cur);
118 if (!drive)
119 continue;