Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Nov 2013 07:54:54 +0000
From:      "Teske, Devin" <Devin.Teske@fisglobal.com>
To:        Alfred Perlstein <alfred@FreeBSD.org>
Cc:        FreeBSD Hackers <freebsd-hackers@freebsd.org>, Devin Teske <dteske@freebsd.org>, "Teske, Devin" <Devin.Teske@fisglobal.com>
Subject:   Re: Loader forth changes for customization
Message-ID:  <BCC78B2C-66F0-42C3-AD53-018637B2C433@fisglobal.com>
In-Reply-To: <5283933E.30603@freebsd.org>
References:  <5282E56F.4020307@freebsd.org> <52832003.8080406@freebsd.org> <09673101-DB54-4D25-9989-8C80D06E266B@fisglobal.com> <5283933E.30603@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]

On Nov 13, 2013, at 6:57 AM, Alfred Perlstein wrote:

> 
> On 11/13/13, 12:18 AM, Teske, Devin wrote:
>> On Nov 12, 2013, at 10:45 PM, Alfred Perlstein wrote:
>> 
>>> I added some hooks for menu.rc as well, you can see it via the github urls below.
>>> 
>>> I've attached a sample menu.rc.local that provides additional menus.
>>> 
>>> -Alfred
>>> 
>>> On 11/12/13, 6:35 PM, Alfred Perlstein wrote:
>>>> Hey folks,
>>>> 
>>>> I added some forth using Devin's help to make it easier to customize the FreeBSD boot loader graphics.
>>>> 
>>>> Diffs are here:
>>>> https://github.com/alfredperlstein/freebsd/compare/loader_custom_rc
>>>> -or-
>>>> https://github.com/alfredperlstein/freebsd/compare/loader_custom_rc.diff
>>>> 
>>>> 
>>>> Diff attached.
>>>> 
>>>> Also attached is a custom loader.rc file and loader.conf file that shows how to set the brand/logo.
>>>> 
>>>> Please review.
>>>> 
>> I signed up for a github account (thanks), and I started commenting on some lines.
> yay! :)
>> 
>>>> -Alfred
>>> <menu.rc.local>
>> Hmmm, I hadn't realized that you could say:
>> 
>> set foo=bar
>> 
>> Along-side setting functions in the same file.
>> 
>> I don't think you can set functions in an *.rc file, only in a *.4th file?
>> 
>> No? Maybe it's a false misconception of mine. I've been keeping them
>> separate for years. (but probably rightfully so, to keep *.rc files clean).
> 
> It seems to work although I will talk to the team about making separate files for the set commands.
> 
> I've responded to your review comments here:
> 
> https://github.com/alfredperlstein/freebsd/commit/0ca72dccd78b880b3e3ef4c2bb9ce025950a370b#commitcomment-4584862
> 
> The changes I made are now in the branch
> https://github.com/alfredperlstein/freebsd/tree/loader_custom_rc and you likely should see them in the updated pull request I sent you.
> 

I improved on a few things...

https://github.com/devinteske/freebsd/compare/freebsd:master...master
-or-
https://github.com/devinteske/freebsd/compare/freebsd:master...master.diff
-or-
Attached SVN patch.txt

-- 
Devin

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

[-- Attachment #2 --]
Index: sys/boot/forth/loader.4th
===================================================================
--- sys/boot/forth/loader.4th	(revision 257821)
+++ sys/boot/forth/loader.4th	(working copy)
@@ -233,7 +233,16 @@ include /boot/check-password.4th
   s" disable-module" s" disable loading of a module" .?
   s" toggle-module" s" toggle loading of a module" .?
   s" show-module" s" show module load data" .?
+  s" try-include" s" try to load/interpret files" .?
 ;
 
+: try-include ( -- ) \ see loader.4th(8)
+  ['] include ( -- xt ) \ get the execution token of `include'
+  catch ( xt -- exception# | 0 ) if \ failed
+    LF parse ( c -- s-addr/u ) 2drop \ advance >in to EOL (drop data)
+    \ ... prevents words unused by `include' from being interpreted
+  then
+; immediate \ interpret immediately for access to `source' (aka tib)
+
 only forth also
 
Index: sys/boot/forth/loader.4th.8
===================================================================
--- sys/boot/forth/loader.4th.8	(revision 257820)
+++ sys/boot/forth/loader.4th.8	(working copy)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 17, 2013
+.Dd November 13, 2013
 .Dt LOADER.4TH 8
 .Os
 .Sh NAME
@@ -158,6 +158,13 @@ files to specify the action after a module loading
 Used inside
 .Xr loader.conf 5
 files to specify the action after a module loading fails.
+.It Ic try-include Ar file Op Ar
+Process script files if they exist.
+Each file, in turn, is completely read into memory,
+and then each of its lines is passed to the command line interpreter.
+If any error is returned by the interpreter, the try-include
+command aborts immediately, without reading any other files, and
+silently returns without error.
 .El
 .Sh FILES
 .Bl -tag -width /boot/loader.4th -compact
Index: sys/boot/forth/loader.rc
===================================================================
--- sys/boot/forth/loader.rc	(revision 257820)
+++ sys/boot/forth/loader.rc	(working copy)
@@ -3,6 +3,7 @@
 \
 \ Includes additional commands
 include /boot/loader.4th
+try-include /boot/loader.rc.local
 
 \ Reads and processes loader.conf variables
 \ NOTE: Change to `initialize' if you enable the below boot menu
Index: sys/boot/forth/menu.rc
===================================================================
--- sys/boot/forth/menu.rc	(revision 257820)
+++ sys/boot/forth/menu.rc	(working copy)
@@ -120,6 +120,10 @@ set optionstoggled_ansi[6]="Verbose.....
 \ 
 set menu_timeout_command="boot"
 
+\ Include optional elements defined in a local file
+\ 
+try-include /boot/menu.rc.local
+
 \ Display the main menu (see `menu.4th')
 set menuset_initial=1
 menuset-loadinitial
Index: sys/boot/i386/loader/loader.rc
===================================================================
--- sys/boot/i386/loader/loader.rc	(revision 257650)
+++ sys/boot/i386/loader/loader.rc	(working copy)
@@ -3,6 +3,7 @@
 \
 \ Includes additional commands
 include /boot/loader.4th
+try-include /boot/loader.rc.local
 
 \ Reads and processes loader.conf variables
 initialize

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BCC78B2C-66F0-42C3-AD53-018637B2C433>