From owner-svn-src-all@FreeBSD.ORG Wed Apr 22 01:08:44 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D29D694F; Wed, 22 Apr 2015 01:08:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BCDB71576; Wed, 22 Apr 2015 01:08:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t3M18ipc097910; Wed, 22 Apr 2015 01:08:44 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t3M18f7N097880; Wed, 22 Apr 2015 01:08:41 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201504220108.t3M18f7N097880@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Wed, 22 Apr 2015 01:08:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r281843 - in stable/10: sys/boot sys/boot/arm/uboot sys/boot/common sys/boot/forth sys/boot/i386/loader sys/boot/pc98/loader sys/boot/powerpc/ofw sys/boot/powerpc/ps3 sys/boot/sparc64/l... X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Apr 2015 01:08:45 -0000 Author: dteske Date: Wed Apr 22 01:08:40 2015 New Revision: 281843 URL: https://svnweb.freebsd.org/changeset/base/281843 Log: 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 Added: stable/10/sys/boot/forth/Makefile - copied unchanged from r281081, head/sys/boot/forth/Makefile stable/10/sys/boot/forth/Makefile.inc - copied, changed from r281002, head/sys/boot/forth/Makefile.inc stable/10/sys/boot/forth/brand-fbsd.4th - copied, changed from r280933, head/sys/boot/forth/brand-fbsd.4th stable/10/sys/boot/forth/logo-beastie.4th - copied, changed from r280933, head/sys/boot/forth/logo-beastie.4th stable/10/sys/boot/forth/logo-beastiebw.4th - copied, changed from r280933, head/sys/boot/forth/logo-beastiebw.4th stable/10/sys/boot/forth/logo-fbsdbw.4th - copied, changed from r280933, head/sys/boot/forth/logo-fbsdbw.4th stable/10/sys/boot/forth/logo-orb.4th - copied, changed from r280933, head/sys/boot/forth/logo-orb.4th stable/10/sys/boot/forth/logo-orbbw.4th - copied, changed from r280933, head/sys/boot/forth/logo-orbbw.4th Modified: stable/10/sys/boot/Makefile stable/10/sys/boot/arm/uboot/Makefile stable/10/sys/boot/common/Makefile.inc stable/10/sys/boot/forth/beastie.4th stable/10/sys/boot/forth/brand.4th stable/10/sys/boot/forth/check-password.4th stable/10/sys/boot/forth/check-password.4th.8 stable/10/sys/boot/forth/delay.4th stable/10/sys/boot/forth/frames.4th stable/10/sys/boot/forth/loader.4th stable/10/sys/boot/forth/loader.conf stable/10/sys/boot/forth/menu-commands.4th stable/10/sys/boot/forth/menu.4th stable/10/sys/boot/forth/menu.rc stable/10/sys/boot/forth/menusets.4th stable/10/sys/boot/forth/pnp.4th stable/10/sys/boot/forth/screen.4th stable/10/sys/boot/forth/support.4th stable/10/sys/boot/forth/version.4th stable/10/sys/boot/i386/loader/Makefile stable/10/sys/boot/pc98/loader/Makefile stable/10/sys/boot/powerpc/ofw/Makefile stable/10/sys/boot/powerpc/ps3/Makefile stable/10/sys/boot/sparc64/loader/Makefile stable/10/sys/kern/init_main.c stable/10/usr.sbin/bsdinstall/scripts/zfsboot Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/boot/Makefile ============================================================================== --- stable/10/sys/boot/Makefile Wed Apr 22 00:40:41 2015 (r281842) +++ stable/10/sys/boot/Makefile Wed Apr 22 01:08:40 2015 (r281843) @@ -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. Modified: stable/10/sys/boot/arm/uboot/Makefile ============================================================================== --- stable/10/sys/boot/arm/uboot/Makefile Wed Apr 22 00:40:41 2015 (r281842) +++ stable/10/sys/boot/arm/uboot/Makefile Wed Apr 22 01:08:40 2015 (r281843) @@ -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. Modified: stable/10/sys/boot/common/Makefile.inc ============================================================================== --- stable/10/sys/boot/common/Makefile.inc Wed Apr 22 00:40:41 2015 (r281842) +++ stable/10/sys/boot/common/Makefile.inc Wed Apr 22 01:08:40 2015 (r281843) @@ -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) Copied: stable/10/sys/boot/forth/Makefile (from r281081, head/sys/boot/forth/Makefile) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/boot/forth/Makefile Wed Apr 22 01:08:40 2015 (r281843, copy of r281081, head/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 Copied and modified: stable/10/sys/boot/forth/Makefile.inc (from r281002, head/sys/boot/forth/Makefile.inc) ============================================================================== --- head/sys/boot/forth/Makefile.inc Thu Apr 2 20:07:05 2015 (r281002, copy source) +++ stable/10/sys/boot/forth/Makefile.inc Wed Apr 22 01:08:40 2015 (r281843) @@ -1,6 +1,5 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../../forth FILES+= beastie.4th FILES+= brand.4th FILES+= brand-fbsd.4th Modified: stable/10/sys/boot/forth/beastie.4th ============================================================================== --- stable/10/sys/boot/forth/beastie.4th Wed Apr 22 00:40:41 2015 (r281842) +++ stable/10/sys/boot/forth/beastie.4th Wed Apr 22 01:08:40 2015 (r281843) @@ -1,6 +1,6 @@ -\ Copyright (c) 2003 Scott Long +\ Copyright (c) 2003 Scott Long \ Copyright (c) 2003 Aleksander Fafula -\ Copyright (c) 2006-2013 Devin Teske +\ Copyright (c) 2006-2015 Devin Teske \ 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 Copied and modified: stable/10/sys/boot/forth/brand-fbsd.4th (from r280933, head/sys/boot/forth/brand-fbsd.4th) ============================================================================== --- head/sys/boot/forth/brand-fbsd.4th Wed Apr 1 01:14:19 2015 (r280933, copy source) +++ stable/10/sys/boot/forth/brand-fbsd.4th Wed Apr 22 01:08:40 2015 (r281843) @@ -26,13 +26,21 @@ 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) - 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 ." |_| |_| \___|\___||____/|_____/|_____/ " + s" ______ ____ _____ _____ " brand+ + s" | ____| | _ \ / ____| __ \ " brand+ + s" | |___ _ __ ___ ___ | |_) | (___ | | | |" brand+ + s" | ___| '__/ _ \/ _ \| _ < \___ \| | | |" brand+ + s" | | | | | __/ __/| |_) |____) | |__| |" brand+ + s" | | | | | | || | | |" brand+ + s" |_| |_| \___|\___||____/|_____/|_____/ " brand+ + + 2drop ; Modified: stable/10/sys/boot/forth/brand.4th ============================================================================== --- stable/10/sys/boot/forth/brand.4th Wed Apr 22 00:40:41 2015 (r281842) +++ stable/10/sys/boot/forth/brand.4th Wed Apr 22 01:08:40 2015 (r281843) @@ -1,4 +1,4 @@ -\ Copyright (c) 2006-2011 Devin Teske +\ Copyright (c) 2006-2015 Devin Teske \ 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. -\ -\ Currently available: -\ -\ NAME DESCRIPTION -\ fbsd FreeBSD logo +\ 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. +\ +\ 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 ; Modified: stable/10/sys/boot/forth/check-password.4th ============================================================================== --- stable/10/sys/boot/forth/check-password.4th Wed Apr 22 00:40:41 2015 (r281842) +++ stable/10/sys/boot/forth/check-password.4th Wed Apr 22 01:08:40 2015 (r281843) @@ -1,4 +1,4 @@ -\ Copyright (c) 2006-2012 Devin Teske +\ Copyright (c) 2006-2015 Devin Teske \ 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 + 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 +; - \ Check key pressed (see loader(8)) and input limit - dup 0<> if ( and ) readlen @ readmax < if +: cfill ( c c-addr/u -- ) + begin dup 0> while + -rot 2dup c! 1+ rot 1- + repeat 2drop drop +; - \ 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 - - \ Always allow Backspace and Enter - dup bs_key = if exit then - dup enter_key = if exit then - - 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 Modified: stable/10/sys/boot/forth/check-password.4th.8 ============================================================================== --- stable/10/sys/boot/forth/check-password.4th.8 Wed Apr 22 00:40:41 2015 (r281842) +++ stable/10/sys/boot/forth/check-password.4th.8 Wed Apr 22 01:08:40 2015 (r281843) @@ -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 it 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 , Modified: stable/10/sys/boot/forth/delay.4th ============================================================================== --- stable/10/sys/boot/forth/delay.4th Wed Apr 22 00:40:41 2015 (r281842) +++ stable/10/sys/boot/forth/delay.4th Wed Apr 22 01:08:40 2015 (r281843) @@ -1,4 +1,4 @@ -\ Copyright (c) 2008-2011 Devin Teske +\ Copyright (c) 2008-2015 Devin Teske \ 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 c 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 cont evaluate \ evaluate/execute the command string then ; + +only forth definitions Modified: stable/10/sys/boot/forth/frames.4th ============================================================================== --- stable/10/sys/boot/forth/frames.4th Wed Apr 22 00:40:41 2015 (r281842) +++ stable/10/sys/boot/forth/frames.4th Wed Apr 22 01:08:40 2015 (r281843) @@ -1,9 +1,37 @@ -\ Words implementing frame drawing -\ XXX Filled boxes are left as an exercise for the reader... ;-/ +\ Copyright (c) 2003 Scott Long +\ Copyright (c) 2012-2015 Devin Teske +\ 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 Modified: stable/10/sys/boot/forth/loader.4th ============================================================================== --- stable/10/sys/boot/forth/loader.4th Wed Apr 22 00:40:41 2015 (r281842) +++ stable/10/sys/boot/forth/loader.4th Wed Apr 22 01:08:40 2015 (r281843) @@ -1,4 +1,5 @@ -\ Copyright (c) 1999 Daniel C. Sobral +\ Copyright (c) 1999 Daniel C. Sobral +\ Copyright (c) 2011-2015 Devin Teske \ 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 b 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 b ?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 Modified: stable/10/sys/boot/forth/loader.conf ============================================================================== --- stable/10/sys/boot/forth/loader.conf Wed Apr 22 00:40:41 2015 (r281842) *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***