3 ## THIS IS NOT A CONFFILE DO NOT EDIT !!!
5 ###############################################################################
7 ## ofboot first stage autoconfiguring bootloader for yaboot and ybin
8 ## Copyright (C) 2000, 2001, 2002, 2003 Ethan Benson
10 ## Forth code written by Chris Emerson
12 ## Copyright (C) 2000, 2001 Chris Emerson
14 ## Portions of Forth code also written by iNOUE Koich!
16 ## Copyright (C) 2000, 2001 iNOUE Koich!
18 ## This program is free software; you can redistribute it and/or
19 ## modify it under the terms of the GNU General Public License
20 ## as published by the Free Software Foundation; either version 2
21 ## of the License, or (at your option) any later version.
23 ## This program is distributed in the hope that it will be useful,
24 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
25 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 ## GNU General Public License for more details.
28 ## You should have received a copy of the GNU General Public License
29 ## along with this program; if not, write to the Free Software
30 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
32 ###############################################################################
34 ## THIS IS NOT A CONFFILE DO NOT EDIT !!!
36 ## This script is not meant to be called directly, only by ybin.
38 ## Usage: OS-count defaultos timeout fgc bgc osname oslabel oskey osdev osfile ...
43 ## make sure we are called at least somewhat sanely.
45 echo 1>&2 "$PRG: Need arguments"
49 if [ $# != "$(($1 * 5 + 5))" ] ; then
50 echo 1>&2 "$PRG: Invalid argument count: $# should be $(($1 * 5 + 5))"
54 if [ "$1" -gt 8 ] ; then
55 echo 1>&2 "$PRG: Maximum number of OSes is currently 8"
59 ## we need printf so \n works, but echo -e -n will sometimes do.
60 if [ "$(printf printf_test 2>/dev/null)" = printf_test ] ; then
66 ## make sure echo is not lame if we must use it.
67 if [ "$PRINTF" != printf ] ; then
68 if [ "$(echo -e -n echo_test)" != echo_test ] ; then
69 echo 1>&2 "$PRG: printf unavailable and echo is broken, sorry."
74 ## get first 5 args which are global and dispose of them.
82 ## is a boot menu actually needed?
83 if [ "$OSNUM" = 1 ] ; then
89 ## create the variables.
98 while [ "$COUNT" -le "$OSNUM" ] ; do
102 [ "$DEBUG" = 1 ] && $PRINTF 1>&2 "$PRG: DEBUG: file1: $5\n"
103 [ "$COUNT" = "$OSNUM" ] && c="."
104 BTYA=": boot$1 \" Loading second stage bootstrap...\" .printf 100 ms load-base release-load-area \" ${4}${5}\" \$boot ;"
105 MENUYA="\" Press $3 for GNU/Linux${c-,}\"(0d 0a)\" .printf"
106 GETYA=" ascii $3 of \" $3 \"(0d 0a)\" .printf boot$1 endof"
108 COUNT="$(($COUNT + 1))"
111 [ "$DEBUG" = 1 ] && $PRINTF 1>&2 "$PRG: DEBUG: file2: $5\n"
112 [ "$COUNT" = "$OSNUM" ] && c="."
113 [ "$4" = "quit" ] && BOOT=quit
114 [ "$1" = "ybsd" ] && BOOT="load-base release-load-area \" ${4}${5%/*} ${5##*/},/bsd\" \$boot"
115 [ "$1" != ybsd -a "$4" != quit ] && BOOT="load-base release-load-area \" ${4}${5}\" \$boot"
116 BT2=": boot$1 \" Booting $2...\" .printf 100 ms $BOOT ;"
117 MENU2="\" $3 for $2${c-,}\"(0d 0a)\" .printf"
118 GET2=" ascii $3 of \" $3 \"(0d 0a)\" .printf boot$1 endof"
120 COUNT="$(($COUNT + 1))"
123 [ "$DEBUG" = 1 ] && $PRINTF 1>&2 "$PRG: DEBUG: file3: $5\n"
124 [ "$COUNT" = "$OSNUM" ] && c="."
125 [ "$4" = "quit" ] && BOOT=quit
126 [ "$1" = "ybsd" ] && BOOT="load-base release-load-area \" ${4}${5%/*} ${5##*/},/bsd\" \$boot"
127 [ "$1" != ybsd -a "$4" != quit ] && BOOT="load-base release-load-area \" ${4}${5}\" \$boot"
128 BT3=": boot$1 \" Booting $2...\" .printf 100 ms $BOOT ;"
129 MENU3="\" $3 for $2${c-,}\"(0d 0a)\" .printf"
130 GET3=" ascii $3 of \" $3 \"(0d 0a)\" .printf boot$1 endof"
132 COUNT="$(($COUNT + 1))"
135 [ "$DEBUG" = 1 ] && $PRINTF 1>&2 "$PRG: DEBUG: file4: $5\n"
136 [ "$COUNT" = "$OSNUM" ] && c="."
137 [ "$4" = "quit" ] && BOOT=quit
138 [ "$1" = "ybsd" ] && BOOT="load-base release-load-area \" ${4}${5%/*} ${5##*/},/bsd\" \$boot"
139 [ "$1" != ybsd -a "$4" != quit ] && BOOT="load-base release-load-area \" ${4}${5}\" \$boot"
140 BT4=": boot$1 \" Booting $2...\" .printf 100 ms $BOOT ;"
141 MENU4="\" $3 for $2${c-,}\"(0d 0a)\" .printf"
142 GET4=" ascii $3 of \" $3 \"(0d 0a)\" .printf boot$1 endof"
144 COUNT="$(($COUNT + 1))"
147 [ "$DEBUG" = 1 ] && $PRINTF 1>&2 "$PRG: DEBUG: file5: $5\n"
148 [ "$COUNT" = "$OSNUM" ] && c="."
149 [ "$4" = "quit" ] && BOOT=quit
150 [ "$1" = "ybsd" ] && BOOT="load-base release-load-area \" ${4}${5%/*} ${5##*/},/bsd\" \$boot"
151 [ "$1" != ybsd -a "$4" != quit ] && BOOT="load-base release-load-area \" ${4}${5}\" \$boot"
152 BT5=": boot$1 \" Booting $2...\" .printf 100 ms $BOOT ;"
153 MENU5="\" $3 for $2${c-,}\"(0d 0a)\" .printf"
154 GET5=" ascii $3 of \" $3 \"(0d 0a)\" .printf boot$1 endof"
156 COUNT="$(($COUNT + 1))"
159 [ "$DEBUG" = 1 ] && $PRINTF 1>&2 "$PRG: DEBUG: file6: $5\n"
160 [ "$COUNT" = "$OSNUM" ] && c="."
161 [ "$4" = "quit" ] && BOOT=quit
162 [ "$1" = "ybsd" ] && BOOT="load-base release-load-area \" ${4}${5%/*} ${5##*/},/bsd\" \$boot"
163 [ "$1" != ybsd -a "$4" != quit ] && BOOT="load-base release-load-area \" ${4}${5}\" \$boot"
164 BT6=": boot$1 \" Booting $2...\" .printf 100 ms $BOOT ;"
165 MENU6="\" $3 for $2${c-,}\"(0d 0a)\" .printf"
166 GET6=" ascii $3 of \" $3 \"(0d 0a)\" .printf boot$1 endof"
168 COUNT="$(($COUNT + 1))"
171 [ "$DEBUG" = 1 ] && $PRINTF 1>&2 "$PRG: DEBUG: file7: $5\n"
172 [ "$COUNT" = "$OSNUM" ] && c="."
173 [ "$4" = "quit" ] && BOOT=quit
174 [ "$1" = "ybsd" ] && BOOT="load-base release-load-area \" ${4}${5%/*} ${5##*/},/bsd\" \$boot"
175 [ "$1" != ybsd -a "$4" != quit ] && BOOT="load-base release-load-area \" ${4}${5}\" \$boot"
176 BT7=": boot$1 \" Booting $2...\" .printf 100 ms $BOOT ;"
177 MENU7="\" $3 for $2${c-,}\"(0d 0a)\" .printf"
178 GET7=" ascii $3 of \" $3 \"(0d 0a)\" .printf boot$1 endof"
180 COUNT="$(($COUNT + 1))"
183 [ "$DEBUG" = 1 ] && $PRINTF 1>&2 "$PRG: DEBUG: file8: $5\n"
184 [ "$COUNT" = "$OSNUM" ] && c="."
185 [ "$4" = "quit" ] && BOOT=quit
186 [ "$1" = "ybsd" ] && BOOT="load-base release-load-area \" ${4}${5%/*} ${5##*/},/bsd\" \$boot"
187 [ "$1" != ybsd -a "$4" != quit ] && BOOT="load-base release-load-area \" ${4}${5}\" \$boot"
188 BT8=": boot$1 \" Booting $2...\" .printf 100 ms $BOOT ;"
189 MENU8="\" $3 for $2${c-,}\"(0d 0a)\" .printf"
190 GET8=" ascii $3 of \" $3 \"(0d 0a)\" .printf boot$1 endof"
192 COUNT="$(($COUNT + 1))"
197 ## first OS is reserved.
198 if [ "$OSNAME1" != yaboot ] ; then
199 echo 1>&2 "ofboot: first OS must be yaboot"
203 ## concatenate the variables together.
211 BOOTVARS="${BTYA}\n${BT2}"
212 MENUOPTS="${MENUYA}\n${MENU2}"
213 GETOS="${GETYA}\n${GET2}"
216 BOOTVARS="${BTYA}\n${BT2}\n${BT3}"
217 MENUOPTS="${MENUYA}\n${MENU2}\n${MENU3}"
218 GETOS="${GETYA}\n${GET2}\n${GET3}"
221 BOOTVARS="${BTYA}\n${BT2}\n${BT3}\n${BT4}"
222 MENUOPTS="${MENUYA}\n${MENU2}\n${MENU3}\n${MENU4}"
223 GETOS="${GETYA}\n${GET2}\n${GET3}\n${GET4}"
226 BOOTVARS="${BTYA}\n${BT2}\n${BT3}\n${BT4}\n${BT5}"
227 MENUOPTS="${MENUYA}\n${MENU2}\n${MENU3}\n${MENU4}\n${MENU5}"
228 GETOS="${GETYA}\n${GET2}\n${GET3}\n${GET4}\n${GET5}"
231 BOOTVARS="${BTYA}\n${BT2}\n${BT3}\n${BT4}\n${BT5}\n${BT6}"
232 MENUOPTS="${MENUYA}\n${MENU2}\n${MENU3}\n${MENU4}\n${MENU5}\n${MENU6}"
233 GETOS="${GETYA}\n${GET2}\n${GET3}\n${GET4}\n${GET5}\n${GET6}"
236 BOOTVARS="${BTYA}\n${BT2}\n${BT3}\n${BT4}\n${BT5}\n${BT6}\n${BT7}"
237 MENUOPTS="${MENUYA}\n${MENU2}\n${MENU3}\n${MENU4}\n${MENU5}\n${MENU6}\n${MENU7}"
238 GETOS="${GETYA}\n${GET2}\n${GET3}\n${GET4}\n${GET5}\n${GET6}\n${GET7}"
241 BOOTVARS="${BTYA}\n${BT2}\n${BT3}\n${BT4}\n${BT5}\n${BT6}\n${BT7}\n${BT8}"
242 MENUOPTS="${MENUYA}\n${MENU2}\n${MENU3}\n${MENU4}\n${MENU5}\n${MENU6}\n${MENU7}\n${MENU8}"
243 GETOS="${GETYA}\n${GET2}\n${GET3}\n${GET4}\n${GET5}\n${GET6}\n${GET7}\n${GET8}"
247 if [ -n "$YBINOFICON" -a -f "$YBINOFICON" -a -r "$YBINOFICON" ] ; then
248 OFBOOTICON="$(cat "$YBINOFICON")"
250 OFBOOTICON="<OS-BADGE-ICONS>
252 000000000000F8FEACF6000000000000
253 0000000000F5FFFFFEFEF50000000000
254 00000000002BFAFEFAFCF70000000000
255 0000000000F65D5857812B0000000000
256 0000000000F5350B2F88560000000000
257 0000000000F6335708F8FE0000000000
258 00000000005600F600F5FD8100000000
259 00000000F9F8000000F5FAFFF8000000
260 000000008100F5F50000F6FEFE000000
261 000000F8F700F500F50000FCFFF70000
262 00000088F70000F50000F5FCFF2B0000
263 0000002F582A00F5000008ADE02C0000
264 00090B0A35A62B0000002D3B350A0000
265 000A0A0B0B3BF60000505E0B0A0B0A00
266 002E350B0B2F87FAFCF45F0B2E090000
267 00000007335FF82BF72B575907000000
268 000000000000ACFFFF81000000000000
269 000000000081FFFFFFFF810000000000
270 0000000000FBFFFFFFFFAC0000000000
271 000000000081DFDFDFFFFB0000000000
272 000000000081DD5F83FFFD0000000000
273 000000000081DDDF5EACFF0000000000
274 0000000000FDF981F981FFFF00000000
275 00000000FFACF9F9F981FFFFAC000000
276 00000000FFF98181F9F981FFFF000000
277 000000ACACF981F981F9F9FFFFAC0000
278 000000FFACF9F981F9F981FFFFFB0000
279 00000083DFFBF981F9F95EFFFFFC0000
280 005F5F5FDDFFFBF9F9F983DDDD5F0000
281 005F5F5F5FDD81F9F9E7DF5F5F5F5F00
282 0083DD5F5F83FFFFFFFFDF5F835F0000
283 000000FBDDDFACFBACFBDFDFFB000000
284 000000000000FFFFFFFF000000000000
285 0000000000FFFFFFFFFFFF0000000000
286 0000000000FFFFFFFFFFFF0000000000
287 0000000000FFFFFFFFFFFF0000000000
288 0000000000FFFFFFFFFFFF0000000000
289 0000000000FFFFFFFFFFFF0000000000
290 0000000000FFFFFFFFFFFFFF00000000
291 00000000FFFFFFFFFFFFFFFFFF000000
292 00000000FFFFFFFFFFFFFFFFFF000000
293 000000FFFFFFFFFFFFFFFFFFFFFF0000
294 000000FFFFFFFFFFFFFFFFFFFFFF0000
295 000000FFFFFFFFFFFFFFFFFFFFFF0000
296 00FFFFFFFFFFFFFFFFFFFFFFFFFF0000
297 00FFFFFFFFFFFFFFFFFFFFFFFFFFFF00
298 00FFFFFFFFFFFFFFFFFFFFFFFFFF0000
299 000000FFFFFFFFFFFFFFFFFFFF000000
303 ## create tmp files safely.
304 TMP="${TMPDIR:-/tmp}"
305 TMPBOOT=`mktemp -q "$TMP/ofboot.XXXXXX"`
306 if [ $? != 0 ] ; then
307 echo 1>&2 "Cannot create temp file, aborting."
311 ## create the real script
315 MacRISC MacRISC3 MacRISC4
318 PowerPC GNU/Linux First Stage Bootstrap
321 : .printf fb8-write drop ;
332 \" \"(0000000000aa00aa0000aaaaaa0000aa00aaaa5500aaaaaa)\" drop 0 7 set-colors
333 \" \"(5555555555ff55ff5555ffffff5555ff55ffffff55ffffff)\" drop 8 15 set-colors
335 $FGCOLOR to foreground-color
336 $BGCOLOR to background-color
339 \" First Stage GNU/Linux Bootstrap\"(0d 0a)\" .printf
340 \" \"(0d 0a)\" .printf
342 \" \"(0d 0a)\" .printf
343 \" Stage 1 Boot: \" .printf
344 get-msecs d# $TIMEOUT 3E8 * +
354 \" \"(0d 0a)\" .printf $DEFAULTOS
357 </CHRP-BOOT>\n" > "$TMPBOOT"