mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
installer+grub: Fix serial console support with GRUB2.
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user