Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Dec 2012 12:44:34 -0800
From:      Devin Teske <devin.teske@fisglobal.com>
To:        Garrett Cooper <yanegomi@gmail.com>
Cc:        FreeBSD Hackers <freebsd-hackers@freebsd.org>, Devin Teske <dteske@freebsd.org>
Subject:   Re: loader and ficl/Forth help
Message-ID:  <EA615AED-38B9-4A68-B86A-3784351E150C@fisglobal.com>
In-Reply-To: <CAGH67wStkOKpLDmS%2ByOGidRZ1jX6Na7Ndqb8J8ZL_JjMsrZh4g@mail.gmail.com>
References:  <3386ABA0-B05E-4E52-B9F7-35555A8AAFDA@fisglobal.com> <CAGH67wRBAWO5QqVy5gNthmgcAu3-bQcbwCUN8Z%2B0Sy_DXHOQ3g@mail.gmail.com> <13F96785-E0F3-4EC2-826E-070366D4A963@fisglobal.com> <CAGH67wStkOKpLDmS%2ByOGidRZ1jX6Na7Ndqb8J8ZL_JjMsrZh4g@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--Apple-Mail=_C87912D6-5E37-4720-976F-F6BD7A650FD8
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="windows-1252"


On Dec 7, 2012, at 12:33 PM, Garrett Cooper wrote:

> On Fri, Dec 7, 2012 at 12:07 PM, Devin Teske <devin.teske@fisglobal.com> =
wrote:
>=20
> ...
>=20
>> I'll look into boot_multicons.
>>=20
>> However, w/respect to "boot -D", I believe that would be after the menu,=
 so is past the point at which we need the functionality (in drawing frames=
 from frames.4th).
>>=20
>> Also, you replied to an earlier e-mail in the thread, do note that there=
's an updated patch that centralizes the logic to "boot_serial?" function w=
hich returns boolean based on multiple conditions (currently takes $console=
 and $boot_serial into consideration -- should be trivial to add a check fo=
r boot_multicons).
>=20
> You're correct; boot -D is for after boot and this only affects loader(8):
>=20
>                     -D    boot with the dual console configuration.  In t=
he
>                           single configuration, the console will be either
>                           the internal display or the serial port, depend=
ing
>                           on the state of the -h option below.  In the du=
al
>                           console configuration, both the internal display
>                           and the serial port will become the console at =
the
>                           same time, regardless of the state of the -h
>                           option.
>=20
> Rereading loader(8)'s entry on multicons, it might be a non-issue as
> well, given that it's only saying "kernel":
>=20
>     boot_multicons
>               Enables multiple console support in the kernel early on boo=
t.
>               In a running system, console configuration can be manipulat=
ed
>               by the conscontrol(8) utility.
>=20
> A grep of sys/boot suggests it's an alias for -D:
>=20
> $ grep -r multicons .
> ./userboot/userboot/bootinfo.c:    {"boot_multicons",   RB_MULTIPLE},
> ./sparc64/loader/metadata.c:    {"boot_multicons",      RB_MULTIPLE},
> ./forth/loader.conf:#boot_multicons=3D""  # -D: Use multiple consoles
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> ./powerpc/ofw/metadata.c:    {"boot_multicons", RB_MULTIPLE},
> ./powerpc/ps3/metadata.c:    {"boot_multicons", RB_MULTIPLE},
> ./i386/libi386/comconsole.c:        getenv("boot_multicons") !=3D NULL) {
> ./i386/libi386/bootinfo.c:    {"boot_multicons",        RB_MULTIPLE},
> ./i386/efi/bootinfo.c:  { "boot_multicons",     RB_MULTIPLE},
> ./pc98/libpc98/comconsole.c:        getenv("boot_multicons") !=3D NULL) {
> ./common/loader.8:.It Va boot_multicons
> ./common/help.common:# Tset Sboot_multicons DUse multiple consoles
> ./common/help.common:   set boot_multicons
> ./ia64/common/bootinfo.c:       { "boot_multicons",     RB_MULTIPLE},
> ./uboot/common/metadata.c:      {"boot_multicons",      RB_MULTIPLE},
>=20
> However, sys/boot/i386/libi386/comconsole.c is doing some matching
> based on the environment variable, so I'd need to look into the call
> flow further to better understand what's being achieved.
>=20

Can you review the following patch for inclusion to HEAD?

I do believe this new patch gets us where we need to be=85

_____________
The information contained in this message is proprietary and/or confidentia=
l. If you are not the intended recipient, please: (i) delete the message an=
d all copies; (ii) do not disclose, distribute or use the message in any ma=
nner; and (iii) notify the sender immediately. In addition, please be aware=
 that any message addressed to our domain is subject to archiving and revie=
w by persons other than the intended recipient. Thank you.

--Apple-Mail=_C87912D6-5E37-4720-976F-F6BD7A650FD8
Content-Disposition: attachment; filename="patch.txt"
Content-Type: text/plain; name="patch.txt"
Content-Transfer-Encoding: 7bit

Index: support.4th
===================================================================
--- support.4th	(revision 242835)
+++ support.4th	(working copy)
@@ -201,6 +201,46 @@ create last_module_option sizeof module.next allot
 
 : getenv?  getenv -1 = if false else drop true then ;
 
+\ determine if a word appears in a string, case-insensitive
+: contains? ( addr1 len1 addr2 len2 -- 0 | -1 )
+	2 pick 0= if 2drop 2drop true exit then
+	dup 0= if 2drop 2drop false exit then
+	begin
+		begin
+			swap dup c@ dup 32 = over 9 = or
+			over 10 = or over 13 = or swap drop
+		while 1+ swap 1- repeat
+		swap 2 pick 1- over <
+	while
+		2over 2over drop over compare-insensitive 0= if
+			2 pick over = if 2drop 2drop true exit then
+			2 pick tuck - -rot + swap over c@ dup 32 =
+			over 9 = or over 10 = or over 13 = or
+			swap drop if 2drop 2drop true exit then
+		then begin
+			swap dup c@
+			dup 32 = over 9 = or over 10 = or over 13 = or
+			swap drop if false else true then 2 pick 0> and
+		while 1+ swap 1- repeat
+		swap
+	repeat
+	2drop 2drop false
+;
+
+: boot_serial? ( -- 0 | -1 )
+	s" console" getenv dup -1 <> if
+		s" comconsole" 2swap contains?
+	else drop false then
+	s" boot_serial" getenv dup -1 <> if
+		swap drop 0>
+	else drop false then
+	or \ console contains comconsole ( or ) boot_serial
+	s" boot_multicons" getenv dup -1 <> if
+		swap drop 0>
+	else drop false then
+	or \ previous boolean ( or ) boot_multicons
+;
+
 \ Private definitions
 
 vocabulary support-functions
Index: frames.4th
===================================================================
--- frames.4th	(revision 242835)
+++ frames.4th	(working copy)
@@ -12,6 +12,11 @@ variable rt_el
 variable rb_el
 variable fill
 
+\ ASCII frames (used when serial console is detected)
+ 45 constant ascii_dash
+124 constant ascii_pipe
+ 43 constant ascii_plus
+
 s" arch-pc98" environment? [if]
 	\ Single frames
 	149 constant sh_el
@@ -63,7 +68,17 @@ s" arch-pc98" environment? [if]
 	loop
 ;
 
+: f_ascii ( -- )	( -- )	\ set frames to ascii
+	ascii_dash h_el !
+	ascii_pipe v_el !
+	ascii_plus lt_el !
+	ascii_plus lb_el !
+	ascii_plus rt_el !
+	ascii_plus rb_el !
+;
+
 : f_single	( -- )	\ set frames to single
+	boot_serial? if f_ascii exit then
 	sh_el h_el !
 	sv_el v_el !
 	slt_el lt_el !
@@ -73,6 +88,7 @@ s" arch-pc98" environment? [if]
 ;
 
 : f_double	( -- )	\ set frames to double
+	boot_serial? if f_ascii exit then
 	dh_el h_el !
 	dv_el v_el !
 	dlt_el lt_el !

--Apple-Mail=_C87912D6-5E37-4720-976F-F6BD7A650FD8
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="windows-1252"



NOTE: I'm taking into consideration within the new "boot_serial?" =
function that /boot/defaults/loader.conf says this about boot_serial and =
boot_multicons=85

# The following boot_ variables are enabled by setting them to any =
value.
# Their presence in the kernel environment (see kenv(1)) has the same
# effect as setting the given boot flag (see boot(8)).

--=20
Devin=

--Apple-Mail=_C87912D6-5E37-4720-976F-F6BD7A650FD8--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?EA615AED-38B9-4A68-B86A-3784351E150C>