Index: finish-install/debian/changelog =================================================================== --- finish-install/debian/changelog (revision 50280) +++ finish-install/debian/changelog (working copy) @@ -1,3 +1,10 @@ +finish-install (2.13sci1) UNRELEASED; urgency=low + + * 90console: Use serial-console-info tool if /proc console + detection is being stubborn. + + -- dann frazier <[EMAIL PROTECTED]> Thu, 29 Nov 2007 14:32:24 -0700 + finish-install (2.13) unstable; urgency=low * 90console: avoid duplication of values on /etc/securetty. Index: finish-install/finish-install.d/90console =================================================================== --- finish-install/finish-install.d/90console (revision 50280) +++ finish-install/finish-install.d/90console (working copy) @@ -21,6 +21,17 @@ # to tell the truth. inst_pid=$(pidof debian-installer | sed "s/ /\n/g" | sort -n | head -n 1) rawconsole=$(readlink /proc/${inst_pid}/fd/0) +# The proc trick doesn't always work +# For example, when ia64 detects EFI console settings, /proc only exposes +# /dev/console +if [ "$rawconsole" == "/dev/console" ] && \ + [ -x /bin/serial-console-info ] && \ + /bin/serial-console-info > /tmp/serial-console-info.out; then + sci_port=$(grep ^DEV= /tmp/serial-console-info.out | cut -d= -f2) + sci_baud=$(grep ^SPEED= /tmp/serial-console-info.out | cut -d= -f2) + rawconsole="/dev/$sci_port" +fi +rm -f /tmp/serial-console-info.out console=$(mapdevfs "$rawconsole") rawconsole=${rawconsole#/dev/} console=${console#/dev/} @@ -32,7 +43,11 @@ log "Configuring init for serial console" consoletype=${console%%[0-9]*} ttyline=${console#$consoletype} - ttyspeed=$(chroot /target stty --file /dev/$console speed) + if [ -n "$sci_baud" ]; then + ttyspeed="$sci_baud" + else + ttyspeed=$(chroot /target stty --file /dev/$console speed) + fi ttyterm="$TERM" if [ -z "$ttyterm" ]; then ttyterm=vt100; fi
Index: debian-installer-utils/debian/changelog =================================================================== --- debian-installer-utils/debian/changelog (revision 50280) +++ debian-installer-utils/debian/changelog (working copy) @@ -1,3 +1,9 @@ +debian-installer-utils (1.50sci1) UNRELEASED; urgency=low + + * Add serial-console-info utility + + -- dann frazier <[EMAIL PROTECTED]> Thu, 29 Nov 2007 14:48:58 -0700 + debian-installer-utils (1.50) unstable; urgency=low [ Frans Pop ] Index: debian-installer-utils/debian/rules =================================================================== --- debian-installer-utils/debian/rules (revision 50280) +++ debian-installer-utils/debian/rules (working copy) @@ -42,7 +42,8 @@ dh_install -pdi-utils anna-install apt-install debconf-disconnect \ debconf-get debconf-set log-output \ register-module search-path update-dev \ - user-params in-target list-devices bin + user-params in-target list-devices \ + serial-console-info bin dh_install -pdi-utils chroot-setup.sh lib dh_installdirs -pdi-utils usr/lib/post-base-installer.d install register-module.post-base-installer debian/di-utils/usr/lib/post-base-installer.d/10register-module Index: debian-installer-utils/serial-console-info.c =================================================================== --- debian-installer-utils/serial-console-info.c (revision 0) +++ debian-installer-utils/serial-console-info.c (revision 0) @@ -0,0 +1,32 @@ +/* + * If /dev/console is mapped to a serial device, report the device name + * and speed. The readlink /proc/self/fd/0 trick doesn't always work. + * An example of this is ia64, where the EFI console settings are detected + * and used by default. + */ + +#include <stdio.h> +#include <fcntl.h> +#include <unistd.h> +#include <sys/ioctl.h> +#include <linux/serial.h> + +int main(int argc, char **argv) +{ + int fd; + struct serial_struct serial_info; + + fd = open("/dev/console", O_RDWR); + if(fd < 0) + return -1; + + if(ioctl(fd, TIOCGSERIAL, &serial_info) == -1) + return -1; + + close(fd); + + printf("DEV=ttyS%d\n", serial_info.line); + printf("SPEED=%d\n", serial_info.baud_base); + + return 0; +} Index: debian-installer-utils/Makefile =================================================================== --- debian-installer-utils/Makefile (revision 50280) +++ debian-installer-utils/Makefile (working copy) @@ -1,5 +1,5 @@ ifndef TARGETS -TARGETS=mapdevfs log-output +TARGETS=mapdevfs log-output serial-console-info endif CFLAGS=-Wall -W -Os -fomit-frame-pointer -g @@ -15,6 +15,9 @@ log-output: log-output.c $(CC) $(CFLAGS) $^ -o $@ -ldebian-installer +serial-console-info: serial-console-info.c + $(CC) $(CLFAGS) $^ -o $@ + strip: $(TARGETS) $(STRIP) $^