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 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 || BOOT="load-base release-load-area \" ${4}${5}\" \$boot"
114 BT2=": boot$1 \" Booting $2...\" .printf 100 ms $BOOT ;"
115 MENU2="\" $3 for $2${c-,}\"(0d 0a)\" .printf"
116 GET2=" ascii $3 of \" $3 \"(0d 0a)\" .printf boot$1 endof"
118 COUNT="$(($COUNT + 1))"
121 [ "$DEBUG" = 1 ] && $PRINTF 1>&2 "$PRG: DEBUG: file3: $5\n"
122 [ "$COUNT" = "$OSNUM" ] && c="."
123 [ "$4" = "quit" ] && BOOT=quit || BOOT="load-base release-load-area \" ${4}${5}\" \$boot"
124 BT3=": boot$1 \" Booting $2...\" .printf 100 ms $BOOT ;"
125 MENU3="\" $3 for $2${c-,}\"(0d 0a)\" .printf"
126 GET3=" ascii $3 of \" $3 \"(0d 0a)\" .printf boot$1 endof"
128 COUNT="$(($COUNT + 1))"
131 [ "$DEBUG" = 1 ] && $PRINTF 1>&2 "$PRG: DEBUG: file4: $5\n"
132 [ "$COUNT" = "$OSNUM" ] && c="."
133 [ "$4" = "quit" ] && BOOT=quit || BOOT="load-base release-load-area \" ${4}${5}\" \$boot"
134 BT4=": boot$1 \" Booting $2...\" .printf 100 ms $BOOT ;"
135 MENU4="\" $3 for $2${c-,}\"(0d 0a)\" .printf"
136 GET4=" ascii $3 of \" $3 \"(0d 0a)\" .printf boot$1 endof"
138 COUNT="$(($COUNT + 1))"
141 [ "$DEBUG" = 1 ] && $PRINTF 1>&2 "$PRG: DEBUG: file5: $5\n"
142 [ "$COUNT" = "$OSNUM" ] && c="."
143 [ "$4" = "quit" ] && BOOT=quit || BOOT="load-base release-load-area \" ${4}${5}\" \$boot"
144 BT5=": boot$1 \" Booting $2...\" .printf 100 ms $BOOT ;"
145 MENU5="\" $3 for $2${c-,}\"(0d 0a)\" .printf"
146 GET5=" ascii $3 of \" $3 \"(0d 0a)\" .printf boot$1 endof"
148 COUNT="$(($COUNT + 1))"
151 [ "$DEBUG" = 1 ] && $PRINTF 1>&2 "$PRG: DEBUG: file6: $5\n"
152 [ "$COUNT" = "$OSNUM" ] && c="."
153 [ "$4" = "quit" ] && BOOT=quit || BOOT="load-base release-load-area \" ${4}${5}\" \$boot"
154 BT6=": boot$1 \" Booting $2...\" .printf 100 ms $BOOT ;"
155 MENU6="\" $3 for $2${c-,}\"(0d 0a)\" .printf"
156 GET6=" ascii $3 of \" $3 \"(0d 0a)\" .printf boot$1 endof"
158 COUNT="$(($COUNT + 1))"
161 [ "$DEBUG" = 1 ] && $PRINTF 1>&2 "$PRG: DEBUG: file7: $5\n"
162 [ "$COUNT" = "$OSNUM" ] && c="."
163 [ "$4" = "quit" ] && BOOT=quit || BOOT="load-base release-load-area \" ${4}${5}\" \$boot"
164 BT7=": boot$1 \" Booting $2...\" .printf 100 ms $BOOT ;"
165 MENU7="\" $3 for $2${c-,}\"(0d 0a)\" .printf"
166 GET7=" ascii $3 of \" $3 \"(0d 0a)\" .printf boot$1 endof"
168 COUNT="$(($COUNT + 1))"
171 [ "$DEBUG" = 1 ] && $PRINTF 1>&2 "$PRG: DEBUG: file8: $5\n"
172 [ "$COUNT" = "$OSNUM" ] && c="."
173 [ "$4" = "quit" ] && BOOT=quit || BOOT="load-base release-load-area \" ${4}${5}\" \$boot"
174 BT8=": boot$1 \" Booting $2...\" .printf 100 ms $BOOT ;"
175 MENU8="\" $3 for $2${c-,}\"(0d 0a)\" .printf"
176 GET8=" ascii $3 of \" $3 \"(0d 0a)\" .printf boot$1 endof"
178 COUNT="$(($COUNT + 1))"
183 ## first OS is reserved.
184 if [ "$OSNAME1" != yaboot ] ; then
185 echo 1>&2 "ofboot: first OS must be yaboot"
189 ## concatenate the variables together.
197 BOOTVARS="${BTYA}\n${BT2}"
198 MENUOPTS="${MENUYA}\n${MENU2}"
199 GETOS="${GETYA}\n${GET2}"
202 BOOTVARS="${BTYA}\n${BT2}\n${BT3}"
203 MENUOPTS="${MENUYA}\n${MENU2}\n${MENU3}"
204 GETOS="${GETYA}\n${GET2}\n${GET3}"
207 BOOTVARS="${BTYA}\n${BT2}\n${BT3}\n${BT4}"
208 MENUOPTS="${MENUYA}\n${MENU2}\n${MENU3}\n${MENU4}"
209 GETOS="${GETYA}\n${GET2}\n${GET3}\n${GET4}"
212 BOOTVARS="${BTYA}\n${BT2}\n${BT3}\n${BT4}\n${BT5}"
213 MENUOPTS="${MENUYA}\n${MENU2}\n${MENU3}\n${MENU4}\n${MENU5}"
214 GETOS="${GETYA}\n${GET2}\n${GET3}\n${GET4}\n${GET5}"
217 BOOTVARS="${BTYA}\n${BT2}\n${BT3}\n${BT4}\n${BT5}\n${BT6}"
218 MENUOPTS="${MENUYA}\n${MENU2}\n${MENU3}\n${MENU4}\n${MENU5}\n${MENU6}"
219 GETOS="${GETYA}\n${GET2}\n${GET3}\n${GET4}\n${GET5}\n${GET6}"
222 BOOTVARS="${BTYA}\n${BT2}\n${BT3}\n${BT4}\n${BT5}\n${BT6}\n${BT7}"
223 MENUOPTS="${MENUYA}\n${MENU2}\n${MENU3}\n${MENU4}\n${MENU5}\n${MENU6}\n${MENU7}"
224 GETOS="${GETYA}\n${GET2}\n${GET3}\n${GET4}\n${GET5}\n${GET6}\n${GET7}"
227 BOOTVARS="${BTYA}\n${BT2}\n${BT3}\n${BT4}\n${BT5}\n${BT6}\n${BT7}\n${BT8}"
228 MENUOPTS="${MENUYA}\n${MENU2}\n${MENU3}\n${MENU4}\n${MENU5}\n${MENU6}\n${MENU7}\n${MENU8}"
229 GETOS="${GETYA}\n${GET2}\n${GET3}\n${GET4}\n${GET5}\n${GET6}\n${GET7}\n${GET8}"
233 if [ -n "$YBINOFICON" -a -f "$YBINOFICON" -a -r "$YBINOFICON" ] ; then
234 OFBOOTICON="$(cat "$YBINOFICON")"
236 OFBOOTICON="<OS-BADGE-ICONS>
238 000000000000F8FEACF6000000000000
239 0000000000F5FFFFFEFEF50000000000
240 00000000002BFAFEFAFCF70000000000
241 0000000000F65D5857812B0000000000
242 0000000000F5350B2F88560000000000
243 0000000000F6335708F8FE0000000000
244 00000000005600F600F5FD8100000000
245 00000000F9F8000000F5FAFFF8000000
246 000000008100F5F50000F6FEFE000000
247 000000F8F700F500F50000FCFFF70000
248 00000088F70000F50000F5FCFF2B0000
249 0000002F582A00F5000008ADE02C0000
250 00090B0A35A62B0000002D3B350A0000
251 000A0A0B0B3BF60000505E0B0A0B0A00
252 002E350B0B2F87FAFCF45F0B2E090000
253 00000007335FF82BF72B575907000000
254 000000000000ACFFFF81000000000000
255 000000000081FFFFFFFF810000000000
256 0000000000FBFFFFFFFFAC0000000000
257 000000000081DFDFDFFFFB0000000000
258 000000000081DD5F83FFFD0000000000
259 000000000081DDDF5EACFF0000000000
260 0000000000FDF981F981FFFF00000000
261 00000000FFACF9F9F981FFFFAC000000
262 00000000FFF98181F9F981FFFF000000
263 000000ACACF981F981F9F9FFFFAC0000
264 000000FFACF9F981F9F981FFFFFB0000
265 00000083DFFBF981F9F95EFFFFFC0000
266 005F5F5FDDFFFBF9F9F983DDDD5F0000
267 005F5F5F5FDD81F9F9E7DF5F5F5F5F00
268 0083DD5F5F83FFFFFFFFDF5F835F0000
269 000000FBDDDFACFBACFBDFDFFB000000
270 000000000000FFFFFFFF000000000000
271 0000000000FFFFFFFFFFFF0000000000
272 0000000000FFFFFFFFFFFF0000000000
273 0000000000FFFFFFFFFFFF0000000000
274 0000000000FFFFFFFFFFFF0000000000
275 0000000000FFFFFFFFFFFF0000000000
276 0000000000FFFFFFFFFFFFFF00000000
277 00000000FFFFFFFFFFFFFFFFFF000000
278 00000000FFFFFFFFFFFFFFFFFF000000
279 000000FFFFFFFFFFFFFFFFFFFFFF0000
280 000000FFFFFFFFFFFFFFFFFFFFFF0000
281 000000FFFFFFFFFFFFFFFFFFFFFF0000
282 00FFFFFFFFFFFFFFFFFFFFFFFFFF0000
283 00FFFFFFFFFFFFFFFFFFFFFFFFFFFF00
284 00FFFFFFFFFFFFFFFFFFFFFFFFFF0000
285 000000FFFFFFFFFFFFFFFFFFFF000000
289 ## create tmp files safely.
290 TMP="${TMPDIR:-/tmp}"
291 TMPBOOT=`mktemp -q "$TMP/ofboot.XXXXXX"`
292 if [ $? != 0 ] ; then
293 echo 1>&2 "Cannot create temp file, aborting."
297 ## create the real script
304 PowerPC GNU/Linux First Stage Bootstrap
307 : .printf fb8-write drop ;
318 \" \"(0000000000aa00aa0000aaaaaa0000aa00aaaa5500aaaaaa)\" drop 0 7 set-colors
319 \" \"(5555555555ff55ff5555ffffff5555ff55ffffff55ffffff)\" drop 8 15 set-colors
321 $FGCOLOR to foreground-color
322 $BGCOLOR to background-color
325 \" First Stage GNU/Linux Bootstrap\"(0d 0a)\" .printf
326 \" \"(0d 0a)\" .printf
328 \" \"(0d 0a)\" .printf
330 get-msecs d# $TIMEOUT 3E8 * +
340 \" \"(0d 0a)\" .printf $DEFAULTOS
343 </CHRP-BOOT>\n" > "$TMPBOOT"