]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
installer+grub: Fix serial console support with GRUB2.
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 21 Aug 2014 10:32:59 +0000 (12:32 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 21 Aug 2014 10:32:59 +0000 (12:32 +0200)
config/grub2/default
src/installer/hw.h
src/installer/main.c

index 603e78f2f0259415ee24a10e0fd7337f4e42361d..a8b8f7805e4440194ff97d950b4c8347d8c1619a 100644 (file)
@@ -1,7 +1,5 @@
 GRUB_TIMEOUT=5
 GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
 GRUB_DEFAULT=saved
-# GRUB_TERMINAL="serial console"
-# GRUB_SERIAL_COMMAND="serial --unit=0 --speed=115200"
-GRUB_CMDLINE_LINUX="quiet rhgb"
+GRUB_CMDLINE_LINUX="panic=10"
 GRUB_DISABLE_RECOVERY="true"
index bfafbe455ea483d1d2b88cd85563a8b5da6621f1..ea98e2f09e6d9156340dd92b73e1972777755c65 100644 (file)
@@ -50,6 +50,8 @@
 
 #define RAID_METADATA                 "1.0"
 
+#define SERIAL_BAUDRATE               115200
+
 #define BYTES2MB(x) ((x) / 1024 / 1024)
 #define MB2BYTES(x) ((unsigned long long)(x) * 1024 * 1024)
 
index bb73fc24c04519a8b76ab8c8746be2853f7db093..254aae8ea5fa9700a82c2767e4005cd6922c2c3e 100644 (file)
@@ -600,23 +600,22 @@ int main(int argc, char *argv[]) {
        // Installing bootloader...
        statuswindow(60, 4, title, _("Installing the bootloader..."));
 
-       rc = hw_install_bootloader(destination, logfile);
-       if (rc) {
-               errorbox(_("Unable to install the bootloader."));
-               goto EXIT;
-       }
-
-       newtPopWindow();
-
        /* Serial console ? */
        if (serialconsole) {
                /* grub */
-               replace("/harddisk/boot/grub/grub.conf", "splashimage", "#splashimage");
-               replace("/harddisk/boot/grub/grub.conf", "#serial", "serial");
-               replace("/harddisk/boot/grub/grub.conf", "#terminal", "terminal");
-               replace("/harddisk/boot/grub/grub.conf", " panic=10 ", " console=ttyS0,115200n8 panic=10 ");
+               FILE* f = fopen(DESTINATION_MOUNT_PATH "/etc/default/grub", "a");
+               if (!f) {
+                       errorbox(_("Unable to open /etc/default/grub for writing."));
+                       goto EXIT;
+               }
 
-               /*inittab*/
+               fprintf(f, "GRUB_TERMINAL=\"serial console\"\n");
+               fprintf(f, "GRUB_SERIAL_COMMAND=\"serial --unit=0 --speed=%d\"\n", SERIAL_BAUDRATE);
+               fclose(f);
+
+               replace(DESTINATION_MOUNT_PATH "/etc/default/grub", "panic=10", "panic=10 console=ttyS0,115200n8");
+
+               /* inittab */
                replace("/harddisk/etc/inittab", "1:2345:respawn:", "#1:2345:respawn:");
                replace("/harddisk/etc/inittab", "2:2345:respawn:", "#2:2345:respawn:");
                replace("/harddisk/etc/inittab", "3:2345:respawn:", "#3:2345:respawn:");
@@ -626,6 +625,14 @@ int main(int argc, char *argv[]) {
                replace("/harddisk/etc/inittab", "#7:2345:respawn:", "7:2345:respawn:");
        }
 
+       rc = hw_install_bootloader(destination, logfile);
+       if (rc) {
+               errorbox(_("Unable to install the bootloader."));
+               goto EXIT;
+       }
+
+       newtPopWindow();
+
        /* Set marker that the user has already accepted the gpl */
        mysystem(logfile, "/usr/bin/touch /harddisk/var/ipfire/main/gpl_accepted");