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