Subject: bootmenu.4th
To: netbsd-macppc <port-macppc@netbsd.org>
From: Dan LaBell <dan4l-nospam@verizon.net>
List: port-macppc
Date: 04/05/2005 21:20:08
Below is a bootmenu I'm using on my iBook and iMac DV SE (both g3's).
I'm posting it in case anyone might find it useful. I've used this for
about 10 days now. It will require editing to use, I'm thinking if one
could edit a kernel config, one could figure this out. Comments to end
of
line start with '\ '. The default menu choice is below a line
commented '
default choice' , the timeout below 'seconds to wait' Actual boot
commands
are near the bottom, inside a case statement, and, as is, assumes my
harddrive setup, but should seem familiar -- replace with the 1 line OF
bootcommand for the system, if choices are added then the menu display
will need to be changed to include that , by adding another .( ... )
cr line. I'm assuming non-forth'ers can customize it, mainly, by
imitating what's there.
I'm already thinking of better ways to implement this, maybe a little
closer to boot blocks in interface, and w/o having to change forth code
to configure, in 2 places, but then again it does allow auto-booting,
dual booting macos, allows easy access to OF via 'q' and 't' , and
shutdown.
I leave boot-device and boot-file to what mac-boot likes, and only set
boot-command:
setenv boot-command boot hd:,\bootmenu.4th
and place the file alongside ofwboot.xcf.
I guess, I should add, it is PROVIDED AS IS, WITH NO WARRANTY, just to
be
official, also I haven't tested this with security-mode set.
--------------------------------------------
\ bootmenu.4th
\ setup console for forth
input-device input
output-device output
true to use-console?
\ clear screen, show menu
reset-screen
blink-screen
decimal
12 emit erase-screen
cr cr cr space
13 0 do 176 emit loop .( Boot Menu ) 13 0 do 176 emit loop cr
\ display menu choices
.( q : Quit to Forth ) cr
.( m : mac-boot ) cr
.( s : shut-down ) cr
.( t : telnet ) cr
.( n : boot /netbsd ) cr
.( o : boot /netbsd.old ) cr
space 37 0 do 176 emit loop cr
\ default choice
ascii n
\ seconds to wait,
20
: defaultkey ( defkey secs -- key | defaultkey )
1000 *
get-msecs +
begin
key? 0<>
if
2drop
key
true
else
dup get-msecs <
if
drop
true
else
false
then
then
until
;
begin
invert-screen
2dup defaultkey
invert-screen
case
ascii n of s" boot hd:,\ofwboot.xcf hd:9,/netbsd" eval endof
ascii o of s" boot hd:,\ofwboot.xcf hd:9,/netbsd.old" eval endof
ascii t of s" enet:telnet,192.168.199.9 " io quit endof
ascii s of shut-down endof
ascii m of mac-boot endof
ascii q of quit endof
endcase
again