This patch is taken from OpenWrt, see: https://github.com/openwrt/openwrt/blob/master/package/boot/grub2/patches/100-grub_setup_root.patch. It allows to use grub-bios-setup on a raw disk-images, without root permissions. --- a/util/grub-setup.c +++ b/util/grub-setup.c @@ -87,6 +87,8 @@ static struct argp_option options[] = { N_("install even if problems are detected"), 0}, {"skip-fs-probe",'s',0, 0, N_("do not probe for filesystems in DEVICE"), 0}, + {"root-device", 'r', N_("DEVICE"), 0, + N_("use DEVICE as the root device"), 0}, {"verbose", 'v', 0, 0, N_("print verbose messages."), 0}, {"allow-floppy", 'a', 0, 0, /* TRANSLATORS: The potential breakage isn't limited to floppies but it's @@ -130,6 +132,7 @@ struct arguments char *core_file; char *dir; char *dev_map; + char *root_dev; int force; int fs_probe; int allow_floppy; @@ -178,6 +181,13 @@ argp_parser (int key, char *arg, struct arguments->dev_map = xstrdup (arg); break; + case 'r': + if (arguments->root_dev) + free (arguments->root_dev); + + arguments->root_dev = xstrdup (arg); + break; + case 'f': arguments->force = 1; break; @@ -313,7 +323,7 @@ mai
aboutsummaryrefslogtreecommitdiff |