summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authordteske <dteske@FreeBSD.org>2015-04-22 01:08:40 +0000
committerdteske <dteske@FreeBSD.org>2015-04-22 01:08:40 +0000
commit8bc086afd36687c997b22a697e2b40543b248c21 (patch)
treeebacd763d78eeeb1bb3f049fbc90ab8bee84223c /sys
parent3d58bff4f8d3d50515f7efaec955d0c92dfb2774 (diff)
downloadFreeBSD-src-8bc086afd36687c997b22a697e2b40543b248c21.zip
FreeBSD-src-8bc086afd36687c997b22a697e2b40543b248c21.tar.gz
MFC revisions 277693,278335,280382-280385,280923-280926,280931,
280933-280939,280974-280976,281002,281009,281081,281176-281180, 281271,281275,281616 (described in-breif below): r277693: Font fix (des) r278335: Revert that r280382: Whitespace, comments, and copyright update r280383: Prevent inadvertent bootlock condition r280384: Increase max passowrd length from 16 to 255 chars r280385: Add missing variable hints to loader.conf(5) defaults r280923: Whitespace r280924: Comments r280925: Optimize bootmsg to use fg/bg/me from screen.4th r280926: Whitespace and cleanup r280931: Comments r280933: Move beastie to logo-*.4th; brands to brand-*.4th r280934: Add remainder of supported ANSI escape sequences r280935: Securely overwrite (zero) user input after password checks r280936: Use equals for ASCII double frames r280937: Solve dreaded "dictionary full" issue r280938: Add "GELI Passphrase:" prompt to boot loader r280939: Revert that (premature commit) r280974: Use fg/b/me from screen.4th instead of literals r280975: Eliminate literal escape sequences from *.4th r280976: Use ^[[m mode-ending versus ^[[37m r281002: Install newly added brand-*.4th and logo-*.4th files (jkim) r281009: Revert .PATH changes to fix mips build (jkim) r281081: Make sure forth manpages are only installed once (bapt) r281176: Back to previous mode-endings based on feedback r281177: Back to previous mode-endings based on feedback r281178: Back to previous mode-endings based on feedback r281179: Back to previous mode-endings based on feedback r281180: Eliminate literal escape sequences from *.rc r281271: Fix a bootlock condition if loader_version is set NB: Commit message of r281271 has a typo, s/_logo/_version/ r281275: Re-do proper mode-endings r281616: Add "GELI Passphrase:" prompt to boot loader Relnotes: Added "GELI Passphrase:" prompt to boot loader
Diffstat (limited to 'sys')
-rw-r--r--sys/boot/Makefile1
-rw-r--r--sys/boot/arm/uboot/Makefile6
-rw-r--r--sys/boot/common/Makefile.inc10
-rw-r--r--sys/boot/forth/Makefile13
-rw-r--r--sys/boot/forth/Makefile.inc25
-rw-r--r--sys/boot/forth/beastie.4th231
-rw-r--r--sys/boot/forth/brand-fbsd.4th46
-rw-r--r--sys/boot/forth/brand.4th92
-rw-r--r--sys/boot/forth/check-password.4th161
-rw-r--r--sys/boot/forth/check-password.4th.842
-rw-r--r--sys/boot/forth/delay.4th9
-rw-r--r--sys/boot/forth/frames.4th43
-rw-r--r--sys/boot/forth/loader.4th27
-rw-r--r--sys/boot/forth/loader.conf3
-rw-r--r--sys/boot/forth/logo-beastie.4th61
-rw-r--r--sys/boot/forth/logo-beastiebw.4th59
-rw-r--r--sys/boot/forth/logo-fbsdbw.4th53
-rw-r--r--sys/boot/forth/logo-orb.4th55
-rw-r--r--sys/boot/forth/logo-orbbw.4th54
-rw-r--r--sys/boot/forth/menu-commands.4th10
-rw-r--r--sys/boot/forth/menu.4th512
-rw-r--r--sys/boot/forth/menu.rc33
-rw-r--r--sys/boot/forth/menusets.4th27
-rw-r--r--sys/boot/forth/pnp.4th2
-rw-r--r--sys/boot/forth/screen.4th86
-rw-r--r--sys/boot/forth/support.4th23
-rw-r--r--sys/boot/forth/version.4th31
-rw-r--r--sys/boot/i386/loader/Makefile6
-rw-r--r--sys/boot/pc98/loader/Makefile6
-rw-r--r--sys/boot/powerpc/ofw/Makefile6
-rw-r--r--sys/boot/powerpc/ps3/Makefile7
-rw-r--r--sys/boot/sparc64/loader/Makefile6
-rw-r--r--sys/kern/init_main.c3
33 files changed, 1037 insertions, 712 deletions
diff --git a/sys/boot/Makefile b/sys/boot/Makefile
index 0d6441d..3b098e9 100644
--- a/sys/boot/Makefile
+++ b/sys/boot/Makefile
@@ -6,6 +6,7 @@
.if ${MK_FORTH} != "no"
# Build the add-in FORTH interpreter.
SUBDIR+= ficl
+SUBDIR+= forth
.endif
# Pick the machine-dependent subdir based on the target architecture.
diff --git a/sys/boot/arm/uboot/Makefile b/sys/boot/arm/uboot/Makefile
index 1c44812..8f718be 100644
--- a/sys/boot/arm/uboot/Makefile
+++ b/sys/boot/arm/uboot/Makefile
@@ -137,11 +137,7 @@ ldscript.generated::
.if !defined(LOADER_ONLY)
.PATH: ${.CURDIR}/../../forth
-FILES+= loader.help loader.4th support.4th loader.conf
-FILES+= screen.4th frames.4th beastie.4th
-FILES+= brand.4th check-password.4th color.4th delay.4th
-FILES+= menu.4th menu-commands.4th menusets.4th shortcuts.4th version.4th
-FILESDIR_loader.conf= /boot/defaults
+.include "${.CURDIR}/../../forth/Makefile.inc"
# Put sample loader.rc and menu.rc on disk but don't enable them
# by default.
diff --git a/sys/boot/common/Makefile.inc b/sys/boot/common/Makefile.inc
index a2dccdf..edfca67 100644
--- a/sys/boot/common/Makefile.inc
+++ b/sys/boot/common/Makefile.inc
@@ -56,16 +56,6 @@ SRCS+= pnp.c
# Forth interpreter
.if defined(BOOT_FORTH)
SRCS+= interp_forth.c
-MAN+= ../forth/beastie.4th.8
-MAN+= ../forth/brand.4th.8
-MAN+= ../forth/check-password.4th.8
-MAN+= ../forth/color.4th.8
-MAN+= ../forth/delay.4th.8
-MAN+= ../forth/loader.conf.5
-MAN+= ../forth/loader.4th.8
-MAN+= ../forth/menu.4th.8
-MAN+= ../forth/menusets.4th.8
-MAN+= ../forth/version.4th.8
.endif
.if defined(BOOT_PROMPT_123)
diff --git a/sys/boot/forth/Makefile b/sys/boot/forth/Makefile
new file mode 100644
index 0000000..dc7d29d
--- /dev/null
+++ b/sys/boot/forth/Makefile
@@ -0,0 +1,13 @@
+# $FreeBSD$
+
+MAN+= beastie.4th.8 \
+ brand.4th.8 \
+ check-password.4th.8 \
+ color.4th.8 \
+ delay.4th.8 \
+ loader.conf.5 \
+ loader.4th.8 \
+ menu.4th.8 \
+ menusets.4th.8
+
+.include <bsd.prog.mk>
diff --git a/sys/boot/forth/Makefile.inc b/sys/boot/forth/Makefile.inc
new file mode 100644
index 0000000..97ab433
--- /dev/null
+++ b/sys/boot/forth/Makefile.inc
@@ -0,0 +1,25 @@
+# $FreeBSD$
+
+FILES+= beastie.4th
+FILES+= brand.4th
+FILES+= brand-fbsd.4th
+FILES+= check-password.4th
+FILES+= color.4th
+FILES+= delay.4th
+FILES+= frames.4th
+FILES+= loader.4th
+FILES+= loader.conf
+FILES+= loader.help
+FILES+= logo-beastie.4th
+FILES+= logo-beastiebw.4th
+FILES+= logo-fbsdbw.4th
+FILES+= logo-orb.4th
+FILES+= logo-orbbw.4th
+FILES+= menu.4th
+FILES+= menu-commands.4th
+FILES+= menusets.4th
+FILES+= screen.4th
+FILES+= shortcuts.4th
+FILES+= support.4th
+FILES+= version.4th
+FILESDIR_loader.conf= /boot/defaults
diff --git a/sys/boot/forth/beastie.4th b/sys/boot/forth/beastie.4th
index 2fc073d..9ede592 100644
--- a/sys/boot/forth/beastie.4th
+++ b/sys/boot/forth/beastie.4th
@@ -1,6 +1,6 @@
-\ Copyright (c) 2003 Scott Long <scottl@freebsd.org>
+\ Copyright (c) 2003 Scott Long <scottl@FreeBSD.org>
\ Copyright (c) 2003 Aleksander Fafula <alex@fafula.com>
-\ Copyright (c) 2006-2013 Devin Teske <dteske@FreeBSD.org>
+\ Copyright (c) 2006-2015 Devin Teske <dteske@FreeBSD.org>
\ All rights reserved.
\
\ Redistribution and use in source and binary forms, with or without
@@ -28,7 +28,7 @@
marker task-beastie.4th
-only forth definitions also support-functions
+only forth definitions
variable logoX
variable logoY
@@ -37,209 +37,52 @@ variable logoY
46 logoX !
4 logoY !
-: beastie-logo ( x y -- ) \ color BSD mascot (19 rows x 34 columns)
-
-2dup at-xy ." , ," 1+
-2dup at-xy ." /( )`" 1+
-2dup at-xy ." \ \___ / |" 1+
-2dup at-xy ." /- _ `-/ '" 1+
-2dup at-xy ." (/\/ \ \ /\" 1+
-2dup at-xy ." / / | ` \" 1+
-2dup at-xy ." O O ) / |" 1+
-2dup at-xy ." `-^--'`< '" 1+
-2dup at-xy ." (_.) _ ) /" 1+
-2dup at-xy ." `.___/` /" 1+
-2dup at-xy ." `-----' /" 1+
-2dup at-xy ." <----. __ / __ \" 1+
-2dup at-xy ." <----|====O)))==) \) /====|" 1+
-2dup at-xy ." <----' `--' `.__,' \" 1+
-2dup at-xy ." | |" 1+
-2dup at-xy ." \ / /\" 1+
-2dup at-xy ." ______( (_ / \______/" 1+
-2dup at-xy ." ,' ,-----' |" 1+
- at-xy ." `--{__________)"
-
- \ Put the cursor back at the bottom
- 0 25 at-xy
-;
-
-: beastiebw-logo ( x y -- ) \ B/W BSD mascot (19 rows x 34 columns)
-
- 2dup at-xy ." , ," 1+
- 2dup at-xy ." /( )`" 1+
- 2dup at-xy ." \ \___ / |" 1+
- 2dup at-xy ." /- _ `-/ '" 1+
- 2dup at-xy ." (/\/ \ \ /\" 1+
- 2dup at-xy ." / / | ` \" 1+
- 2dup at-xy ." O O ) / |" 1+
- 2dup at-xy ." `-^--'`< '" 1+
- 2dup at-xy ." (_.) _ ) /" 1+
- 2dup at-xy ." `.___/` /" 1+
- 2dup at-xy ." `-----' /" 1+
- 2dup at-xy ." <----. __ / __ \" 1+
- 2dup at-xy ." <----|====O)))==) \) /====|" 1+
- 2dup at-xy ." <----' `--' `.__,' \" 1+
- 2dup at-xy ." | |" 1+
- 2dup at-xy ." \ / /\" 1+
- 2dup at-xy ." ______( (_ / \______/" 1+
- 2dup at-xy ." ,' ,-----' |" 1+
- at-xy ." `--{__________)"
-
- \ Put the cursor back at the bottom
- 0 25 at-xy
-;
-
-: fbsdbw-logo ( x y -- ) \ "FreeBSD" logo in B/W (13 rows x 21 columns)
-
- \ We used to use the beastie himself as our default... until the
- \ eventual complaint derided his reign of the advanced boot-menu.
- \
- \ This is the replacement of beastie to satiate the haters of our
- \ beloved helper-daemon (ready to track down and spear bugs with
- \ his trident and sporty sneakers; see above).
- \
- \ Since we merely just changed the default and not the default-
- \ location, below is an adjustment to the passed-in coordinates,
- \ forever influenced by the proper location of beastie himself
- \ kept as the default loader_logo_x/loader_logo_y values.
- \
- 5 + swap 6 + swap
-
- 2dup at-xy ." ______" 1+
- 2dup at-xy ." | ____| __ ___ ___ " 1+
- 2dup at-xy ." | |__ | '__/ _ \/ _ \" 1+
- 2dup at-xy ." | __|| | | __/ __/" 1+
- 2dup at-xy ." | | | | | | |" 1+
- 2dup at-xy ." |_| |_| \___|\___|" 1+
- 2dup at-xy ." ____ _____ _____" 1+
- 2dup at-xy ." | _ \ / ____| __ \" 1+
- 2dup at-xy ." | |_) | (___ | | | |" 1+
- 2dup at-xy ." | _ < \___ \| | | |" 1+
- 2dup at-xy ." | |_) |____) | |__| |" 1+
- 2dup at-xy ." | | | |" 1+
- at-xy ." |____/|_____/|_____/"
-
- \ Put the cursor back at the bottom
- 0 25 at-xy
-;
-
-: orb-logo ( x y -- ) \ color Orb mascot (15 rows x 30 columns)
-
- 3 + \ beastie adjustment (see `fbsdbw-logo' comments above)
-
- 2dup at-xy ." ``` `" 1+
- 2dup at-xy ." s` `.....---.......--.``` -/" 1+
- 2dup at-xy ." +o .--` /y:` +." 1+
- 2dup at-xy ." yo`:. :o `+-" 1+
- 2dup at-xy ." y/ -/` -o/" 1+
- 2dup at-xy ." .- ::/sy+:." 1+
- 2dup at-xy ." / `-- /" 1+
- 2dup at-xy ." `: :`" 1+
- 2dup at-xy ." `: :`" 1+
- 2dup at-xy ." / /" 1+
- 2dup at-xy ." .- -." 1+
- 2dup at-xy ." -- -." 1+
- 2dup at-xy ." `:` `:`" 1+
- 2dup at-xy ." .-- `--." 1+
- at-xy ." .---.....----."
-
- \ Put the cursor back at the bottom
- 0 25 at-xy
-;
-
-: orbbw-logo ( x y -- ) \ B/W Orb mascot (15 rows x 32 columns)
-
- 3 + \ beastie adjustment (see `fbsdbw-logo' comments above)
-
- 2dup at-xy ." ``` `" 1+
- 2dup at-xy ." s` `.....---.......--.``` -/" 1+
- 2dup at-xy ." +o .--` /y:` +." 1+
- 2dup at-xy ." yo`:. :o `+-" 1+
- 2dup at-xy ." y/ -/` -o/" 1+
- 2dup at-xy ." .- ::/sy+:." 1+
- 2dup at-xy ." / `-- /" 1+
- 2dup at-xy ." `: :`" 1+
- 2dup at-xy ." `: :`" 1+
- 2dup at-xy ." / /" 1+
- 2dup at-xy ." .- -." 1+
- 2dup at-xy ." -- -." 1+
- 2dup at-xy ." `:` `:`" 1+
- 2dup at-xy ." .-- `--." 1+
- at-xy ." .---.....----."
-
- \ Put the cursor back at the bottom
- 0 25 at-xy
-;
-
\ This function draws any number of beastie logos at (loader_logo_x,
\ loader_logo_y) if defined, else (46,4) (to the right of the menu). To choose
\ your beastie, set the variable `loader_logo' to the respective logo name.
\
-\ Currently available:
-\
-\ NAME DESCRIPTION
-\ beastie Color ``Helper Daemon'' mascot (19 rows x 34 columns)
-\ beastiebw B/W ``Helper Daemon'' mascot (19 rows x 34 columns)
-\ fbsdbw "FreeBSD" logo in B/W (13 rows x 21 columns)
-\ orb Color ``Orb'' mascot (15 rows x 30 columns) (2nd default)
-\ orbbw B/W ``Orb'' mascot (15 rows x 32 columns)
-\ tribute Color ``Tribute'' (must fit 19 rows x 34 columns) (default)
-\ tributebw B/W ``Tribute'' (must fit 19 rows x 34 columns)
-\
-\ NOTE: Setting `loader_logo' to an undefined value (such as "none") will
-\ prevent beastie from being drawn.
+\ NOTE: Each is defined as a logo function in /boot/logo-${loader_logo}.4th
+\ NOTE: If `/boot/logo-${loader_logo}.4th' does not exist or does not define
+\ a `logo' function, no beastie is drawn.
\
: draw-beastie ( -- ) \ at (loader_logo_x,loader_logo_y), else (46,4)
s" loader_logo_x" getenv dup -1 <> if
?number 1 = if logoX ! then
- else
- drop
- then
+ else drop then
s" loader_logo_y" getenv dup -1 <> if
?number 1 = if logoY ! then
- else
- drop
- then
+ else drop then
- s" loader_logo" getenv dup -1 <> if
- dup 5 + allocate if ENOMEM throw then
- 0 2swap strcat s" -logo" strcat
- over -rot ( a-addr/u -- a-addr a-addr/u )
- sfind ( a-addr a-addr/u -- a-addr xt bool )
- rot ( a-addr xt bool -- xt bool a-addr )
- free ( xt bool a-addr -- xt bool ior )
- if EFREE throw then
+
+ \ If `logo' is defined, execute it
+ s" logo" sfind ( -- xt|0 bool ) if
+ logoX @ logoY @ rot execute
else
- 0 ( cruft -- cruft bool ) \ load the default below
- then
- 0= if
- drop ( cruft -- )
- loader_color? if
- ['] orb-logo
+ \ Not defined; try-include desired logo file
+ drop ( xt = 0 ) \ cruft
+ s" loader_logo" getenv dup -1 = over 0= or if
+ dup 0= if 2drop else drop then \ getenv result unused
+ loader_color? if
+ s" try-include /boot/logo-orb.4th"
+ else
+ s" try-include /boot/logo-orbbw.4th"
+ then
else
- ['] orbbw-logo
+ 2drop ( c-addr/u -- ) \ getenv result unused
+ s" try-include /boot/logo-${loader_logo}.4th"
then
+ evaluate
+ 1 spaces
+
+ \ Execute `logo' if defined now
+ s" logo" sfind if
+ logoX @ logoY @ rot execute
+ else drop then
then
- logoX @ logoY @ rot execute
;
-: clear-beastie ( -- ) \ clears beastie from the screen
- logoX @ logoY @
- 2dup at-xy 34 spaces 1+ 2dup at-xy 34 spaces 1+
- 2dup at-xy 34 spaces 1+ 2dup at-xy 34 spaces 1+
- 2dup at-xy 34 spaces 1+ 2dup at-xy 34 spaces 1+
- 2dup at-xy 34 spaces 1+ 2dup at-xy 34 spaces 1+
- 2dup at-xy 34 spaces 1+ 2dup at-xy 34 spaces 1+
- 2dup at-xy 34 spaces 1+ 2dup at-xy 34 spaces 1+
- 2dup at-xy 34 spaces 1+ 2dup at-xy 34 spaces 1+
- 2dup at-xy 34 spaces 1+ 2dup at-xy 34 spaces 1+
- 2dup at-xy 34 spaces 1+ 2dup at-xy 34 spaces 1+
- 2dup at-xy 34 spaces 2drop
-
- \ Put the cursor back at the bottom
- 0 25 at-xy
-;
+also support-functions
: beastie-start ( -- ) \ starts the menu
s" console" getenv dup -1 <> if
@@ -247,8 +90,7 @@ variable logoY
s" set beastie_disable=YES" evaluate
then
else drop then
- s" beastie_disable" getenv
- dup -1 <> if
+ s" beastie_disable" getenv dup -1 <> if
s" YES" compare-insensitive 0= if
any_conf_read? if
load_kernel
@@ -256,12 +98,9 @@ variable logoY
then
exit \ to autoboot (default)
then
- else
- drop
- then
+ else drop then
- s" loader_delay" getenv
- -1 = if
+ s" loader_delay" getenv -1 = if
s" include /boot/menu.rc" evaluate
else
drop
@@ -272,4 +111,4 @@ variable logoY
then
;
-only forth also
+only forth definitions
diff --git a/sys/boot/forth/brand-fbsd.4th b/sys/boot/forth/brand-fbsd.4th
new file mode 100644
index 0000000..9cd017f
--- /dev/null
+++ b/sys/boot/forth/brand-fbsd.4th
@@ -0,0 +1,46 @@
+\ Copyright (c) 2006-2015 Devin Teske <dteske@FreeBSD.org>
+\ All rights reserved.
+\
+\ Redistribution and use in source and binary forms, with or without
+\ modification, are permitted provided that the following conditions
+\ are met:
+\ 1. Redistributions of source code must retain the above copyright
+\ notice, this list of conditions and the following disclaimer.
+\ 2. Redistributions in binary form must reproduce the above copyright
+\ notice, this list of conditions and the following disclaimer in the
+\ documentation and/or other materials provided with the distribution.
+\
+\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+\ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+\ SUCH DAMAGE.
+\
+\ $FreeBSD$
+
+2 brandX ! 1 brandY ! \ Initialize brand placement defaults
+
+: brand+ ( x y c-addr/u -- x y' )
+ 2swap 2dup at-xy 2swap \ position the cursor
+ type \ print to the screen
+ 1+ \ increase y for next time we're called
+;
+
+: brand ( x y -- ) \ "FreeBSD" [wide] logo in B/W (7 rows x 42 columns)
+
+ s" ______ ____ _____ _____ " brand+
+ s" | ____| | _ \ / ____| __ \ " brand+
+ s" | |___ _ __ ___ ___ | |_) | (___ | | | |" brand+
+ s" | ___| '__/ _ \/ _ \| _ < \___ \| | | |" brand+
+ s" | | | | | __/ __/| |_) |____) | |__| |" brand+
+ s" | | | | | | || | | |" brand+
+ s" |_| |_| \___|\___||____/|_____/|_____/ " brand+
+
+ 2drop
+;
diff --git a/sys/boot/forth/brand.4th b/sys/boot/forth/brand.4th
index 28d3c5c..39a9bfa 100644
--- a/sys/boot/forth/brand.4th
+++ b/sys/boot/forth/brand.4th
@@ -1,4 +1,4 @@
-\ Copyright (c) 2006-2011 Devin Teske <dteske@FreeBSD.org>
+\ Copyright (c) 2006-2015 Devin Teske <dteske@FreeBSD.org>
\ All rights reserved.
\
\ Redistribution and use in source and binary forms, with or without
@@ -29,74 +29,46 @@ marker task-brand.4th
variable brandX
variable brandY
-\ Initialize logo placement
+\ Initialize brand placement to defaults
2 brandX !
1 brandY !
-: fbsd-logo ( x y -- ) \ "FreeBSD" [wide] logo in B/W (7 rows x 42 columns)
-
- 2dup at-xy ." ______ ____ _____ _____ " 1+
- 2dup at-xy ." | ____| | _ \ / ____| __ \ " 1+
- 2dup at-xy ." | |___ _ __ ___ ___ | |_) | (___ | | | |" 1+
- 2dup at-xy ." | ___| '__/ _ \/ _ \| _ < \___ \| | | |" 1+
- 2dup at-xy ." | | | | | __/ __/| |_) |____) | |__| |" 1+
- 2dup at-xy ." | | | | | | || | | |" 1+
- at-xy ." |_| |_| \___|\___||____/|_____/|_____/ "
-
- \ Put the cursor back at the bottom
- 0 25 at-xy
-;
-
-\ This function draws any number of company logos at (loader_brand_x,
-\ loader_brand_y) if defined, or (2,1) (top-left) if not defined. To choose
-\ your logo, set the variable `loader_brand' to the respective logo name.
+\ This function draws any number of company brands at (loader_brand_x,
+\ loader_brand_y) if defined, or (2,1) (top-left). To choose your brand, set
+\ the variable `loader_brand' to the respective brand name.
\
-\ Currently available:
-\
-\ NAME DESCRIPTION
-\ fbsd FreeBSD logo
+\ NOTE: Each is defined as a brand function in /boot/brand-${loader_brand}.4th
+\ NOTE: If `/boot/brand-${loader_brand}.4th' does not exist or does not define
+\ a `brand' function, no brand is drawn.
\
-\ NOTE: Setting `loader_brand' to the value of an existing function
-\ (such as "mycustom-brand") will cause that symbol to be executed.
-\ NOTE: Setting `loader_brand' to an undefined value (such as "none") will
-\ prevent any brand from being drawn.
-\
-: draw-brand ( -- )
+: draw-brand ( -- ) \ at (loader_brand_x,loader_brand_y), else (2,1)
s" loader_brand_x" getenv dup -1 <> if
- ?number 1 = if
- brandX !
- then
- else
- drop
- then
-
+ ?number 1 = if brandX ! then
+ else drop then
s" loader_brand_y" getenv dup -1 <> if
- ?number 1 = if
- brandY !
- then
- else
- drop
- then
+ ?number 1 = if brandY ! then
+ else drop then
- s" loader_brand" getenv dup -1 = if
- brandX @ brandY @ fbsd-logo
- drop exit
- then
+ \ If `brand' is defined, execute it
+ s" brand" sfind ( -- xt|0 bool ) if
+ brandX @ brandY @ rot execute
+ else
+ \ Not defined; try-include desired brand file
+ drop ( xt = 0 ) \ cruft
+ s" loader_brand" getenv dup -1 = over 0= or if
+ dup 0= if 2drop else drop then \ getenv result unused
+ s" try-include /boot/brand-fbsd.4th"
+ else
+ 2drop ( c-addr/u -- ) \ getenv result unused
+ s" try-include /boot/brand-${loader_brand}.4th"
+ then
+ evaluate
+ 1 spaces
- 2dup s" fbsd" compare-insensitive 0= if
- brandX @ brandY @ fbsd-logo
- 2drop exit
+ \ Execute `brand' if defined now
+ s" brand" sfind if
+ brandX @ brandY @ rot execute
+ else drop then
then
-
- \ if it refers to a raw symbol then run that function
- sfind if
- brandX @ brandY @
- 2 roll
- execute
- else
- drop
- then
-
- 2drop
;
diff --git a/sys/boot/forth/check-password.4th b/sys/boot/forth/check-password.4th
index 26d6b94..d41777c 100644
--- a/sys/boot/forth/check-password.4th
+++ b/sys/boot/forth/check-password.4th
@@ -1,4 +1,4 @@
-\ Copyright (c) 2006-2012 Devin Teske <dteske@FreeBSD.org>
+\ Copyright (c) 2006-2015 Devin Teske <dteske@FreeBSD.org>
\ All rights reserved.
\
\ Redistribution and use in source and binary forms, with or without
@@ -28,15 +28,19 @@ marker task-check-password.4th
include /boot/screen.4th
-13 constant enter_key \ The decimal ASCII value for Enter key
-8 constant bs_key \ The decimal ASCII value for Backspace key
-16 constant readmax \ Maximum number of characters for the password
+vocabulary password-processing
+only forth also password-processing definitions
-variable readX \ Current X offset (column)(used by read)
-variable read-start \ Starting X offset (column)(used by read)
+13 constant enter_key \ The decimal ASCII value for Enter key
+8 constant bs_key \ The decimal ASCII value for Backspace key
+21 constant ctrl_u \ The decimal ASCII value for Ctrl-U sequence
+255 constant readmax \ Maximum number of characters for the password
-create readval 16 allot \ input obtained (maximum 16 characters)
-variable readlen \ input length
+variable read-tick \ Twiddle position (used by read)
+variable read-start \ Starting X offset (column)(used by read)
+
+create readval readmax allot \ input obtained (up to readmax characters)
+variable readlen \ input length
\ This function blocks program flow (loops forever) until a key is pressed.
\ The key that was pressed is added to the top of the stack in the form of its
@@ -48,37 +52,50 @@ variable readlen \ input length
\
: sgetkey ( -- )
- begin \ Loop forever
- key? if \ Was a key pressed? (see loader(8))
-
- drop \ Remove stack-cruft
- key \ Get the key that was pressed
-
- \ Check key pressed (see loader(8)) and input limit
- dup 0<> if ( and ) readlen @ readmax < if
-
- \ Echo an asterisk (unless Backspace/Enter)
- dup bs_key <> if ( and ) dup enter_key <> if
- ." *" \ Echo an asterisk
- then then
-
- exit \ Exit from the function
- then then
+ begin \ Loop forever
+ key? if \ Was a key pressed? (see loader(8))
+ drop \ Remove stack-cruft
+ key \ Get the key that was pressed
+
+ \ Check key pressed (see loader(8)) and input limit
+ dup 0<> if ( and ) readlen @ readmax < if
+ \ Spin the twiddle and then exit this function
+ read-tick @ dup 1+ 4 mod read-tick !
+ 2 spaces
+ dup 0 = if ( 1 ) ." /" else
+ dup 1 = if ( 2 ) ." -" else
+ dup 2 = if ( 3 ) ." \" else
+ dup 3 = if ( 4 ) ." |" else
+ 1 spaces
+ then then then then drop
+ read-start @ 25 at-xy
+ exit
+ then then
+
+ \ Always allow Backspace, Enter, and Ctrl-U
+ dup bs_key = if exit then
+ dup enter_key = if exit then
+ dup ctrl_u = if exit then
+ then
+ 50 ms \ Sleep for 50 milliseconds (see loader(8))
+ again
+;
- \ Always allow Backspace and Enter
- dup bs_key = if exit then
- dup enter_key = if exit then
+: cfill ( c c-addr/u -- )
+ begin dup 0> while
+ -rot 2dup c! 1+ rot 1-
+ repeat 2drop drop
+;
- then
- 50 ms \ Sleep for 50 milliseconds (see loader(8))
- again
+: read-reset ( -- )
+ 0 readlen !
+ 0 readval readmax cfill
;
-: read ( String prompt -- )
+: read ( c-addr/u -- ) \ Expects string prompt as stack input
0 25 at-xy \ Move the cursor to the bottom-left
dup 1+ read-start ! \ Store X offset after the prompt
- read-start @ readX ! \ copy value to the current X offset
0 readlen ! \ Initialize the read length
type \ Print the prompt
@@ -90,63 +107,53 @@ variable readlen \ input length
\ security reasons). If Enter is pressed, we process the
\ password, otherwise augment the key to a string.
- \ If the key that was entered was not Enter, advance
- dup enter_key <> if
- readX @ 1+ readX ! \ Advance the column
- readlen @ 1+ readlen ! \ Increment input length
- then
-
- \ Handle backspacing
- dup bs_key = if
- readX @ 2 - readX ! \ Set new cursor position
- readlen @ 2 - readlen ! \ Decrement input length
-
- \ Don't move behind starting position
- readX @ read-start @ < if
- read-start @ readX !
- then
- readlen @ 0< if
- 0 readlen !
- then
-
- \ Reposition cursor and erase character
- readX @ 25 at-xy 1 spaces readX @ 25 at-xy
- then
-
dup enter_key = if
- drop \ Clean up stack cruft
- 10 emit \ Echo new line
+ drop \ Clean up stack cruft
+ 3 spaces \ Erase the twiddle
+ 10 emit \ Echo new line
exit
- then
-
- \ If not Backspace or Enter, store the character
- dup bs_key <> if ( and ) dup enter_key <> if
-
- \ store the character in our buffer
- dup readval readlen @ 1- + c!
-
- then then
-
- drop \ drop the last key that was entered
-
+ else dup ctrl_u = if
+ 3 spaces read-start @ 25 at-xy \ Erase the twiddle
+ 0 readlen ! \ Reset input to NULL
+ else dup bs_key = if
+ readlen @ 1 - dup readlen ! \ Decrement input length
+ dup 0< if drop 0 dup readlen ! then \ Don't go negative
+ 0= if 3 spaces read-start @ 25 at-xy then \ Twiddle
+ else dup \ Store the character
+ \ NB: sgetkey prevents overflow by way of blocking
+ \ at readmax except for Backspace or Enter
+ readlen @ 1+ dup readlen ! 1- readval + c!
+ then then then
+
+ drop \ last key pressed
again \ Enter was not pressed; repeat
;
+only forth definitions also password-processing
+
: check-password ( -- )
\ Do not allow the user to proceed beyond this point if a boot-lock
\ password has been set (preventing even boot from proceeding)
s" bootlock_password" getenv dup -1 <> if
+ dup readmax > if drop readmax then
begin
s" Boot Password: " read ( prompt -- )
2dup readval readlen @ compare 0<>
while
3000 ms ." loader: incorrect password" 10 emit
repeat
- 2drop ( c-addr/u )
- else
- drop ( -1 ) \ getenv cruft
- then
+ 2drop read-reset
+ else drop then
+
+ \ Prompt for GEOM ELI (geli(8)) passphrase if enabled
+ s" geom_eli_passphrase_prompt" getenv dup -1 <> if
+ s" YES" compare-insensitive 0= if
+ s" GELI Passphrase: " read ( prompt -- )
+ readval readlen @ s" kern.geom.eli.passphrase" setenv
+ read-reset
+ then
+ else drop then
\ Exit if a password was not set
s" password" getenv -1 = if exit else drop then
@@ -159,12 +166,14 @@ variable readlen \ input length
\ Only reached if autoboot fails for any reason (including if/when
\ the user aborts/escapes the countdown sequence leading to boot).
- s" password" getenv
+ s" password" getenv dup readmax > if drop readmax then
begin
s" Password: " read ( prompt -- )
- 2dup readval readlen @ compare 0= if
- 2drop exit \ Correct password
+ 2dup readval readlen @ compare 0= if \ Correct password?
+ 2drop read-reset exit
then
3000 ms ." loader: incorrect password" 10 emit
again
;
+
+only forth definitions
diff --git a/sys/boot/forth/check-password.4th.8 b/sys/boot/forth/check-password.4th.8
index e1f52b7..db0aa4b 100644
--- a/sys/boot/forth/check-password.4th.8
+++ b/sys/boot/forth/check-password.4th.8
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2011-2012 Devin Teske
+.\" Copyright (c) 2011-2015 Devin Teske
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd December 10, 2012
+.Dd March 20, 2015
.Dt CHECK-PASSWORD.4TH 8
.Os
.Sh NAME
@@ -33,8 +33,12 @@
.Sh DESCRIPTION
The file that goes by the name of
.Nm
-is a set of commands designed to either prevent booting or prevent modification
-of boot options without an appropriately configured password.
+is a set of commands designed to do one or more of the following:
+.Pp
+.Dl o Prevent booting without password
+.Dl o Prevent modification of boot options without password
+.Dl o Provide a password to mount geli(8) encrypted root disk(s)
+.Pp
The commands of
.Nm
by themselves are not enough for most uses.
@@ -58,14 +62,23 @@ The commands provided by it are:
.Pp
.Bl -tag -width disable-module_module -compact -offset indent
.It Ic check-password
-Dual-purpose function that can either protect the interactive boot menu or
-prevent boot without password (separately).
+Multi-purpose function that can protect the interactive boot menu,
+prevent boot without password, or prompt for geli(8) passphrase
+.Pq depending on Xr loader.conf 5 settings .
.Pp
First checks
.Va bootlock_password
and if-set, the user cannot continue until the correct password is entered.
.Pp
-Next checks
+Next, checks
+.Va geom_eli_passphrase_prompt
+and if set to
+.Li YES
+.Pq case-insensitive
+prompts the user to enter their GELI password for later mounting of the root
+device(s) during boot.
+.Pp
+Last, checks
.Va password
and if-set, tries to
.Ic autoboot
@@ -81,6 +94,11 @@ The environment variables that effect its behavior are:
Sets the bootlock password (up to 16 characters long) that is required by
.Ic check-password
to be entered before the system is allowed to boot.
+.It Va geom_eli_passphrase_prompt
+Selects whether loader(8) will prompt for GELI credentials, handing-off to the
+kernel for later mounting of
+.Xr geli 8
+encrypted root device(s).
.It Va password
Sets the password (up to 16 characters long) that is required by
.Ic check-password
@@ -122,6 +140,16 @@ to prevent booting without password:
.Bd -literal -offset indent -compact
bootlock_password="boot"
.Ed
+.Pp
+Add the following to
+.Xr loader.conf 5
+to generate a prompt at boot to collect GELI credentials for mounting
+.Xr geli 8
+encrypted root device(s):
+.Pp
+.Bd -literal -offset indent -compact
+geom_eli_passphrase_prompt="YES"
+.Ed
.Sh SEE ALSO
.Xr loader.conf 5 ,
.Xr loader 8 ,
diff --git a/sys/boot/forth/delay.4th b/sys/boot/forth/delay.4th
index 0d5ecbc..56dfcf0 100644
--- a/sys/boot/forth/delay.4th
+++ b/sys/boot/forth/delay.4th
@@ -1,4 +1,4 @@
-\ Copyright (c) 2008-2011 Devin Teske <dteske@FreeBSD.org>
+\ Copyright (c) 2008-2015 Devin Teske <dteske@FreeBSD.org>
\ All rights reserved.
\
\ Redistribution and use in source and binary forms, with or without
@@ -26,6 +26,9 @@
marker task-delay.4th
+vocabulary delay-processing
+only forth also delay-processing definitions
+
2 constant delay_default \ Default delay (in seconds)
3 constant etx_key \ End-of-Text character produced by Ctrl+C
13 constant enter_key \ Carriage-Return character produce by ENTER
@@ -36,6 +39,8 @@ variable delay_delay \ determined configurable delay duration
variable delay_cancelled \ state variable for user cancellation
variable delay_showdots \ whether continually print dots while waiting
+only forth definitions also delay-processing
+
: delay_execute ( -- )
\ make sure that we have a command to execute
@@ -110,3 +115,5 @@ variable delay_showdots \ whether continually print dots while waiting
evaluate \ evaluate/execute the command string
then
;
+
+only forth definitions
diff --git a/sys/boot/forth/frames.4th b/sys/boot/forth/frames.4th
index 5d6df24..0f8d460 100644
--- a/sys/boot/forth/frames.4th
+++ b/sys/boot/forth/frames.4th
@@ -1,9 +1,37 @@
-\ Words implementing frame drawing
-\ XXX Filled boxes are left as an exercise for the reader... ;-/
+\ Copyright (c) 2003 Scott Long <scottl@FreeBSD.org>
+\ Copyright (c) 2012-2015 Devin Teske <dteske@FreeBSD.org>
+\ All rights reserved.
+\
+\ Redistribution and use in source and binary forms, with or without
+\ modification, are permitted provided that the following conditions
+\ are met:
+\ 1. Redistributions of source code must retain the above copyright
+\ notice, this list of conditions and the following disclaimer.
+\ 2. Redistributions in binary form must reproduce the above copyright
+\ notice, this list of conditions and the following disclaimer in the
+\ documentation and/or other materials provided with the distribution.
+\
+\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+\ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+\ SUCH DAMAGE.
+\
\ $FreeBSD$
marker task-frames.4th
+vocabulary frame-drawing
+only forth also frame-drawing definitions
+
+\ XXX Filled boxes are left as an exercise for the reader... ;-/
+
variable h_el
variable v_el
variable lt_el
@@ -14,6 +42,7 @@ variable fill
\ ASCII frames (used when serial console is detected)
45 constant ascii_dash
+ 61 constant ascii_equal
124 constant ascii_pipe
43 constant ascii_plus
@@ -61,6 +90,8 @@ s" arch-pc98" environment? [if]
178 constant fill_bright
[then]
+only forth definitions also frame-drawing
+
: hline ( len x y -- ) \ Draw horizontal single line
at-xy \ move cursor
0 do
@@ -88,7 +119,11 @@ s" arch-pc98" environment? [if]
;
: f_double ( -- ) \ set frames to double
- boot_serial? if f_ascii exit then
+ boot_serial? if
+ f_ascii
+ ascii_equal h_el !
+ exit
+ then
dh_el h_el !
dv_el v_el !
dlt_el lt_el !
@@ -126,3 +161,5 @@ s" arch-pc98" environment? [if]
f_single
fill_none fill !
+
+only forth definitions
diff --git a/sys/boot/forth/loader.4th b/sys/boot/forth/loader.4th
index 55778ff..43d2a8e 100644
--- a/sys/boot/forth/loader.4th
+++ b/sys/boot/forth/loader.4th
@@ -1,4 +1,5 @@
-\ Copyright (c) 1999 Daniel C. Sobral <dcs@freebsd.org>
+\ Copyright (c) 1999 Daniel C. Sobral <dcs@FreeBSD.org>
+\ Copyright (c) 2011-2015 Devin Teske <dteske@FreeBSD.org>
\ All rights reserved.
\
\ Redistribution and use in source and binary forms, with or without
@@ -24,6 +25,8 @@
\
\ $FreeBSD$
+only forth definitions
+
s" arch-i386" environment? [if] [if]
s" loader_version" environment? [if]
11 < [if]
@@ -42,15 +45,16 @@ s" arch-i386" environment? [if] [if]
include /boot/support.4th
include /boot/color.4th
include /boot/delay.4th
+include /boot/check-password.4th
-only forth also support-functions also builtins definitions
+only forth definitions
: bootmsg ( -- )
- loader_color? if
- ." Booting..." cr
- else
- ." Booting..." cr
- then
+ loader_color? dup ( -- bool bool )
+ if 7 fg 4 bg then
+ ." Booting..."
+ if me then
+ cr
;
: try-menu-unset
@@ -77,6 +81,8 @@ only forth also support-functions also builtins definitions
then
;
+only forth also support-functions also builtins definitions
+
: boot
0= if ( interpreted ) get_arguments then
@@ -120,15 +126,13 @@ only forth also support-functions also builtins definitions
?dup 0= if 0 1 autoboot then
;
-also forth definitions also builtins
+also forth definitions previous
builtin: boot
builtin: boot-conf
only forth definitions also support-functions
-include /boot/check-password.4th
-
\ ***** start
\
\ Initializes support.4th global variables, sets loader_conf_files,
@@ -244,5 +248,4 @@ include /boot/check-password.4th
then
; immediate \ interpret immediately for access to `source' (aka tib)
-only forth also
-
+only forth definitions
diff --git a/sys/boot/forth/loader.conf b/sys/boot/forth/loader.conf
index 8e06029..94c175c 100644
--- a/sys/boot/forth/loader.conf
+++ b/sys/boot/forth/loader.conf
@@ -60,6 +60,9 @@ entropy_cache_type="/boot/entropy"
# allowed to interrupt autoboot process and
# escape to the loader prompt, set to
# "NO" to disable autobooting
+#password="" # Prevent changes to boot options
+#bootlock_password="" # Prevent booting (see check-password.4th(8))
+#geom_eli_passphrase_prompt="NO" # Prompt for geli(8) passphrase to mount root
#beastie_disable="NO" # Turn the beastie boot menu on and off
#kernels="kernel kernel.old" # Kernels to display in the boot menu
#loader_logo="orbbw" # Desired logo: orbbw, orb, fbsdbw, beastiebw, beastie, none
diff --git a/sys/boot/forth/logo-beastie.4th b/sys/boot/forth/logo-beastie.4th
new file mode 100644
index 0000000..671eb5e
--- /dev/null
+++ b/sys/boot/forth/logo-beastie.4th
@@ -0,0 +1,61 @@
+\ Copyright (c) 2003 Scott Long <scottl@FreeBSD.org>
+\ Copyright (c) 2003 Aleksander Fafula <alex@fafula.com>
+\ Copyright (c) 2006-2015 Devin Teske <dteske@FreeBSD.org>
+\ All rights reserved.
+\
+\ Redistribution and use in source and binary forms, with or without
+\ modification, are permitted provided that the following conditions
+\ are met:
+\ 1. Redistributions of source code must retain the above copyright
+\ notice, this list of conditions and the following disclaimer.
+\ 2. Redistributions in binary form must reproduce the above copyright
+\ notice, this list of conditions and the following disclaimer in the
+\ documentation and/or other materials provided with the distribution.
+\
+\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+\ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+\ SUCH DAMAGE.
+\
+\ $FreeBSD$
+
+46 logoX ! 4 logoY ! \ Initialize logo placement defaults
+
+: logo+ ( x y c-addr/u -- x y' )
+ 2swap 2dup at-xy 2swap \ position the cursor
+ [char] @ escc! \ replace @ with Esc
+ type \ print to the screen
+ 1+ \ increase y for next time we're called
+;
+
+: logo ( x y -- ) \ color BSD mascot (19 rows x 34 columns)
+
+ s" @[31m, ," logo+
+ s" /( )`" logo+
+ s" \ \___ / |" logo+
+ s" /- @[m_@[31m `-/ '" logo+
+ s" (@[m/\/ \@[31m \ /\" logo+
+ s" @[m/ / |@[31m ` \" logo+
+ s" @[34mO O @[m) @[31m/ |" logo+
+ s" @[m`-^--'@[31m`< '" logo+
+ s" (_.) _ ) /" logo+
+ s" `.___/` /" logo+
+ s" `-----' /" logo+
+ s" @[33m<----.@[31m __ / __ \" logo+
+ s" @[33m<----|====@[31mO)))@[33m==@[31m) \) /@[33m====|" logo+
+ s" @[33m<----'@[31m `--' `.__,' \" logo+
+ s" | |" logo+
+ s" \ / /\" logo+
+ s" @[36m______@[31m( (_ / \______/" logo+
+ s" @[36m,' ,-----' |" logo+
+ s" `--{__________)@[m" logo+
+
+ 2drop
+;
diff --git a/sys/boot/forth/logo-beastiebw.4th b/sys/boot/forth/logo-beastiebw.4th
new file mode 100644
index 0000000..197099c
--- /dev/null
+++ b/sys/boot/forth/logo-beastiebw.4th
@@ -0,0 +1,59 @@
+\ Copyright (c) 2003 Scott Long <scottl@FreeBSD.org>
+\ Copyright (c) 2006-2015 Devin Teske <dteske@FreeBSD.org>
+\ All rights reserved.
+\
+\ Redistribution and use in source and binary forms, with or without
+\ modification, are permitted provided that the following conditions
+\ are met:
+\ 1. Redistributions of source code must retain the above copyright
+\ notice, this list of conditions and the following disclaimer.
+\ 2. Redistributions in binary form must reproduce the above copyright
+\ notice, this list of conditions and the following disclaimer in the
+\ documentation and/or other materials provided with the distribution.
+\
+\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+\ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+\ SUCH DAMAGE.
+\
+\ $FreeBSD$
+
+46 logoX ! 4 logoY ! \ Initialize logo placement defaults
+
+: logo+ ( x y c-addr/u -- x y' )
+ 2swap 2dup at-xy 2swap \ position the cursor
+ type \ print to the screen
+ 1+ \ increase y for next time we're called
+;
+
+: logo ( x y -- ) \ B/W BSD mascot (19 rows x 34 columns)
+
+ s" , ," logo+
+ s" /( )`" logo+
+ s" \ \___ / |" logo+
+ s" /- _ `-/ '" logo+
+ s" (/\/ \ \ /\" logo+
+ s" / / | ` \" logo+
+ s" O O ) / |" logo+
+ s" `-^--'`< '" logo+
+ s" (_.) _ ) /" logo+
+ s" `.___/` /" logo+
+ s" `-----' /" logo+
+ s" <----. __ / __ \" logo+
+ s" <----|====O)))==) \) /====|" logo+
+ s" <----' `--' `.__,' \" logo+
+ s" | |" logo+
+ s" \ / /\" logo+
+ s" ______( (_ / \______/" logo+
+ s" ,' ,-----' |" logo+
+ s" `--{__________)" logo+
+
+ 2drop
+;
diff --git a/sys/boot/forth/logo-fbsdbw.4th b/sys/boot/forth/logo-fbsdbw.4th
new file mode 100644
index 0000000..d4a532b
--- /dev/null
+++ b/sys/boot/forth/logo-fbsdbw.4th
@@ -0,0 +1,53 @@
+\ Copyright (c) 2003 Scott Long <scottl@FreeBSD.org>
+\ Copyright (c) 2006-2015 Devin Teske <dteske@FreeBSD.org>
+\ All rights reserved.
+\
+\ Redistribution and use in source and binary forms, with or without
+\ modification, are permitted provided that the following conditions
+\ are met:
+\ 1. Redistributions of source code must retain the above copyright
+\ notice, this list of conditions and the following disclaimer.
+\ 2. Redistributions in binary form must reproduce the above copyright
+\ notice, this list of conditions and the following disclaimer in the
+\ documentation and/or other materials provided with the distribution.
+\
+\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+\ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+\ SUCH DAMAGE.
+\
+\ $FreeBSD$
+
+52 logoX ! 9 logoY ! \ Initialize logo placement defaults
+
+: logo+ ( x y c-addr/u -- x y' )
+ 2swap 2dup at-xy 2swap \ position the cursor
+ type \ print to the screen
+ 1+ \ increase y for next time we're called
+;
+
+: logo ( x y -- ) \ "FreeBSD" logo in B/W (13 rows x 21 columns)
+
+ s" ______" logo+
+ s" | ____| __ ___ ___ " logo+
+ s" | |__ | '__/ _ \/ _ \" logo+
+ s" | __|| | | __/ __/" logo+
+ s" | | | | | | |" logo+
+ s" |_| |_| \___|\___|" logo+
+ s" ____ _____ _____" logo+
+ s" | _ \ / ____| __ \" logo+
+ s" | |_) | (___ | | | |" logo+
+ s" | _ < \___ \| | | |" logo+
+ s" | |_) |____) | |__| |" logo+
+ s" | | | |" logo+
+ s" |____/|_____/|_____/" logo+
+
+ 2drop
+;
diff --git a/sys/boot/forth/logo-orb.4th b/sys/boot/forth/logo-orb.4th
new file mode 100644
index 0000000..c2a504d
--- /dev/null
+++ b/sys/boot/forth/logo-orb.4th
@@ -0,0 +1,55 @@
+\ Copyright (c) 2006-2015 Devin Teske <dteske@FreeBSD.org>
+\ All rights reserved.
+\
+\ Redistribution and use in source and binary forms, with or without
+\ modification, are permitted provided that the following conditions
+\ are met:
+\ 1. Redistributions of source code must retain the above copyright
+\ notice, this list of conditions and the following disclaimer.
+\ 2. Redistributions in binary form must reproduce the above copyright
+\ notice, this list of conditions and the following disclaimer in the
+\ documentation and/or other materials provided with the distribution.
+\
+\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+\ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+\ SUCH DAMAGE.
+\
+\ $FreeBSD$
+
+46 logoX ! 7 logoY ! \ Initialize logo placement defaults
+
+: logo+ ( x y c-addr/u -- x y' )
+ 2swap 2dup at-xy 2swap \ position the cursor
+ [char] @ escc! \ replace @ with Esc
+ type \ print to the screen
+ 1+ \ increase y for next time we're called
+;
+
+: logo ( x y -- ) \ color Orb mascot (15 rows x 30 columns)
+
+ s" @[31m``` @[31;1m`@[31m" logo+
+ s" s` `.....---...@[31;1m....--.``` -/@[31m" logo+
+ s" +o .--` @[31;1m/y:` +.@[31m" logo+
+ s" yo`:. @[31;1m:o `+-@[31m" logo+
+ s" y/ @[31;1m-/` -o/@[31m" logo+
+ s" .- @[31;1m::/sy+:.@[31m" logo+
+ s" / @[31;1m`-- /@[31m" logo+
+ s" `: @[31;1m:`@[31m" logo+
+ s" `: @[31;1m:`@[31m" logo+
+ s" / @[31;1m/@[31m" logo+
+ s" .- @[31;1m-.@[31m" logo+
+ s" -- @[31;1m-.@[31m" logo+
+ s" `:` @[31;1m`:`" logo+
+ s" @[31;1m.-- `--." logo+
+ s" .---.....----.@[m" logo+
+
+ 2drop
+;
diff --git a/sys/boot/forth/logo-orbbw.4th b/sys/boot/forth/logo-orbbw.4th
new file mode 100644
index 0000000..11dc11c
--- /dev/null
+++ b/sys/boot/forth/logo-orbbw.4th
@@ -0,0 +1,54 @@
+\ Copyright (c) 2006-2015 Devin Teske <dteske@FreeBSD.org>
+\ All rights reserved.
+\
+\ Redistribution and use in source and binary forms, with or without
+\ modification, are permitted provided that the following conditions
+\ are met:
+\ 1. Redistributions of source code must retain the above copyright
+\ notice, this list of conditions and the following disclaimer.
+\ 2. Redistributions in binary form must reproduce the above copyright
+\ notice, this list of conditions and the following disclaimer in the
+\ documentation and/or other materials provided with the distribution.
+\
+\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+\ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+\ SUCH DAMAGE.
+\
+\ $FreeBSD$
+
+46 logoX ! 7 logoY ! \ Initialize logo placement defaults
+
+: logo+ ( x y c-addr/u -- x y' )
+ 2swap 2dup at-xy 2swap \ position the cursor
+ type \ print to the screen
+ 1+ \ increase y for next time we're called
+;
+
+: logo ( x y -- ) \ B/W Orb mascot (15 rows x 32 columns)
+
+ s" ``` `" logo+
+ s" s` `.....---.......--.``` -/" logo+
+ s" +o .--` /y:` +." logo+
+ s" yo`:. :o `+-" logo+
+ s" y/ -/` -o/" logo+
+ s" .- ::/sy+:." logo+
+ s" / `-- /" logo+
+ s" `: :`" logo+
+ s" `: :`" logo+
+ s" / /" logo+
+ s" .- -." logo+
+ s" -- -." logo+
+ s" `:` `:`" logo+
+ s" .-- `--." logo+
+ s" .---.....----." logo+
+
+ 2drop
+;
diff --git a/sys/boot/forth/menu-commands.4th b/sys/boot/forth/menu-commands.4th
index 70ae9d8..0784676 100644
--- a/sys/boot/forth/menu-commands.4th
+++ b/sys/boot/forth/menu-commands.4th
@@ -1,4 +1,4 @@
-\ Copyright (c) 2006-2013 Devin Teske <dteske@FreeBSD.org>
+\ Copyright (c) 2006-2015 Devin Teske <dteske@FreeBSD.org>
\ All rights reserved.
\
\ Redistribution and use in source and binary forms, with or without
@@ -28,11 +28,15 @@ marker task-menu-commands.4th
include /boot/menusets.4th
+only forth definitions
+
variable kernel_state
variable root_state
0 kernel_state !
0 root_state !
+also menu-namespace also menu-command-helpers
+
\
\ Boot
\
@@ -67,7 +71,7 @@ variable root_state
evaluate
;
-: altboot ( -- )
+: altboot ( N -- NOTREACHED )
s" boot_single" 2dup getenv -1 <> if
drop ( c-addr/u c-addr -- c-addr/u ) \ unused
unsetenv ( c-addr/u -- )
@@ -346,3 +350,5 @@ variable root_state
verbose_disable
2 goto_menu
;
+
+only forth definitions
diff --git a/sys/boot/forth/menu.4th b/sys/boot/forth/menu.4th
index 0239115..9127565 100644
--- a/sys/boot/forth/menu.4th
+++ b/sys/boot/forth/menu.4th
@@ -1,6 +1,6 @@
-\ Copyright (c) 2003 Scott Long <scottl@freebsd.org>
+\ Copyright (c) 2003 Scott Long <scottl@FreeBSD.org>
\ Copyright (c) 2003 Aleksander Fafula <alex@fafula.com>
-\ Copyright (c) 2006-2013 Devin Teske <dteske@FreeBSD.org>
+\ Copyright (c) 2006-2015 Devin Teske <dteske@FreeBSD.org>
\ All rights reserved.
\
\ Redistribution and use in source and binary forms, with or without
@@ -31,6 +31,12 @@ marker task-menu.4th
\ Frame drawing
include /boot/frames.4th
+vocabulary menu-infrastructure
+vocabulary menu-namespace
+vocabulary menu-command-helpers
+
+only forth also menu-infrastructure definitions
+
f_double \ Set frames to double (see frames.4th). Replace with
\ f_single if you want single frames.
46 constant dot \ ASCII definition of a period (in decimal)
@@ -57,20 +63,8 @@ variable menubllt \ Menu item bullet
variable menuX \ Menu X offset (columns)
variable menuY \ Menu Y offset (rows)
-\ Menu-item key association/detection
-variable menukey1
-variable menukey2
-variable menukey3
-variable menukey4
-variable menukey5
-variable menukey6
-variable menukey7
-variable menukey8
-variable menureboot
+\ Menu-item elements
variable menurebootadded
-variable menuacpi
-variable menuoptions
-variable menukernel
\ Parsing of kernels into menu-items
variable kernidx
@@ -84,6 +78,27 @@ variable menu_timeout \ determined configurable delay duration
variable menu_timeout_x \ column position of timeout message
variable menu_timeout_y \ row position of timeout message
+\ Containers for parsing kernels into menu-items
+create kerncapbuf 64 allot
+create kerndefault 64 allot
+create kernelsbuf 256 allot
+
+only forth also menu-namespace definitions
+
+\ Menu-item key association/detection
+variable menukey1
+variable menukey2
+variable menukey3
+variable menukey4
+variable menukey5
+variable menukey6
+variable menukey7
+variable menukey8
+variable menureboot
+variable menuacpi
+variable menuoptions
+variable menukernel
+
\ Menu initialization status variables
variable init_state1
variable init_state2
@@ -124,10 +139,34 @@ create init_text6 64 allot
create init_text7 64 allot
create init_text8 64 allot
-\ Containers for parsing kernels into menu-items
-create kerncapbuf 64 allot
-create kerndefault 64 allot
-create kernelsbuf 256 allot
+only forth definitions
+
+: arch-i386? ( -- BOOL ) \ Returns TRUE (-1) on i386, FALSE (0) otherwise.
+ s" arch-i386" environment? dup if
+ drop
+ then
+;
+
+: acpipresent? ( -- flag ) \ Returns TRUE if ACPI is present, FALSE otherwise
+ s" hint.acpi.0.rsdp" getenv
+ dup -1 = if
+ drop false exit
+ then
+ 2drop
+ true
+;
+
+: acpienabled? ( -- flag ) \ Returns TRUE if ACPI is enabled, FALSE otherwise
+ s" hint.acpi.0.disabled" getenv
+ dup -1 <> if
+ s" 0" compare 0<> if
+ false exit
+ then
+ else
+ drop
+ then
+ true
+;
: +c! ( N C-ADDR/U K -- C-ADDR/U )
3 pick 3 pick ( n c-addr/u k -- n c-addr/u k n c-addr )
@@ -135,21 +174,17 @@ create kernelsbuf 256 allot
rot drop ( n c-addr/u -- c-addr/u )
;
-: delim? ( C -- BOOL )
- dup 32 = ( c -- c bool ) \ [sp] space
- over 9 = or ( c bool -- c bool ) \ [ht] horizontal tab
- over 10 = or ( c bool -- c bool ) \ [nl] newline
- over 13 = or ( c bool -- c bool ) \ [cr] carriage return
- over [char] , = or ( c bool -- c bool ) \ comma
- swap drop ( c bool -- bool ) \ return boolean
-;
+only forth also menu-namespace definitions
-: menukeyN ( N -- ADDR ) s" menukeyN" 7 +c! evaluate ;
-: init_stateN ( N -- ADDR ) s" init_stateN" 10 +c! evaluate ;
-: toggle_stateN ( N -- ADDR ) s" toggle_stateN" 12 +c! evaluate ;
-: cycle_stateN ( N -- ADDR ) s" cycle_stateN" 11 +c! evaluate ;
-: init_textN ( N -- C-ADDR ) s" init_textN" 9 +c! evaluate ;
+\ Forth variables
+: namespace ( C-ADDR/U N -- ) also menu-namespace +c! evaluate previous ;
+: menukeyN ( N -- ADDR ) s" menukeyN" 7 namespace ;
+: init_stateN ( N -- ADDR ) s" init_stateN" 10 namespace ;
+: toggle_stateN ( N -- ADDR ) s" toggle_stateN" 12 namespace ;
+: cycle_stateN ( N -- ADDR ) s" cycle_stateN" 11 namespace ;
+: init_textN ( N -- C-ADDR ) s" init_textN" 9 namespace ;
+\ Environment variables
: kernel[x] ( N -- C-ADDR/U ) s" kernel[x]" 7 +c! ;
: menu_init[x] ( N -- C-ADDR/U ) s" menu_init[x]" 10 +c! ;
: menu_command[x] ( N -- C-ADDR/U ) s" menu_command[x]" 13 +c! ;
@@ -161,11 +196,7 @@ create kernelsbuf 256 allot
: menu_caption[x][y] ( N M -- C-ADDR/U ) s" menu_caption[x][y]" 16 +c! 13 +c! ;
: ansi_caption[x][y] ( N M -- C-ADDR/U ) s" ansi_caption[x][y]" 16 +c! 13 +c! ;
-: arch-i386? ( -- BOOL ) \ Returns TRUE (-1) on i386, FALSE (0) otherwise.
- s" arch-i386" environment? dup if
- drop
- then
-;
+also menu-infrastructure definitions
\ This function prints a menu item at menuX (row) and menuY (column), returns
\ the incremental decimal ASCII value associated with the menu item, and
@@ -175,6 +206,8 @@ create kernelsbuf 256 allot
\
: printmenuitem ( menu_item_str -- ascii_keycode )
+ loader_color? if [char] ^ escc! then
+
menurow dup @ 1+ swap ! ( increment menurow )
menuidx dup @ 1+ swap ! ( increment menuidx )
@@ -185,13 +218,10 @@ create kernelsbuf 256 allot
dup menuX @ swap at-xy
\ Print the value of menuidx
- loader_color? if
- ." " (  )
- then
+ loader_color? dup ( -- bool bool )
+ if b then
menuidx @ .
- loader_color? if
- ." " (  )
- then
+ if me then
\ Move the cursor forward 1 column
dup menuX @ 1+ swap at-xy
@@ -212,196 +242,6 @@ create kernelsbuf 256 allot
menuidx @ 48 +
;
-: toggle_menuitem ( N -- N ) \ toggles caption text and internal menuitem state
-
- \ ASCII numeral equal to user-selected menu item must be on the stack.
- \ We do not modify the stack, so the ASCII numeral is left on top.
-
- dup init_textN c@ 0= if
- \ NOTE: no need to check toggle_stateN since the first time we
- \ are called, we will populate init_textN. Further, we don't
- \ need to test whether menu_caption[x] (ansi_caption[x] when
- \ loader_color?=1) is available since we would not have been
- \ called if the caption was NULL.
-
- \ base name of environment variable
- dup ( n -- n n ) \ key pressed
- loader_color? if
- ansi_caption[x]
- else
- menu_caption[x]
- then
- getenv dup -1 <> if
-
- 2 pick ( n c-addr/u -- n c-addr/u n )
- init_textN ( n c-addr/u n -- n c-addr/u c-addr )
-
- \ now we have the buffer c-addr on top
- \ ( followed by c-addr/u of current caption )
-
- \ Copy the current caption into our buffer
- 2dup c! -rot \ store strlen at first byte
- begin
- rot 1+ \ bring alt addr to top and increment
- -rot -rot \ bring buffer addr to top
- 2dup c@ swap c! \ copy current character
- 1+ \ increment buffer addr
- rot 1- \ bring buffer len to top and decrement
- dup 0= \ exit loop if buffer len is zero
- until
- 2drop \ buffer len/addr
- drop \ alt addr
-
- else
- drop
- then
- then
-
- \ Now we are certain to have init_textN populated with the initial
- \ value of menu_caption[x] (ansi_caption[x] with loader_color enabled).
- \ We can now use init_textN as the untoggled caption and
- \ toggled_text[x] (toggled_ansi[x] with loader_color enabled) as the
- \ toggled caption and store the appropriate value into menu_caption[x]
- \ (again, ansi_caption[x] with loader_color enabled). Last, we'll
- \ negate the toggled state so that we reverse the flow on subsequent
- \ calls.
-
- dup toggle_stateN @ 0= if
- \ state is OFF, toggle to ON
-
- dup ( n -- n n ) \ key pressed
- loader_color? if
- toggled_ansi[x]
- else
- toggled_text[x]
- then
- getenv dup -1 <> if
- \ Assign toggled text to menu caption
- 2 pick ( n c-addr/u -- n c-addr/u n ) \ key pressed
- loader_color? if
- ansi_caption[x]
- else
- menu_caption[x]
- then
- setenv
- else
- \ No toggled text, keep the same caption
- drop ( n -1 -- n ) \ getenv cruft
- then
-
- true \ new value of toggle state var (to be stored later)
- else
- \ state is ON, toggle to OFF
-
- dup init_textN count ( n -- n c-addr/u )
-
- \ Assign init_textN text to menu caption
- 2 pick ( n c-addr/u -- n c-addr/u n ) \ key pressed
- loader_color? if
- ansi_caption[x]
- else
- menu_caption[x]
- then
- setenv
-
- false \ new value of toggle state var (to be stored below)
- then
-
- \ now we'll store the new toggle state (on top of stack)
- over toggle_stateN !
-;
-
-: cycle_menuitem ( N -- N ) \ cycles through array of choices for a menuitem
-
- \ ASCII numeral equal to user-selected menu item must be on the stack.
- \ We do not modify the stack, so the ASCII numeral is left on top.
-
- dup cycle_stateN dup @ 1+ \ get value and increment
-
- \ Before assigning the (incremented) value back to the pointer,
- \ let's test for the existence of this particular array element.
- \ If the element exists, we'll store index value and move on.
- \ Otherwise, we'll loop around to zero and store that.
-
- dup 48 + ( n addr k -- n addr k k' )
- \ duplicate array index and convert to ASCII numeral
-
- 3 pick swap ( n addr k k' -- n addr k n k' ) \ (n,k') as (x,y)
- loader_color? if
- ansi_caption[x][y]
- else
- menu_caption[x][y]
- then
- ( n addr k n k' -- n addr k c-addr/u )
-
- \ Now test for the existence of our incremented array index in the
- \ form of $menu_caption[x][y] ($ansi_caption[x][y] with loader_color
- \ enabled) as set in loader.rc(5), et. al.
-
- getenv dup -1 = if
- \ No caption set for this array index. Loop back to zero.
-
- drop ( n addr k -1 -- n addr k ) \ getenv cruft
- drop 0 ( n addr k -- n addr 0 ) \ new value to store later
-
- 2 pick [char] 0 ( n addr 0 -- n addr 0 n 48 ) \ (n,48) as (x,y)
- loader_color? if
- ansi_caption[x][y]
- else
- menu_caption[x][y]
- then
- ( n addr 0 n 48 -- n addr 0 c-addr/u )
- getenv dup -1 = if
- \ Highly unlikely to occur, but to ensure things move
- \ along smoothly, allocate a temporary NULL string
- drop ( cruft ) s" "
- then
- then
-
- \ At this point, we should have the following on the stack (in order,
- \ from bottom to top):
- \
- \ n - Ascii numeral representing the menu choice (inherited)
- \ addr - address of our internal cycle_stateN variable
- \ k - zero-based number we intend to store to the above
- \ c-addr/u - string value we intend to store to menu_caption[x]
- \ (or ansi_caption[x] with loader_color enabled)
- \
- \ Let's perform what we need to with the above.
-
- \ Assign array value text to menu caption
- 4 pick ( n addr k c-addr/u -- n addr k c-addr/u n )
- loader_color? if
- ansi_caption[x]
- else
- menu_caption[x]
- then
- setenv
-
- swap ! ( n addr k -- n ) \ update array state variable
-;
-
-: acpipresent? ( -- flag ) \ Returns TRUE if ACPI is present, FALSE otherwise
- s" hint.acpi.0.rsdp" getenv
- dup -1 = if
- drop false exit
- then
- 2drop
- true
-;
-
-: acpienabled? ( -- flag ) \ Returns TRUE if ACPI is enabled, FALSE otherwise
- s" hint.acpi.0.disabled" getenv
- dup -1 <> if
- s" 0" compare 0<> if
- false exit
- then
- else
- drop
- then
- true
-;
-
\ This function prints the appropriate menuitem basename to the stack if an
\ ACPI option is to be presented to the user, otherwise returns -1. Used
\ internally by menu-create, you need not (nor should you) call this directly.
@@ -432,6 +272,15 @@ create kernelsbuf 256 allot
then
;
+: delim? ( C -- BOOL )
+ dup 32 = ( c -- c bool ) \ [sp] space
+ over 9 = or ( c bool -- c bool ) \ [ht] horizontal tab
+ over 10 = or ( c bool -- c bool ) \ [nl] newline
+ over 13 = or ( c bool -- c bool ) \ [cr] carriage return
+ over [char] , = or ( c bool -- c bool ) \ comma
+ swap drop ( c bool -- bool ) \ return boolean
+;
+
\ This function parses $kernels into variables that are used by the menu to
\ display wich kernel to boot when the [overloaded] `boot' word is interpreted.
\ Used internally by menu-create, you need not (nor should you) call this
@@ -548,14 +397,15 @@ create kernelsbuf 256 allot
setenv
\ Assign third to ansi_caption[x][y]
- kerncapbuf 0 s" Kernel: " strcat
+ kerncapbuf 0 s" @[1mK@[37mernel: " [char] @ escc! strcat
kernmenuidx @ [char] 0 = if
- s" default/"
+ s" default/@[32m"
else
- s" "
- then strcat
+ s" @[34;1m"
+ then
+ [char] @ escc! strcat
2over strcat
- s" " strcat
+ s" @[37m" [char] @ escc! strcat
kernidx @ kernmenuidx @ ansi_caption[x][y]
setenv
@@ -614,7 +464,7 @@ create kernelsbuf 256 allot
;
\ This function creates the list of menu items. This function is called by the
-\ menu-display function. You need not be call it directly.
+\ menu-display function. You need not call it directly.
\
: menu-create ( -- )
@@ -957,6 +807,182 @@ create kernelsbuf 256 allot
0 menurow !
;
+only forth
+also menu-infrastructure
+also menu-namespace
+also menu-command-helpers definitions
+
+: toggle_menuitem ( N -- N ) \ toggles caption text and internal menuitem state
+
+ \ ASCII numeral equal to user-selected menu item must be on the stack.
+ \ We do not modify the stack, so the ASCII numeral is left on top.
+
+ dup init_textN c@ 0= if
+ \ NOTE: no need to check toggle_stateN since the first time we
+ \ are called, we will populate init_textN. Further, we don't
+ \ need to test whether menu_caption[x] (ansi_caption[x] when
+ \ loader_color?=1) is available since we would not have been
+ \ called if the caption was NULL.
+
+ \ base name of environment variable
+ dup ( n -- n n ) \ key pressed
+ loader_color? if
+ ansi_caption[x]
+ else
+ menu_caption[x]
+ then
+ getenv dup -1 <> if
+
+ 2 pick ( n c-addr/u -- n c-addr/u n )
+ init_textN ( n c-addr/u n -- n c-addr/u c-addr )
+
+ \ now we have the buffer c-addr on top
+ \ ( followed by c-addr/u of current caption )
+
+ \ Copy the current caption into our buffer
+ 2dup c! -rot \ store strlen at first byte
+ begin
+ rot 1+ \ bring alt addr to top and increment
+ -rot -rot \ bring buffer addr to top
+ 2dup c@ swap c! \ copy current character
+ 1+ \ increment buffer addr
+ rot 1- \ bring buffer len to top and decrement
+ dup 0= \ exit loop if buffer len is zero
+ until
+ 2drop \ buffer len/addr
+ drop \ alt addr
+
+ else
+ drop
+ then
+ then
+
+ \ Now we are certain to have init_textN populated with the initial
+ \ value of menu_caption[x] (ansi_caption[x] with loader_color enabled).
+ \ We can now use init_textN as the untoggled caption and
+ \ toggled_text[x] (toggled_ansi[x] with loader_color enabled) as the
+ \ toggled caption and store the appropriate value into menu_caption[x]
+ \ (again, ansi_caption[x] with loader_color enabled). Last, we'll
+ \ negate the toggled state so that we reverse the flow on subsequent
+ \ calls.
+
+ dup toggle_stateN @ 0= if
+ \ state is OFF, toggle to ON
+
+ dup ( n -- n n ) \ key pressed
+ loader_color? if
+ toggled_ansi[x]
+ else
+ toggled_text[x]
+ then
+ getenv dup -1 <> if
+ \ Assign toggled text to menu caption
+ 2 pick ( n c-addr/u -- n c-addr/u n ) \ key pressed
+ loader_color? if
+ ansi_caption[x]
+ else
+ menu_caption[x]
+ then
+ setenv
+ else
+ \ No toggled text, keep the same caption
+ drop ( n -1 -- n ) \ getenv cruft
+ then
+
+ true \ new value of toggle state var (to be stored later)
+ else
+ \ state is ON, toggle to OFF
+
+ dup init_textN count ( n -- n c-addr/u )
+
+ \ Assign init_textN text to menu caption
+ 2 pick ( n c-addr/u -- n c-addr/u n ) \ key pressed
+ loader_color? if
+ ansi_caption[x]
+ else
+ menu_caption[x]
+ then
+ setenv
+
+ false \ new value of toggle state var (to be stored below)
+ then
+
+ \ now we'll store the new toggle state (on top of stack)
+ over toggle_stateN !
+;
+
+: cycle_menuitem ( N -- N ) \ cycles through array of choices for a menuitem
+
+ \ ASCII numeral equal to user-selected menu item must be on the stack.
+ \ We do not modify the stack, so the ASCII numeral is left on top.
+
+ dup cycle_stateN dup @ 1+ \ get value and increment
+
+ \ Before assigning the (incremented) value back to the pointer,
+ \ let's test for the existence of this particular array element.
+ \ If the element exists, we'll store index value and move on.
+ \ Otherwise, we'll loop around to zero and store that.
+
+ dup 48 + ( n addr k -- n addr k k' )
+ \ duplicate array index and convert to ASCII numeral
+
+ 3 pick swap ( n addr k k' -- n addr k n k' ) \ (n,k') as (x,y)
+ loader_color? if
+ ansi_caption[x][y]
+ else
+ menu_caption[x][y]
+ then
+ ( n addr k n k' -- n addr k c-addr/u )
+
+ \ Now test for the existence of our incremented array index in the
+ \ form of $menu_caption[x][y] ($ansi_caption[x][y] with loader_color
+ \ enabled) as set in loader.rc(5), et. al.
+
+ getenv dup -1 = if
+ \ No caption set for this array index. Loop back to zero.
+
+ drop ( n addr k -1 -- n addr k ) \ getenv cruft
+ drop 0 ( n addr k -- n addr 0 ) \ new value to store later
+
+ 2 pick [char] 0 ( n addr 0 -- n addr 0 n 48 ) \ (n,48) as (x,y)
+ loader_color? if
+ ansi_caption[x][y]
+ else
+ menu_caption[x][y]
+ then
+ ( n addr 0 n 48 -- n addr 0 c-addr/u )
+ getenv dup -1 = if
+ \ Highly unlikely to occur, but to ensure things move
+ \ along smoothly, allocate a temporary NULL string
+ drop ( cruft ) s" "
+ then
+ then
+
+ \ At this point, we should have the following on the stack (in order,
+ \ from bottom to top):
+ \
+ \ n - Ascii numeral representing the menu choice (inherited)
+ \ addr - address of our internal cycle_stateN variable
+ \ k - zero-based number we intend to store to the above
+ \ c-addr/u - string value we intend to store to menu_caption[x]
+ \ (or ansi_caption[x] with loader_color enabled)
+ \
+ \ Let's perform what we need to with the above.
+
+ \ Assign array value text to menu caption
+ 4 pick ( n addr k c-addr/u -- n addr k c-addr/u n )
+ loader_color? if
+ ansi_caption[x]
+ else
+ menu_caption[x]
+ then
+ setenv
+
+ swap ! ( n addr k -- n ) \ update array state variable
+;
+
+only forth definitions also menu-infrastructure
+
\ Erase and redraw the menu. Useful if you change a caption and want to
\ update the menu to reflect the new value.
\
@@ -1013,6 +1039,8 @@ create kernelsbuf 256 allot
0 25 at-xy \ Move cursor to the bottom for output
;
+also menu-namespace
+
\ Main function. Call this from your `loader.rc' file.
\
: menu-display ( -- )
@@ -1234,6 +1262,8 @@ create kernelsbuf 256 allot
0 menuoptions !
;
+only forth definitions also menu-infrastructure
+
\ This function both unsets menu variables and visually erases the menu area
\ in-preparation for another menu.
\
@@ -1244,6 +1274,8 @@ create kernelsbuf 256 allot
bullet menubllt !
+also menu-namespace
+
\ Initialize our menu initialization state variables
0 init_state1 !
0 init_state2 !
@@ -1283,3 +1315,5 @@ bullet menubllt !
0 init_text6 c!
0 init_text7 c!
0 init_text8 c!
+
+only forth definitions
diff --git a/sys/boot/forth/menu.rc b/sys/boot/forth/menu.rc
index e49f567..e650848 100644
--- a/sys/boot/forth/menu.rc
+++ b/sys/boot/forth/menu.rc
@@ -17,6 +17,7 @@ menu-init \ initialize the menu area (see `menu.4th')
\ Initialize main menu constructs (see `menu.4th')
\ NOTE: To use `non-ansi' variants, add `loader_color=0' to loader.conf(5)
+\ NOTE: ANSI variants can use `^' in place of literal `Esc' (ASCII 27)
\
\ MAIN MENU
@@ -28,22 +29,22 @@ set mainmenu_init[1]="init_boot"
set mainmenu_caption[1]="Boot Multi User [Enter]"
set maintoggled_text[1]="Boot [S]ingle User [Enter]"
set mainmenu_command[1]="boot"
-set mainansi_caption[1]="Boot Multi User [Enter]"
-set maintoggled_ansi[1]="Boot Single User [Enter]"
+set mainansi_caption[1]="^[1mB^[moot Multi User ^[1m[Enter]^[m"
+set maintoggled_ansi[1]="Boot ^[1mS^[mingle User ^[1m[Enter]^[m"
\ keycode set by init_boot
set mainmenu_init[2]="init_altboot"
set mainmenu_caption[2]="Boot [S]ingle User"
set maintoggled_text[2]="Boot [M]ulti User"
set mainmenu_command[2]="altboot"
-set mainansi_caption[2]="Boot Single User"
-set maintoggled_ansi[2]="Boot Multi User"
+set mainansi_caption[2]="Boot ^[1mS^[mingle User"
+set maintoggled_ansi[2]="Boot ^[1mM^[multi User"
\ keycode set by init_altboot
set mainmenu_caption[3]="[Esc]ape to loader prompt"
set mainmenu_command[3]="goto_prompt"
set mainmenu_keycode[3]=27
-set mainansi_caption[3]="Escape to loader prompt"
+set mainansi_caption[3]="^[1mEsc^[mape to loader prompt"
\ Enable built-in "Reboot" trailing menuitem
\ NOTE: appears before menu_options if configured
@@ -62,7 +63,7 @@ set mainmenu_keycode[5]=107
set mainmenu_caption[6]="Configure Boot [O]ptions..."
set mainmenu_command[6]="2 goto_menu"
set mainmenu_keycode[6]=111
-set mainansi_caption[6]="Configure Boot Options..."
+set mainansi_caption[6]="Configure Boot ^[1mO^[mptions..."
\
\ BOOT OPTIONS MENU
@@ -73,12 +74,12 @@ set menuset_name2="options"
set optionsmenu_caption[1]="Back to Main Menu [Backspace]"
set optionsmenu_command[1]="1 goto_menu"
set optionsmenu_keycode[1]=8
-set optionsansi_caption[1]="Back to Main Menu [Backspace]"
+set optionsansi_caption[1]="Back to Main Menu ^[1m[Backspace]^[m"
set optionsmenu_caption[2]="Load System [D]efaults"
set optionsmenu_command[2]="set_default_boot_options"
set optionsmenu_keycode[2]=100
-set optionsansi_caption[2]="Load System Defaults"
+set optionsansi_caption[2]="Load System ^[1mD^[mefaults"
set optionsmenu_options=3
set optionsmenu_optionstext="Boot Options:"
@@ -88,32 +89,32 @@ set optionsmenu_caption[3]="[A]CPI Support off"
set optionstoggled_text[3]="[A]CPI Support On"
set optionsmenu_command[3]="toggle_acpi"
set optionsmenu_keycode[3]=97
-set optionsansi_caption[3]="ACPI Support Off"
-set optionstoggled_ansi[3]="ACPI Support On"
+set optionsansi_caption[3]="^[1mA^[mCPI Support ^[34;1mOff^[m"
+set optionstoggled_ansi[3]="^[1mA^[mCPI Support ^[32;7mOn^[m"
set optionsmenu_init[4]="init_safemode"
set optionsmenu_caption[4]="Safe [M]ode... off"
set optionstoggled_text[4]="Safe [M]ode... On"
set optionsmenu_command[4]="toggle_safemode"
set optionsmenu_keycode[4]=109
-set optionsansi_caption[4]="Safe Mode... Off"
-set optionstoggled_ansi[4]="Safe Mode... On"
+set optionsansi_caption[4]="Safe ^[1mM^[mode... ^[34;1mOff^[m"
+set optionstoggled_ansi[4]="Safe ^[1mM^[mode... ^[32;7mOn^[m"
set optionsmenu_init[5]="init_singleuser"
set optionsmenu_caption[5]="[S]ingle User. off"
set optionstoggled_text[5]="[S]ingle User. On"
set optionsmenu_command[5]="toggle_singleuser"
set optionsmenu_keycode[5]=115
-set optionsansi_caption[5]="Single User. Off"
-set optionstoggled_ansi[5]="Single User. On"
+set optionsansi_caption[5]="^[1mS^[mingle User. ^[34;1mOff^[m"
+set optionstoggled_ansi[5]="^[1mS^[mingle User. ^[32;7mOn^[m"
set optionsmenu_init[6]="init_verbose"
set optionsmenu_caption[6]="[V]erbose..... off"
set optionstoggled_text[6]="[V]erbose..... On"
set optionsmenu_command[6]="toggle_verbose"
set optionsmenu_keycode[6]=118
-set optionsansi_caption[6]="Verbose..... Off"
-set optionstoggled_ansi[6]="Verbose..... On"
+set optionsansi_caption[6]="^[1mV^[merbose..... ^[34;1mOff^[m"
+set optionstoggled_ansi[6]="^[1mV^[merbose..... ^[32;7mOn^[m"
\ Enable automatic booting (add ``autoboot_delay=N'' to loader.conf(5) to
\ customize the timeout; default is 10-seconds)
diff --git a/sys/boot/forth/menusets.4th b/sys/boot/forth/menusets.4th
index edee356..9335b80 100644
--- a/sys/boot/forth/menusets.4th
+++ b/sys/boot/forth/menusets.4th
@@ -26,6 +26,9 @@
marker task-menusets.4th
+vocabulary menusets-infrastructure
+only forth also menusets-infrastructure definitions
+
variable menuset_use_name
create menuset_affixbuf 255 allot
@@ -437,6 +440,8 @@ create menuset_y 1 allot
s" affix" unsetenv
;
+only forth definitions also menusets-infrastructure
+
: menuset-loadsetnum ( N -- )
menuset-checksetnum ( n -- )
@@ -537,16 +542,6 @@ create menuset_y 1 allot
menuset-cleanup
;
-: menuset-loadinitial ( -- )
- s" menuset_initial" getenv dup -1 <> if
- ?number 0<> if
- menuset-loadsetnum
- then
- else
- drop \ cruft
- then
-;
-
: menusets-unset ( -- )
s" menuset_initial" unsetenv
@@ -615,3 +610,15 @@ create menuset_y 1 allot
s" buf" unsetenv
menuset-cleanup
;
+
+only forth definitions
+
+: menuset-loadinitial ( -- )
+ s" menuset_initial" getenv dup -1 <> if
+ ?number 0<> if
+ menuset-loadsetnum
+ then
+ else
+ drop \ cruft
+ then
+;
diff --git a/sys/boot/forth/pnp.4th b/sys/boot/forth/pnp.4th
index 8cd6bea..8be89d8 100644
--- a/sys/boot/forth/pnp.4th
+++ b/sys/boot/forth/pnp.4th
@@ -1,4 +1,4 @@
-\ Copyright (c) 2000 Daniel C. Sobral <dcs@freebsd.org>
+\ Copyright (c) 2000 Daniel C. Sobral <dcs@FreeBSD.org>
\ All rights reserved.
\
\ Redistribution and use in source and binary forms, with or without
diff --git a/sys/boot/forth/screen.4th b/sys/boot/forth/screen.4th
index 3ea79e4..e0af82b 100644
--- a/sys/boot/forth/screen.4th
+++ b/sys/boot/forth/screen.4th
@@ -1,36 +1,74 @@
-\ Screen manipulation related words.
+\ Copyright (c) 2003 Scott Long <scottl@FreeBSD.org>
+\ Copyright (c) 2015 Devin Teske <dteske@FreeBSD.org>
+\ All rights reserved.
+\
+\ Redistribution and use in source and binary forms, with or without
+\ modification, are permitted provided that the following conditions
+\ are met:
+\ 1. Redistributions of source code must retain the above copyright
+\ notice, this list of conditions and the following disclaimer.
+\ 2. Redistributions in binary form must reproduce the above copyright
+\ notice, this list of conditions and the following disclaimer in the
+\ documentation and/or other materials provided with the distribution.
+\
+\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+\ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+\ SUCH DAMAGE.
+\
\ $FreeBSD$
marker task-screen.4th
-: escc ( -- ) \ emit Esc-[
- 91 27 emit emit
-;
+\ emit Esc-[
+: escc ( -- ) 27 emit [char] [ emit ;
-: ho ( -- ) \ Home cursor
- escc 72 emit \ Esc-[H
-;
+\ Home cursor ( Esc-[H )
+: ho ( -- ) escc [char] H emit ;
-: cld ( -- ) \ Clear from current position to end of display
- escc 74 emit \ Esc-[J
-;
+\ Clear from current position to end of display ( Esc-[J )
+: cld ( -- ) escc [char] J emit ;
-: clear ( -- ) \ clear screen
- ho cld
-;
+\ clear screen
+: clear ( -- ) ho cld ;
-: at-xy ( x y -- ) \ move cursor to x rows, y cols (1-based coords)
- escc .# 59 emit .# 72 emit \ Esc-[%d;%dH
-;
+\ move cursor to x rows, y cols (1-based coords) ( Esc-[%d;%dH )
+: at-xy ( x y -- ) escc .# [char] ; emit .# [char] H emit ;
-: fg ( x -- ) \ Set foreground color
- escc 3 .# .# 109 emit \ Esc-[3%dm
-;
+\ Set foreground color ( Esc-[3%dm )
+: fg ( x -- ) escc 3 .# .# [char] m emit ;
-: bg ( x -- ) \ Set background color
- escc 4 .# .# 109 emit \ Esc-[4%dm
-;
+\ Set background color ( Esc-[4%dm )
+: bg ( x -- ) escc 4 .# .# [char] m emit ;
+
+\ Mode end (clear attributes)
+: me ( -- ) escc [char] m emit ;
+
+\ Enable bold mode ( Esc-[1m )
+: b ( -- ) escc 1 .# [char] m emit ;
+
+\ Disable bold mode ( Esc-[22m )
+: -b ( -- ) escc 22 .# [char] m emit ;
+
+\ Enable inverse foreground/background mode ( Esc-[7m )
+: inv ( -- ) escc 7 .# [char] m emit ;
+
+\ Disable inverse foreground/background mode ( Esc-[27m )
+: -inv ( -- ) escc 27 .# [char] m emit ;
-: me ( -- ) \ Mode end (clear attributes)
- escc 109 emit
+\ Convert all occurrences of given character (c) in string (c-addr/u) to Esc
+: escc! ( c-addr/u c -- c-addr/u )
+ 2 pick 2 pick
+ begin dup 0> while
+ over c@ 3 pick = if over 27 swap c! then
+ 1- swap 1+ swap
+ repeat
+ 2drop drop
;
diff --git a/sys/boot/forth/support.4th b/sys/boot/forth/support.4th
index 645e14d..7da92bc 100644
--- a/sys/boot/forth/support.4th
+++ b/sys/boot/forth/support.4th
@@ -1,4 +1,4 @@
-\ Copyright (c) 1999 Daniel C. Sobral <dcs@freebsd.org>
+\ Copyright (c) 1999 Daniel C. Sobral <dcs@FreeBSD.org>
\ All rights reserved.
\
\ Redistribution and use in source and binary forms, with or without
@@ -315,7 +315,7 @@ string value_buffer
\ reset_line_reading
vocabulary line-reading
-also line-reading definitions also
+also line-reading definitions
\ File data temporary storage
@@ -324,13 +324,13 @@ string read_buffer
\ File's line reading function
-support-functions definitions
+get-current ( -- wid ) previous definitions
string line_buffer
0 value end_of_file?
variable fd
-line-reading definitions
+>search ( wid -- ) definitions
: skip_newlines
begin
@@ -405,7 +405,7 @@ line-reading definitions
read_buffer .len !
;
-support-functions definitions
+get-current ( -- wid ) previous definitions >search ( wid -- )
: reset_line_reading
0 to read_buffer_ptr
@@ -447,7 +447,7 @@ also file-processing definitions
\ get_assignment
vocabulary parser
-also parser definitions also
+also parser definitions
0 value parsing_function
0 value end_of_line
@@ -606,7 +606,7 @@ also parser definitions also
end_of_line? 0= if ESYNTAX throw then
;
-file-processing definitions
+get-current ( -- wid ) previous definitions >search ( wid -- )
: get_assignment
line_buffer strget + to end_of_line
@@ -623,7 +623,7 @@ file-processing definitions
or or 0= if ESYNTAX throw then
;
-only forth also support-functions also file-processing definitions also
+only forth also support-functions also file-processing definitions
\ Process line
@@ -818,7 +818,7 @@ only forth also support-functions also file-processing definitions also
\ Higher level file processing
-support-functions definitions
+get-current ( -- wid ) previous definitions >search ( wid -- )
: process_conf
begin
@@ -1563,7 +1563,4 @@ also builtins
?dup 0= if ['] load_modules catch then
;
-\ Go back to straight forth vocabulary
-
-only forth also definitions
-
+only forth definitions
diff --git a/sys/boot/forth/version.4th b/sys/boot/forth/version.4th
index 6e0255b..a5311b4 100644
--- a/sys/boot/forth/version.4th
+++ b/sys/boot/forth/version.4th
@@ -1,4 +1,4 @@
-\ Copyright (c) 2006-2013 Devin Teske <dteske@FreeBSD.org>
+\ Copyright (c) 2006-2015 Devin Teske <dteske@FreeBSD.org>
\ All rights reserved.
\
\ Redistribution and use in source and binary forms, with or without
@@ -26,6 +26,9 @@
marker task-version.4th
+vocabulary version-processing
+only forth also version-processing definitions
+
variable versionX
variable versionY
@@ -36,6 +39,8 @@ variable versionY
80 versionX ! \ NOTE: this is the ending column (text is right-justified)
24 versionY !
+only forth definitions also version-processing
+
: print_version ( -- )
\ Get the text placement position (if set)
@@ -49,21 +54,22 @@ variable versionY
\ Default version if none was set
s" loader_version" getenv dup -1 = if
drop
- \ Default version if no logo is requested
+ \ Use above default if no logo is requested
s" loader_logo" getenv dup -1 = if
drop str_loader_version
else
+ \ For tributes, do nothing (defer to logo-*.4th)
2dup s" tribute" compare-insensitive 0= if
2drop
- s" tribute-logo" sfind if
- drop exit \ see beastie tribute-text
+ s" logo" sfind if
+ drop exit \ see logo-tribute.4th
else
drop str_loader_version
then
else 2dup s" tributebw" compare-insensitive 0= if
2drop
- s" tributebw-logo" sfind if
- drop exit \ see beastie tribute-text
+ s" logo" sfind if
+ drop exit \ see logo-tributebw.4th
else
drop str_loader_version
then
@@ -79,9 +85,12 @@ variable versionY
dup versionX @ swap - versionY @ at-xy
\ Print the version (optionally in cyan)
- loader_color? if
- ." " type ." "
- else
- type
- then
+ loader_color? dup ( c-addr/u -- c-addr/u bool bool )
+ if 6 fg then
+ -rot type
+ if me then
+
+ 0 25 at-xy
;
+
+only forth definitions
diff --git a/sys/boot/i386/loader/Makefile b/sys/boot/i386/loader/Makefile
index b98a725..9f2f1b2 100644
--- a/sys/boot/i386/loader/Makefile
+++ b/sys/boot/i386/loader/Makefile
@@ -106,11 +106,7 @@ FILESMODE_${LOADER}= ${BINMODE} -b
.if !defined(LOADER_ONLY)
.PATH: ${.CURDIR}/../../forth
-FILES+= loader.help loader.4th support.4th loader.conf
-FILES+= screen.4th frames.4th beastie.4th
-FILES+= brand.4th check-password.4th color.4th delay.4th
-FILES+= menu.4th menu-commands.4th menusets.4th shortcuts.4th version.4th
-FILESDIR_loader.conf= /boot/defaults
+.include "${.CURDIR}/../../forth/Makefile.inc"
.if !exists(${DESTDIR}/boot/loader.rc)
FILES+= loader.rc
diff --git a/sys/boot/pc98/loader/Makefile b/sys/boot/pc98/loader/Makefile
index bf559d4..3eafed4 100644
--- a/sys/boot/pc98/loader/Makefile
+++ b/sys/boot/pc98/loader/Makefile
@@ -87,11 +87,7 @@ FILES= ${LOADER}
FILESMODE_${LOADER}= ${BINMODE} -b
.PATH: ${.CURDIR}/../../forth
-FILES+= loader.help loader.4th support.4th loader.conf
-FILES+= screen.4th frames.4th beastie.4th
-FILES+= brand.4th check-password.4th color.4th delay.4th
-FILES+= menu.4th menu-commands.4th menusets.4th shortcuts.4th version.4th
-FILESDIR_loader.conf= /boot/defaults
+.include "${.CURDIR}/../../forth/Makefile.inc"
.if !exists(${DESTDIR}/boot/loader.rc)
FILES+= ${.CURDIR}/../../i386/loader/loader.rc
diff --git a/sys/boot/powerpc/ofw/Makefile b/sys/boot/powerpc/ofw/Makefile
index ae4a443..fbde1e7 100644
--- a/sys/boot/powerpc/ofw/Makefile
+++ b/sys/boot/powerpc/ofw/Makefile
@@ -103,11 +103,7 @@ loader.help: help.common help.ofw
awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
.PATH: ${.CURDIR}/../../forth
-FILES= loader.help loader.4th support.4th loader.conf
-FILES+= screen.4th frames.4th
-FILES+= beastie.4th brand.4th check-password.4th color.4th delay.4th
-FILES+= menu.4th menu-commands.4th menusets.4th shortcuts.4th version.4th
-FILESDIR_loader.conf= /boot/defaults
+.include "${.CURDIR}/../../forth/Makefile.inc"
.if !exists(${DESTDIR}/boot/loader.rc)
FILES+= loader.rc
diff --git a/sys/boot/powerpc/ps3/Makefile b/sys/boot/powerpc/ps3/Makefile
index 87aa6ed..0c9198e 100644
--- a/sys/boot/powerpc/ps3/Makefile
+++ b/sys/boot/powerpc/ps3/Makefile
@@ -113,12 +113,7 @@ loader.help: help.common help.ps3 ${.CURDIR}/../../fdt/help.fdt
cat ${.ALLSRC} | \
awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
-.PATH: ${.CURDIR}/../../forth
-FILES= loader.help loader.4th support.4th loader.conf
-FILES+= screen.4th frames.4th
-FILES+= beastie.4th brand.4th check-password.4th color.4th delay.4th
-FILES+= menu.4th menu-commands.4th menusets.4th shortcuts.4th version.4th
-FILESDIR_loader.conf= /boot/defaults
+.include "${.CURDIR}/../../forth/Makefile.inc"
.if !exists(${DESTDIR}/boot/loader.rc)
FILES+= loader.rc
diff --git a/sys/boot/sparc64/loader/Makefile b/sys/boot/sparc64/loader/Makefile
index 4624b6f..06c9838 100644
--- a/sys/boot/sparc64/loader/Makefile
+++ b/sys/boot/sparc64/loader/Makefile
@@ -96,11 +96,7 @@ loader.help: help.common help.sparc64
awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
.PATH: ${.CURDIR}/../../forth
-FILES= loader.help loader.4th support.4th loader.conf
-FILES+= screen.4th frames.4th
-FILES+= beastie.4th brand.4th check-password.4th color.4th delay.4th
-FILES+= menu.4th menu-commands.4th menusets.4th shortcuts.4th version.4th
-FILESDIR_loader.conf= /boot/defaults
+.include "${.CURDIR}/../../forth/Makefile.inc"
.if !exists(${DESTDIR}/boot/loader.rc)
FILES+= loader.rc
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 1c5f77c..4622988 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -707,6 +707,9 @@ start_init(void *dummy)
vfs_mountroot();
+ /* Wipe GELI passphrase from the environment. */
+ kern_unsetenv("kern.geom.eli.passphrase");
+
/*
* Need just enough stack to hold the faked-up "execve()" arguments.
*/
OpenPOWER on IntegriCloud