Removed bootplash support from ppc/ppc64 since they only will work with gensplash...
[catalyst.git] / targets / support / bootloader-setup.sh
1 #!/bin/bash
2 # Copyright 1999-2005 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4 # $Header: /var/cvsroot/gentoo/src/catalyst/targets/support/bootloader-setup.sh,v 1.34 2006/04/19 14:28:40 wolf31o2 Exp $
5 . ${clst_sharedir}/targets/support/functions.sh
6 . ${clst_sharedir}/targets/support/filesystem-functions.sh
7
8 # $1 is the destination root
9
10 extract_cdtar $1
11 extract_kernels $1/boot
12 check_dev_manager
13 check_bootargs
14 check_filesystem_type
15
16 default_append_line="root=/dev/ram0 init=/linuxrc ${cmdline_opts} ${custom_kopts} cdroot"
17
18 case ${clst_mainarch} in
19         alpha)
20                 # NO SOFTLEVEL SUPPORT YET
21                 acfg=$1/etc/aboot.conf
22                 bctr=0
23                 for x in ${clst_boot_kernel}
24                 do
25                         echo -n "${bctr}:/boot/${x} " >> ${acfg}
26                         echo -n "initrd=/boot/${x}.igz root=/dev/ram0 " >> ${acfg}
27                         echo "init=/linuxrc ${cmdline_opts} cdroot" >> ${acfg}
28                         ((bctr=${bctr}+1))
29                 done
30                 ;;
31         arm)
32                 # NO SOFTLEVEL SUPPORT YET
33                 ;;
34         hppa)
35                 # NO SOFTLEVEL SUPPORT YET
36                 icfg=$1/boot/palo.conf
37                 kmsg=$1/boot/kernels.msg
38                 hmsg=$1/boot/help.msg
39                 echo "--commandline=0/${first} initrd=${first}.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts}" >> ${icfg}
40                 echo "--bootloader=boot/iplboot" >> ${icfg}
41                 echo "--ramdisk=boot/${first}.igz" >> ${icfg}
42                 ;;
43         ppc)
44                 # NO SOFTLEVEL SUPPORT YET
45                 
46                 # PPC requirements: 
47                 # -----------------
48                 # The specs indicate the kernels to be build. We need to put
49                 # those kernels and the corresponding initrd.img.gz(s) in the
50                 # /boot directory. This directory contains a message boot.msg 
51                 # containing some info to be displayed on boot, a configuration
52                 # (yaboot.conf) specifying the boot options (kernel/initrd 
53                 # combinations). The boot directory also contains a file called
54                 # yaboot, which normally gets copied from the live environment.
55                 # For now we supply a prebuilt file, prebuilt configuration 
56                 # and prebuilt boot message. This can be enhanced later on
57                 # but the following suffices for now:
58
59                 # this sets up the config file for yaboot
60
61
62                 # ADD RUNLEVEL SUPPORT ???
63
64                 icfg=$1/boot/yaboot.conf
65                 kmsg=$1/boot/boot.msg
66
67                 echo "default ${first}" > ${icfg}
68                 echo "timeout 300" >> ${icfg}
69                 echo "device=cd:" >> ${icfg}
70                 echo "root=/dev/ram" >> ${icfg}
71                 echo "fgcolor=white" >> ${icfg}
72                 echo "bgcolor=black" >> ${icfg}
73                 echo "message=/boot/boot.msg" >> ${icfg}
74
75                 # Here is where I fix up the boot.msg file.
76                 sed -e 's/ARCH/PPC/' \
77                         -e 's/HARDWARE/32-bit Apple and Pegasos hardware/' \
78                         -i $kmsg
79
80                 # Here we wipe out the /ppc directory, if it exists.
81                 rm -rf $1/ppc
82
83                 for x in ${clst_boot_kernel}
84                 do      
85                         eval custom_kopts=\$${x}_kernelopts
86                         echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
87                         echo "image=/boot/${x}" >> ${icfg}
88
89                         if [ -e "$1/boot/${x}.igz" ]
90                         then
91                                 echo "initrd=/boot/${x}.igz" >> ${icfg}
92                         fi
93
94                         echo "label=${x}" >> ${icfg}
95                         echo "read-write" >> ${icfg}
96                         if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
97                         then
98                                 echo "append=\"${default_append_line} splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet\"" >> ${icfg}
99                         else
100                                 echo "append=\"${default_append_line}\"" >> ${icfg}
101                         fi
102                 done
103         ;;
104         
105         ppc64)
106                 # NO SOFTLEVEL SUPPORT YET
107                 
108                 # PPC requirements: 
109                 # -----------------
110                 # The specs indicate the kernels to be build. We need to put
111                 # those kernels and the corresponding initrd.img.gz(s) in the
112                 # /boot directory. This directory contains a message boot.msg 
113                 # containing some info to be displayed on boot, a configuration
114                 # (yaboot.conf) specifying the boot options (kernel/initrd 
115                 # combinations). The boot directory also contains a file called
116                 # yaboot, which normally gets copied from the live environment.
117                 # For now we supply a prebuilt file, prebuilt configuration 
118                 # and prebuilt boot message. This can be enhanced later on
119                 # but the following suffices for now:
120
121                 # this sets up the config file for yaboot
122
123
124                 # ADD RUNLEVEL SUPPORT ???
125
126                 icfg=$1/boot/yaboot.conf
127                 kmsg=$1/boot/boot.msg
128
129                 echo "device=cd:" >> ${icfg}
130                 echo "root=/dev/ram" >> ${icfg}
131                 echo "fgcolor=white" >> ${icfg}
132                 echo "bgcolor=black" >> ${icfg}
133                 echo "message=/boot/boot.msg" >> ${icfg}
134                 
135                 # Here is where I fix up the boot.msg file.
136                 sed -e 's/ARCH/PPC/' \
137                         -e 's/HARDWARE/64-bit Apple and IBM hardware/' \
138                         -i $kmsg
139
140                 # Setup the IBM yaboot.conf     
141                 etc_icfg=$1/etc/yaboot.conf
142                 mkdir -p $1/etc 
143                 IBM_YABOOT="FALSE"
144                 echo "root=/dev/ram" >> ${etc_icfg}
145                 echo "fgcolor=white" >> ${etc_icfg}
146                 echo "bgcolor=black" >> ${etc_icfg}
147                 echo "message=/boot/boot.msg" >> ${etc_icfg}
148                 
149                 for x in ${clst_boot_kernel}
150                 do      
151                         eval "clst_kernel_console=\$clst_boot_kernel_${x}_console"
152                         eval "clst_kernel_machine_type=\$clst_boot_kernel_${x}_machine_type"
153                         eval custom_kopts=\$${x}_kernelopts
154                                 
155                         echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
156                         if [ "${clst_kernel_machine_type}" == "ibm" ]
157                         then
158                                 IBM_YABOOT="true"
159                                 if [ -n "${clst_kernel_console}" ]
160                                 then
161                                         echo >> ${etc_icfg}
162                                         echo "image=/boot/${x}" >> ${etc_icfg}
163
164                                         if [ -e "$1/boot/${x}.igz" ]
165                                         then
166                                                 echo "initrd=/boot/${x}.igz" >> ${etc_icfg}
167                                         fi
168
169                                         echo "label=${x}" >> ${etc_icfg}
170                                         echo "read-write" >> ${icfg}
171                                         if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
172                                         then
173                                                 echo "append=\"${default_append_line} splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet\"" >> ${etc_icfg}
174                                         else
175                                                 echo "append=\"${default_append_line}\"" >> ${etc_icfg}
176                                         fi
177
178                                         for y in ${clst_kernel_console}
179                                         do
180                                                 echo ${y}
181                                                 echo >> ${etc_icfg}
182                                                 echo "image=/boot/${x}" >> ${etc_icfg}
183
184                                                 if [ -e "$1/boot/${x}.igz" ]
185                                                 then
186                                                         echo "initrd=/boot/${x}.igz" >> ${etc_icfg}
187                                                 fi
188
189                                                 echo "label=${x}-${y} " >> ${etc_icfg}
190                                                 echo "read-write" >> ${icfg}
191                                                 echo "append=\"${default_append_line} console=${y}\"" >> ${etc_icfg}
192                                         done
193                                 else
194                                         echo >> ${etc_icfg}
195                                         echo "image=/boot/${x}" >> ${etc_icfg}
196
197                                         if [ -e "$1/boot/${x}.igz" ]
198                                         then
199                                                 echo "initrd=/boot/${x}.igz" >> ${etc_icfg}
200                                         fi
201
202                                         echo "label=${x}" >> ${etc_icfg}
203                                         echo "read-write" >> ${etc_icfg}
204                                         if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
205                                         then
206                                                 echo "append=\"${default_append_line} splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet\"" >> ${etc_icfg}
207                                         else
208                                                 echo "append=\"${default_append_line}\"" >> ${etc_icfg}
209                                         fi
210                                 fi
211                         else
212                                 if [ -n "${clst_kernel_console}" ]
213                                 then
214                                         echo >> ${icfg}
215                                         echo "image=/boot/${x}" >> ${icfg}
216
217                                         if [ -e "$1/boot/${x}.igz" ]
218                                         then
219                                                 echo "initrd=/boot/${x}.igz" >> ${icfg}
220                                         fi
221
222                                         echo "label=${x}" >> ${icfg}
223                                         echo "read-write" >> ${icfg}
224                                         if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
225                                         then
226                                                 echo "append=\"${default_append_line} splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet\"" >> ${icfg}
227                                         else
228                                                 echo "append=\"${default_append_line}\"" >> ${icfg}
229                                         fi
230                                         
231                                         for y in ${clst_kernel_console}
232                                         do
233                                                 echo >> ${icfg}
234                                                 echo "image=/boot/${x}" >> ${icfg}
235
236                                                 if [ -e "$1/boot/${x}.igz" ]
237                                                 then
238                                                         echo "initrd=/boot/${x}.igz" >> ${icfg}
239                                                 fi
240
241                                                 echo "label=${x}-${y} " >> ${icfg}
242                                                 echo "read-write" >> ${icfg}
243                                                 echo "append=\"${default_append_line} console=${y}\"" >> ${icfg}
244                                         done
245                                 else
246                                         echo >> ${icfg}
247                                         echo "image=/boot/${x}" >> ${icfg}
248
249                                         if [ -e "$1/boot/${x}.igz" ]
250                                         then
251                                                 echo "initrd=/boot/${x}.igz" >> ${icfg}
252                                         fi
253
254                                         echo "label=${x}" >> ${icfg}
255                                         echo "read-write" >> ${icfg}
256                                         if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
257                                         then
258                                                 echo "append=\"${default_append_line} splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet\"" >> ${icfg}
259                                         else
260                                                 echo "append=\"${default_append_line}\"" >> ${icfg}
261                                         fi
262                                 fi
263                         fi
264                 done
265
266                 if [ "${IBM_YABOOT}" == "FALSE" ]
267                 then 
268                         rm ${etc_kmsg}
269                         rmdir $1/etc
270                         if [ -d $1/ppc ]
271                         then
272                                 rm -r $1/ppc
273                         fi
274                 fi
275
276                 ;;
277         sparc*)
278                 # NO SOFTLEVEL SUPPORT YET
279                 
280                 scfg=$1/boot/silo.conf
281                 echo "default=\"help\"" > ${scfg}
282                 echo "message=\"/boot/boot.msg\"" >> ${scfg}
283
284                 for x in ${clst_boot_kernel}
285                 do
286                         echo >> ${icfg}
287                         echo "image=\"/boot/${x}\"" >> ${scfg}
288                         echo -e "\tlabel=\"${x}\"" >> ${scfg}
289                         echo -e "\tappend=\"initrd=/boot/${x}.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts} cdroot\"" >> ${scfg}
290
291                 done
292
293                 echo "image=\"cat /boot/silo.conf\"" >> ${scfg}
294                 echo -e "label=\"config\"" >> ${scfg}
295                 echo "image=\"cat /boot/video.msg\"" >> ${scfg}
296                 echo -e "label=\"video\"" >> ${scfg}
297                 echo "image=\"cat /boot/help.msg\"" >> ${scfg}
298                 echo -e "label=\"help\"" >> ${scfg}
299                 ;;
300         ia64)
301                 # NO SOFTLEVEL SUPPORT YET
302                 
303                 iacfg=$1/boot/elilo.conf
304                 echo 'prompt' > ${iacfg}
305                 echo 'message=/efi/boot/elilo.msg' >> ${iacfg}
306                 echo 'chooser=simple' >> ${iacfg}
307                 echo 'timeout=50' >> ${iacfg}
308                 echo 'relocatable' >> ${iacfg}
309                 echo >> ${iacfg}
310                 for x in ${clst_boot_kernel}
311                 do
312                         echo "image=/efi/boot/${x}" >> ${iacfg}
313                         echo "  label=${x}" >> ${iacfg}
314                         echo '  append="'initrd=${x}.igz ${default_append_line}'"' >> ${iacfg}
315                         echo "  initrd=/efi/boot/${x}.igz" >> ${iacfg}
316                         echo >> ${iacfg}
317                         echo "image=/efi/boot/${x}" >> ${iacfg}
318                         echo "  label=${x}-serial">> ${iacfg}
319                         echo '  append="'initrd=${x}.igz ${default_append_line}' console=tty0 console=ttyS0,9600"' >> ${iacfg}
320                         echo "  initrd=/efi/boot/${x}.igz" >> ${iacfg}
321                         echo >> ${iacfg}
322                         echo "image=/efi/boot/${x}" >> ${iacfg}
323                         echo "  label=${x}-sgi">> ${iacfg}
324                         echo '  append="'initrd=${x}.igz ${default_append_line}' console=tty0 console=ttySG0,115200"' >> ${iacfg}
325                         echo "  initrd=/efi/boot/${x}.igz" >> ${iacfg}
326                         echo >> ${iacfg}
327                         mv $1/boot/${x}{,.igz} $1/boot/efi/boot
328                 done
329                 cp ${iacfg} $1/boot/efi/boot
330                 ;;
331         x86|amd64)
332                 if [ -e $1/isolinux/isolinux.bin ]
333                 then
334                         mv $1/boot/* $1/isolinux
335                         rmdir $1/boot
336                         # the rest of this function sets up the config file for isolinux
337                         icfg=$1/isolinux/isolinux.cfg
338                         kmsg=$1/isolinux/kernels.msg
339                         echo "default ${first}" > ${icfg}
340                         echo "timeout 150" >> ${icfg}
341                         echo "prompt 1" >> ${icfg}
342                         echo "display boot.msg" >> ${icfg}
343                         echo "F1 kernels.msg" >> ${icfg}
344                         echo "F2 F2.msg" >> ${icfg}
345                         echo "F3 F3.msg" >> ${icfg}
346                         echo "F4 F4.msg" >> ${icfg}
347                         echo "F5 F5.msg" >> ${icfg}
348                         echo "F6 F6.msg" >> ${icfg}
349                         echo "F7 F7.msg" >> ${icfg}
350
351                         echo "Available kernels:" > ${kmsg}
352                         for i in 2 3 4 5 6 7
353                         do
354                                 cp ${clst_sharedir}/livecd/files/x86-F$i.msg \
355                                         $1/isolinux/F$i.msg
356                         done
357
358                         for x in ${clst_boot_kernel}
359                         do
360                                 eval custom_kopts=\$${x}_kernelopts
361                                 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
362                                 echo >> ${icfg}
363                                 
364                                 eval "clst_kernel_softlevel=\$clst_boot_kernel_${x}_softlevel"
365
366                                 if [ -n "${clst_kernel_softlevel}" ]
367                                 then
368                                         for y in ${clst_kernel_softlevel}
369                                         do
370                                                 echo "label ${x}-${y}" >> ${icfg}
371                                                 echo "  kernel ${x}" >> ${icfg}
372                                                 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
373                                                 then
374                                                         echo "  append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791 splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet" >> ${icfg}
375                                                 elif [ "${clst_livecd_splash_type}" == "bootplash" -a -n "${clst_livecd_splash_theme}" ]
376                                                         echo "  append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791 splash=silent" >> ${icfg}
377                                                 else
378                                                         echo "  append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791" >> ${icfg}
379                                                 fi
380
381                                                 echo >> ${icfg}
382                                                 echo "   ${x}" >> ${kmsg}
383                                                 echo "label ${x}-${y}-nofb" >> ${icfg}
384                                                 echo "  kernel ${x}" >> ${icfg}
385                                                 echo "  append ${default_append_line} softlevel=${y} initrd=${x}.igz" >> ${icfg}
386                                                 echo >> ${icfg}
387                                                 echo "   ${x}-nofb" >> ${kmsg}
388                                         done
389                                 else
390                                         echo "label ${x}" >> ${icfg}
391                                         echo "  kernel ${x}" >> ${icfg}
392                                         if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
393                                         then
394                                                 echo "  append ${default_append_line} initrd=${x}.igz vga=791 splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet" >> ${icfg}
395                                         elif [ "${clst_livecd_splash_type}" == "bootplash" -a -n "${clst_livecd_splash_theme}" ]
396                                                 echo "  append ${default_append_line} initrd=${x}.igz vga=791 splash=silent" >> ${icfg}
397                                         else
398                                                 echo "  append ${default_append_line} initrd=${x}.igz vga=791" >> ${icfg}
399                                         fi
400                                         echo >> ${icfg}
401                                         echo "   ${x}" >> ${kmsg}
402                                         echo "label ${x}-nofb" >> ${icfg}
403                                         echo "  kernel ${x}" >> ${icfg}
404                                         echo "  append ${default_append_line} initrd=${x}.igz" >> ${icfg}
405                                         echo >> ${icfg}
406                                         echo "   ${x}-nofb" >> ${kmsg}
407                                 fi
408                         done
409
410                         if [ -f $1/isolinux/memtest86 ]
411                         then
412                                 echo >> $icfg
413                                 echo "   memtest86" >> $kmsg
414                                 echo "label memtest86" >> $icfg
415                                 echo "  kernel memtest86" >> $icfg
416                         fi
417                 fi
418
419                 if [ -e $1/boot/efi/elilo.efi ]
420                 then
421                         iacfg=$1/boot/elilo.conf
422                         echo 'prompt' > ${iacfg}
423                         echo 'message=/efi/boot/elilo.msg' >> ${iacfg}
424                         echo 'chooser=simple' >> ${iacfg}
425                         echo 'timeout=50' >> ${iacfg}
426                         echo >> ${iacfg}
427                         for x in ${clst_boot_kernel}
428                         do
429                                 echo "image=/efi/boot/${x}" >> ${iacfg}
430                                 echo "  label=${x}" >> ${iacfg}
431                                 echo '  append="'initrd=${x}.igz ${default_append_line}'"' >> ${iacfg}
432                                 echo "  initrd=/efi/boot/${x}.igz" >> ${iacfg}
433                                 echo >> ${iacfg}
434                                 echo "image=/efi/boot/${x}" >> ${iacfg}
435                                 echo >> ${iacfg}
436                                 cp -f $1/boot/${x}{,.igz} $1/boot/efi/boot > /dev/null
437                                 cp -f $1/isolinux/${x}{,.igz} $1/boot/efi/boot > /dev/null
438                         done
439                         cp ${iacfg} $1/boot/efi/boot
440                 fi
441
442                 if [ -e $1/boot/grub/stage2_eltorito ]
443                 then
444                         icfg=$1/boot/grub/grub.conf
445                         echo "default 1" > ${icfg}
446                         echo "timeout 150" >> ${icfg}
447
448                         # Setup help message
449                         echo >> ${icfg}
450                         echo "title help" >> ${icfg}
451                         cp ${clst_sharedir}/livecd/files/README.txt \
452                                 $1/boot/help.msg
453                         echo "cat /boot/help.msg" >> ${icfg}
454
455                         for x in ${clst_boot_kernel}
456                         do
457                                 eval custom_kopts=\$${x}_kernelopts
458                                 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
459                                 echo >> ${icfg}
460                                 
461                                 eval "clst_kernel_softlevel=\$clst_boot_kernel_${x}_softlevel"
462                                 
463                                 if [ -n "${clst_kernel_softlevel}" ]
464                                 then
465                                         for y in ${clst_kernel_softlevel}
466                                         do
467                                                 echo "title ${x}-${y}" >> ${icfg}
468                                                 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
469                                                 then
470                                                         echo "kernel /boot/${x} softlevel=${y} ${default_append_line} vga=791 splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet" >> ${icfg}
471                                                 elif [ "${clst_livecd_splash_type}" == "bootplash" -a -n "${clst_livecd_splash_theme}" ]
472                                                         echo "  append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791 splash=silent" >> ${icfg}
473                                                 else
474                                                         echo "  append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791" >> ${icfg}
475                                                 fi                                              else
476                                                 if [ -e $1/boot/${x}.igz ]
477                                                 then
478                                                         echo "initrd /boot/${x}.igz" >> ${icfg}
479                                                 fi
480                                                 echo >> ${icfg}
481                                                 echo "title ${x}-${y} [ No FrameBuffer ]" >> ${icfg}
482                                                 echo "kernel ${x} /boot/${x} softlevel=${y} ${default_append_line}" >> ${icfg}
483                                                 if [ -e $1/boot/${x}.igz ]
484                                                 then
485                                                         echo "initrd /boot/${x}.igz" >> ${icfg}
486                                                 fi
487                                                 echo >> ${icfg}
488                                         done
489                                 else
490                                         echo "title ${x}" >> ${icfg}
491                                         if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
492                                         then
493                                                 echo "kernel /boot/${x} ${default_append_line} vga=791 splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet" >> ${icfg}
494                                         elif [ "${clst_livecd_splash_type}" == "bootplash" -a -n "${clst_livecd_splash_theme}" ]
495                                                 echo "kernel /boot/${x} ${default_append_line} vga=791 splash=silent" >> ${icfg}
496                                         else
497                                                 echo "kernel /boot/${x} ${default_append_line} vga=791" >> ${icfg}
498                                         fi
499                                         if [ -e $1/boot/${x}.igz ]
500                                         then
501                                                 echo "initrd /boot/${x}.igz" >> ${icfg}
502                                         fi
503                                         echo >> ${icfg}
504                                         echo "title ${x} [ No FrameBuffer ]" >> ${icfg}
505                                         echo "kernel ${x} /boot/${x} ${default_append_line}" >> ${icfg}
506                                         if [ -e $1/boot/${x}.igz ]
507                                         then
508                                                 echo "initrd /boot/${x}.igz" >> ${icfg}
509                                         fi
510                                 fi
511
512                         done
513
514                         if [ -f $1/boot/memtest86 ]
515                         then
516                                 echo >> ${icfg}
517                                 echo "title memtest86" >> ${icfg}
518                                 echo "kernel /boot/memtest86" >> ${icfg}
519                         fi
520                 fi
521                 ;;
522         mips)
523
524                 # NO SOFTLEVEL SUPPORT YET
525
526
527                 # Mips is an interesting arch -- where most archs will
528                 # use ${1} as the root of the LiveCD, an SGI LiveCD lacks
529                 # such a root.  Instead, we will use ${1} as a scratch
530                 # directory to build the components we need for the
531                 # CD image, and then pass these components to the
532                 # `sgibootcd` tool which outputs a final CD image
533                 scratch="${1}"
534                 mkdir ${scratch}/kernels
535                 mkdir ${scratch}/kernels/misc
536                 mkdir ${scratch}/arcload
537                 echo "" > ${scratch}/arc.cf
538
539                 # Move kernel binaries to ${scratch}/kernels, and
540                 # move everything else to ${scratch}/kernels/misc
541                 for x in ${clst_boot_kernel}; do
542                         mv ${1}/boot/${x} ${scratch}/kernels
543                         mv ${1}/boot/${x}.igz ${scratch}/kernels/misc
544                 done
545                 rmdir ${1}/boot
546
547                 # Source the bashified arcload config
548                 source ${clst_sharedir}/targets/support/mips-arcload_conf.sh
549
550                 # Generate top portions of the config
551                 echo -e "${topofconfig}${serial}${dbg}${cmt1}" >> ${scratch}/arc.cf
552
553                 # Next, figure out what kernels were specified in the
554                 # spec file, and generate the appropriate arcload conf
555                 # blocks specific to each system
556                 ip22="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip22" | tr "\n" " ")"
557                 ip27="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip27" | tr "\n" " ")"
558                 ip28="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip28" | tr "\n" " ")"
559                 ip30="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip30" | tr "\n" " ")"
560                 ip32="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip32" | tr "\n" " ")"
561
562                 if [ -n "${ip22}" ]; then
563                         echo -e "${ip22base}" >> ${scratch}/arc.cf
564                         for x in ${ip22}; do echo -e "${!x}" >> ${scratch}/arc.cf; done
565                         echo -e "${ip22vid}${ip22x}" >> ${scratch}/arc.cf
566                 fi
567
568                 [ -n "${ip27}" ] && echo -e "${ip27base}" >> ${scratch}/arc.cf
569                 [ -n "${ip28}" ] && echo -e "${ip28base}" >> ${scratch}/arc.cf
570                 [ -n "${ip30}" ] && echo -e "${ip30base}" >> ${scratch}/arc.cf
571
572                 if [ -n "${ip32}" ]; then
573                         echo -e "${ip32base}" >> ${scratch}/arc.cf
574                         for x in ${ip32}; do echo -e "${!x}" >> ${scratch}/arc.cf; done
575                         echo -e "${ip32vid}${ip32x}" >> ${scratch}/arc.cf
576                 fi
577
578                 # Finish off the config
579                 echo -e "${cmt2}" >> ${scratch}/arc.cf
580
581                 # Move the bootloader binaries & config to their destination
582                 mv ${1}/sashARCS ${1}/sash64 ${1}/arc.cf ${scratch}/arcload
583                 ;;
584 esac
585 exit $?