Re: Automatic configuration of /etc/ttys in installer

2018-05-28 Thread Theo Buehler
On Sat, May 26, 2018 at 10:39:57PM +0200, Mark Kettenis wrote:
> > Date: Tue, 8 May 2018 08:51:14 +0200 (CEST)
> > From: Mark Kettenis 
> > 
> > After my recent changes to armv7 and arm64 the installer and
> > single-user mode are usable with a non-standard serial console speed.
> > However, the installer will still install an /etc/ttys file with
> > std.115200 in it.  This means that getty(8) will change the speed
> > which means you get garbage or nothing on your serial connections.
> > 
> > Here is an attempt to make the installer modify the console entry in
> > /etc/ttys to reflect the correct speed.  This uses some of the same
> > code that we use to offer i386/amd64 users to switch the console to
> > serial.  But it doesn't ask the question since we don't have to guess
> > what the console will be.  I restricted the patching to the set of
> > speeds that we actually support.
> > 
> > Is there a better way to do this?
> 
> Ping?

The diff reads fine to me, but I can't actually test it.

ok tb@

> 
> > Index: distrib/arm64/ramdisk/install.md
> > ===
> > RCS file: /cvs/src/distrib/arm64/ramdisk/install.md,v
> > retrieving revision 1.9
> > diff -u -p -r1.9 install.md
> > --- distrib/arm64/ramdisk/install.md23 Mar 2018 05:02:27 -  
> > 1.9
> > +++ distrib/arm64/ramdisk/install.md8 May 2018 06:40:44 -
> > @@ -150,4 +150,12 @@ md_congrats() {
> >  }
> >  
> >  md_consoleinfo() {
> > +   CTTY=console
> > +   DEFCONS=y
> > +   case $CSPEED in
> > +   9600|19200|38400|57600|115200|150)
> > +   ;;
> > +   *)
> > +   CSPEED=115200;;
> > +   esac
> >  }
> > Index: distrib/miniroot/install.sub
> > ===
> > RCS file: /cvs/src/distrib/miniroot/install.sub,v
> > retrieving revision 1.1067
> > diff -u -p -r1.1067 install.sub
> > --- distrib/miniroot/install.sub7 May 2018 10:44:01 -   1.1067
> > +++ distrib/miniroot/install.sub8 May 2018 06:40:44 -
> > @@ -2637,6 +2637,7 @@ apply() {
> > if [[ $DEFCONS == y ]]; then
> > cp /mnt/etc/ttys /tmp/i/ttys
> > sed -e "/^$CTTY/s/std.9600/std.${CSPEED}/" \
> > +   -e "/^$CTTY/s/std.115200/std.${CSPEED}/" \
> > -e "/^$CTTY/s/unknown/vt220 /" \
> > -e "/$CTTY/s/off.*/on secure/" /tmp/i/ttys 
> > >/mnt/etc/ttys
> > [[ -n $CPROM ]] &&
> > 
> > 
> 



Re: Automatic configuration of /etc/ttys in installer

2018-05-26 Thread Mark Kettenis
> Date: Tue, 8 May 2018 08:51:14 +0200 (CEST)
> From: Mark Kettenis 
> 
> After my recent changes to armv7 and arm64 the installer and
> single-user mode are usable with a non-standard serial console speed.
> However, the installer will still install an /etc/ttys file with
> std.115200 in it.  This means that getty(8) will change the speed
> which means you get garbage or nothing on your serial connections.
> 
> Here is an attempt to make the installer modify the console entry in
> /etc/ttys to reflect the correct speed.  This uses some of the same
> code that we use to offer i386/amd64 users to switch the console to
> serial.  But it doesn't ask the question since we don't have to guess
> what the console will be.  I restricted the patching to the set of
> speeds that we actually support.
> 
> Is there a better way to do this?

Ping?

> Index: distrib/arm64/ramdisk/install.md
> ===
> RCS file: /cvs/src/distrib/arm64/ramdisk/install.md,v
> retrieving revision 1.9
> diff -u -p -r1.9 install.md
> --- distrib/arm64/ramdisk/install.md  23 Mar 2018 05:02:27 -  1.9
> +++ distrib/arm64/ramdisk/install.md  8 May 2018 06:40:44 -
> @@ -150,4 +150,12 @@ md_congrats() {
>  }
>  
>  md_consoleinfo() {
> + CTTY=console
> + DEFCONS=y
> + case $CSPEED in
> + 9600|19200|38400|57600|115200|150)
> + ;;
> + *)
> + CSPEED=115200;;
> + esac
>  }
> Index: distrib/miniroot/install.sub
> ===
> RCS file: /cvs/src/distrib/miniroot/install.sub,v
> retrieving revision 1.1067
> diff -u -p -r1.1067 install.sub
> --- distrib/miniroot/install.sub  7 May 2018 10:44:01 -   1.1067
> +++ distrib/miniroot/install.sub  8 May 2018 06:40:44 -
> @@ -2637,6 +2637,7 @@ apply() {
>   if [[ $DEFCONS == y ]]; then
>   cp /mnt/etc/ttys /tmp/i/ttys
>   sed -e "/^$CTTY/s/std.9600/std.${CSPEED}/" \
> + -e "/^$CTTY/s/std.115200/std.${CSPEED}/" \
>   -e "/^$CTTY/s/unknown/vt220 /" \
>   -e "/$CTTY/s/off.*/on secure/" /tmp/i/ttys 
> >/mnt/etc/ttys
>   [[ -n $CPROM ]] &&
> 
> 



Automatic configuration of /etc/ttys in installer

2018-05-08 Thread Mark Kettenis
After my recent changes to armv7 and arm64 the installer and
single-user mode are usable with a non-standard serial console speed.
However, the installer will still install an /etc/ttys file with
std.115200 in it.  This means that getty(8) will change the speed
which means you get garbage or nothing on your serial connections.

Here is an attempt to make the installer modify the console entry in
/etc/ttys to reflect the correct speed.  This uses some of the same
code that we use to offer i386/amd64 users to switch the console to
serial.  But it doesn't ask the question since we don't have to guess
what the console will be.  I restricted the patching to the set of
speeds that we actually support.

Is there a better way to do this?


Index: distrib/arm64/ramdisk/install.md
===
RCS file: /cvs/src/distrib/arm64/ramdisk/install.md,v
retrieving revision 1.9
diff -u -p -r1.9 install.md
--- distrib/arm64/ramdisk/install.md23 Mar 2018 05:02:27 -  1.9
+++ distrib/arm64/ramdisk/install.md8 May 2018 06:40:44 -
@@ -150,4 +150,12 @@ md_congrats() {
 }
 
 md_consoleinfo() {
+   CTTY=console
+   DEFCONS=y
+   case $CSPEED in
+   9600|19200|38400|57600|115200|150)
+   ;;
+   *)
+   CSPEED=115200;;
+   esac
 }
Index: distrib/miniroot/install.sub
===
RCS file: /cvs/src/distrib/miniroot/install.sub,v
retrieving revision 1.1067
diff -u -p -r1.1067 install.sub
--- distrib/miniroot/install.sub7 May 2018 10:44:01 -   1.1067
+++ distrib/miniroot/install.sub8 May 2018 06:40:44 -
@@ -2637,6 +2637,7 @@ apply() {
if [[ $DEFCONS == y ]]; then
cp /mnt/etc/ttys /tmp/i/ttys
sed -e "/^$CTTY/s/std.9600/std.${CSPEED}/" \
+   -e "/^$CTTY/s/std.115200/std.${CSPEED}/" \
-e "/^$CTTY/s/unknown/vt220 /" \
-e "/$CTTY/s/off.*/on secure/" /tmp/i/ttys 
>/mnt/etc/ttys
[[ -n $CPROM ]] &&