From 62f00af9af47d131a0f9b7040dfee59816fa95b5 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 10 Dec 2001 13:57:53 +0000 Subject: - fix bootloader::add_append - add handling of serial console --- perl-install/any.pm | 8 ++++++++ perl-install/bootloader.pm | 20 +++++++++++++++++--- perl-install/install_steps.pm | 6 ++---- 3 files changed, 27 insertions(+), 7 deletions(-) (limited to 'perl-install') diff --git a/perl-install/any.pm b/perl-install/any.pm index e82bba86a..80d82a4e4 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -819,6 +819,14 @@ sub write_passwd_user { } "$prefix/etc/passwd"; } +sub set_login_serial_console { + my ($prefix, $port, $speed) = @_; + + my $line = "s$port:12345:respawn:/sbin/getty ttyS$port DT$speed ansi\n"; + substInFile { s/^s$port:.*//; $_ = "$line" if eof } "$prefix/etc/inittab"; +} + + sub runlevel { my ($prefix, $runlevel) = @_; my $f = "$prefix/etc/inittab"; diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index 73f37e6c6..922cf0ac0 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -176,10 +176,16 @@ sub get_append { sub add_append { my ($b, $key, $val) = @_; - foreach ({ append => $b->{perImageAppend} }, @{$b->{entries}}) { - $_->{append} =~ s/\b$key=\S*\s*//; - $_->{append} =~ s/\s*$/ $key=$val/ if $val; + foreach (\$b->{perImageAppend}, map { \$_->{append} } @{$b->{entries}}) { + $$_ =~ s/\b$key=\S*\s*//; + $$_ =~ s/\s*$/ $key=$val/ if $val; + log::l("add_append: $$_"); } + log::l("add_append: $b->{perImageAppend}"); +} +sub may_append { + my ($b, $key, $val) = @_; + add_append($b, $key, $val) if !get_append($b, $key); } sub configure_entry($$) { @@ -316,6 +322,11 @@ wait %d seconds for default boot. add2hash_($lilo, { getVarsFromSh("$prefix/etc/sysconfig/system") }); #- for CLEAN_TMP add2hash_($lilo, { memsize => $1 }) if cat_("/proc/cmdline") =~ /mem=(\S+)/; + if (my ($s, $port, $speed) = cat_("/proc/cmdline") =~ /console=(ttyS(\d),(\d+)\S*)/) { + log::l("serial console $s $port $speed"); + add_append($lilo, 'console' => $s); + any::set_login_serial_console($prefix, $port, $speed); + } my %labels = get_kernels_and_labels($prefix); $labels{''} or die "no kernel installed"; @@ -655,6 +666,7 @@ sub write_lilo_conf { $lilo->{$_} and print F $_ foreach qw(linear lba32 compact prompt restricted); print F "password=", $lilo->{password} if $lilo->{restricted} && $lilo->{password}; #- also done by msec print F "timeout=", round(10 * $lilo->{timeout}) if $lilo->{timeout}; + print F "serial=", $1 if get_append($lilo, 'console') =~ /ttyS(.*)/; my $dev = $hds->[0]{device}; my %dev2bios = map_index { $_ => $::i } dev2bios($hds, $lilo->{boot}); @@ -772,6 +784,8 @@ sub write_grub_config { print F "color black/cyan yellow/cyan"; print F "i18n ", $file2grub->("/boot/grub/messages"); print F "keytable ", $file2grub->($lilo->{keytable}) if $lilo->{keytable}; + print F "serial --unit=$1 --speed=$2\nterminal serial console" if get_append($lilo, 'console') =~ /ttyS(\d),(\d+)/; + #- since we use notail in reiserfs, altconfigfile is broken :-( unless ($bootIsReiser) { print F "altconfigfile ", $file2grub->(my $once = "/boot/grub/menu.once"); diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index d58ed7f44..ac7f33e98 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -152,10 +152,8 @@ sub doPartitionDisksAfter { $o->{fstab} = [ fsedit::get_all_fstab($o->{all_hds}) ]; fsedit::get_root_($o->{fstab}) or die "Oops, no root partition"; - # do not use devfs with root software raid - foreach ($o->{bootloader}{perImageAppend}) { - $_ .= ' devfs=mount' if !/devfs=/; - } + require bootloader; + bootloader::may_append($o->{bootloader}, devfs => 'mount'); if (arch() =~ /ppc/ && detect_devices::get_mac_generation =~ /NewWorld/) { die "Need bootstrap partition to boot system!" if !(defined $partition_table_mac::bootstrap_part); -- cgit v1.2.1