On Sun, Feb 24, 2008 at 12:03:05PM -0800, Jeremy Chadwick wrote:
> I'll have to get the qemu stuff set up so I can test this more easily.

I re-thought the method a bit, and went with something slightly more
hackish, plus added code to deal with the case where one uses -h or -Dh
in /boot.config (thus setting boot_serial=YES).  The Forth code can
probably be simplified, but since I got this to work, I'll submit a PR
for the whole thing.  We can hash out details/improvements there.


\ Used when serial console is detected (-|+ characters)
45 constant ascii_dash
124 constant ascii_pipe
43 constant ascii_plus

: set_serial_charset    ( -- )
        s" console" getenv
        dup -1 = if
                drop exit
        then
        s" comconsole" compare-insensitive 0= if
                drop
                ascii_dash h_el !
                ascii_pipe v_el !
                ascii_plus lt_el !
                ascii_plus lb_el !
                ascii_plus rt_el !
                ascii_plus rb_el !
        then
        s" boot_serial" getenv
        dup -1 = if
                drop exit
        then
        s" YES" compare-insensitive 0= if
                drop
                ascii_dash h_el !
                ascii_pipe v_el !
                ascii_plus lt_el !
                ascii_plus lb_el !
                ascii_plus rt_el !
                ascii_plus rb_el !
        then
;


set_serial_charset should be called after f_single in frames.4th.

I just tested it on our development box, which uses -S115200 -Dh in
/boot.config and nothing serial-related in loader.conf:

 +-----------------------------------------+
 |                                         |
 |                                         |      ______
 |                                         |     |  ____| __ ___  ___
 |          Welcome to FreeBSD!            |     | |__ | '__/ _ \/ _ \
 |                                         |     |  __|| | |  __/  __/
 |                                         |     | |   | | |    |    |
 |  1. Boot FreeBSD [default]              |     |_|   |_|  \___|\___|
 |  2. Boot FreeBSD with ACPI disabled     |      ____   _____ _____
 |  3. Boot FreeBSD in Safe Mode           |     |  _ \ / ____|  __ \
 |  4. Boot FreeBSD in single user mode    |     | |_) | (___ | |  | |
 |  5. Boot FreeBSD with verbose logging   |     |  _ < \___ \| |  | |
 |  6. Escape to loader prompt             |     | |_) |____) | |__| |
 |  7. Reboot                              |     |     |      |      |
 |                                         |     |____/|_____/|_____/
 |                                         |
 |                                         |
 |                                         |
 |  Select option, [Enter] for default     |
 |  or [Space] to pause timer  6           |
 +-----------------------------------------+

-- 
| Jeremy Chadwick                                    jdc at parodius.com |
| Parodius Networking                           http://www.parodius.com/ |
| UNIX Systems Administrator                      Mountain View, CA, USA |
| Making life hard for others since 1977.                  PGP: 4BD6C0CB |

_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to