From 423400cffa3697568456dd54418b421ef360cc8a Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Wed, 22 Aug 2012 22:03:35 +0200 Subject: [PATCH] installer: Help grub to find the right device to install itself on. --- src/install+setup/install/main.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/install+setup/install/main.c b/src/install+setup/install/main.c index c181e4a8e7..e1b9161498 100644 --- a/src/install+setup/install/main.c +++ b/src/install+setup/install/main.c @@ -510,6 +510,15 @@ int main(int argc, char *argv[]) system("/bin/sed -e 's#/harddisk#/#g' -e 's#//#/#g' < /proc/mounts > /harddisk/etc/mtab"); + /* + * Generate device.map to help grub finding the device to install itself on. + */ + FILE *f = NULL; + if (f = fopen("/harddisk/boot/grub/device.map", "w")) { + fprintf(f, "(hd0) %s\n", hdparams.devnode_part); + fclose(f); + } + snprintf(commandstring, STRING_SIZE, "/usr/sbin/chroot /harddisk /usr/sbin/grub-install --no-floppy %s", hdparams.devnode_disk); if (runcommandwithstatus(commandstring, ctr[TR_INSTALLING_GRUB])) { -- 2.39.2