Add 'pager on' to grub.conf for bug 208531
[catalyst.git] / targets / support / bootloader-setup.sh
1 #!/bin/bash
2 . ${clst_sharedir}/targets/support/functions.sh
3 . ${clst_sharedir}/targets/support/filesystem-functions.sh
4
5 # $1 is the destination root
6
7 extract_cdtar $1
8 extract_kernels $1/boot
9 check_dev_manager
10 check_bootargs
11 check_filesystem_type
12
13 default_append_line="root=/dev/ram0 init=/linuxrc ${cmdline_opts} ${custom_kopts} cdroot"
14
15 case ${clst_hostarch} in
16         alpha)
17                 # NO SOFTLEVEL SUPPORT YET
18                 acfg=$1/etc/aboot.conf
19                 bctr=0
20                 # Pass 1 is for non-serial
21                 for x in ${clst_boot_kernel}
22                 do
23                         echo -n "${bctr}:/boot/${x} " >> ${acfg}
24                         echo -n "initrd=/boot/${x}.igz root=/dev/ram0 " >> ${acfg}
25                         echo "init=/linuxrc ${cmdline_opts} cdroot" >> ${acfg}
26                         ((bctr=${bctr}+1))
27                 done
28                 # Pass 2 is for serial
29                 cmdline_opts="${cmdline_opts} console=ttyS0"
30                 for x in ${clst_boot_kernel}
31                 do
32                         echo -n "${bctr}:/boot/${x} " >> ${acfg}
33                         echo -n "initrd=/boot/${x}.igz root=/dev/ram0 " >> ${acfg}
34                         echo "init=/linuxrc ${cmdline_opts} cdroot" >> ${acfg}
35                         ((bctr=${bctr}+1))
36                 done
37                 ;;
38         arm)
39                 # NO SOFTLEVEL SUPPORT YET
40                 ;;
41         hppa)
42                 # NO SOFTLEVEL SUPPORT YET
43                 icfg=$1/boot/palo.conf
44                 kmsg=$1/boot/kernels.msg
45                 hmsg=$1/boot/help.msg
46                 echo "--commandline=0/${first} initrd=${first}.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts}" >> ${icfg}
47                 echo "--bootloader=boot/iplboot" >> ${icfg}
48                 echo "--ramdisk=boot/${first}.igz" >> ${icfg}
49                 ;;
50         ppc)
51                 # NO SOFTLEVEL SUPPORT YET
52                 
53                 # PPC requirements: 
54                 # -----------------
55                 # The specs indicate the kernels to be build. We need to put
56                 # those kernels and the corresponding initrd.img.gz(s) in the
57                 # /boot directory. This directory contains a message boot.msg 
58                 # containing some info to be displayed on boot, a configuration
59                 # (yaboot.conf) specifying the boot options (kernel/initrd 
60                 # combinations). The boot directory also contains a file called
61                 # yaboot, which normally gets copied from the live environment.
62                 # For now we supply a prebuilt file, prebuilt configuration 
63                 # and prebuilt boot message. This can be enhanced later on
64                 # but the following suffices for now:
65
66                 # this sets up the config file for yaboot
67
68
69                 # ADD RUNLEVEL SUPPORT ???
70
71                 icfg=$1/boot/yaboot.conf
72                 kmsg=$1/boot/boot.msg
73
74                 echo "default ${first}" > ${icfg}
75                 echo "timeout 300" >> ${icfg}
76                 echo "device=cd:" >> ${icfg}
77                 echo "root=/dev/ram" >> ${icfg}
78                 echo "fgcolor=white" >> ${icfg}
79                 echo "bgcolor=black" >> ${icfg}
80                 echo "message=/boot/boot.msg" >> ${icfg}
81
82                 # Here is where I fix up the boot.msg file.
83                 sed -e 's/ARCH/PPC/' \
84                         -e 's/HARDWARE/32-bit Apple and Pegasos hardware/' \
85                         -i $kmsg
86
87                 # Here we wipe out the /ppc directory, if it exists.
88                 rm -rf $1/ppc
89
90                 for x in ${clst_boot_kernel}
91                 do      
92                         eval custom_kopts=\$${x}_kernelopts
93                         echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
94                         echo "image=/boot/${x}" >> ${icfg}
95
96                         if [ -e "$1/boot/${x}.igz" ]
97                         then
98                                 echo "initrd=/boot/${x}.igz" >> ${icfg}
99                         fi
100
101                         echo "label=${x}" >> ${icfg}
102                         echo "read-write" >> ${icfg}
103                         if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
104                         then
105                                 echo "append=\"${default_append_line} splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet\"" >> ${icfg}
106                         else
107                                 echo "append=\"${default_append_line}\"" >> ${icfg}
108                         fi
109                 done
110         ;;
111         
112         ppc64)
113                 # NO SOFTLEVEL SUPPORT YET
114                 
115                 # PPC requirements: 
116                 # -----------------
117                 # The specs indicate the kernels to be build. We need to put
118                 # those kernels and the corresponding initrd.img.gz(s) in the
119                 # /boot directory. This directory contains a message boot.msg 
120                 # containing some info to be displayed on boot, a configuration
121                 # (yaboot.conf) specifying the boot options (kernel/initrd 
122                 # combinations). The boot directory also contains a file called
123                 # yaboot, which normally gets copied from the live environment.
124                 # For now we supply a prebuilt file, prebuilt configuration 
125                 # and prebuilt boot message. This can be enhanced later on
126                 # but the following suffices for now:
127
128                 # this sets up the config file for yaboot
129
130
131                 # ADD RUNLEVEL SUPPORT ???
132
133                 icfg=$1/boot/yaboot.conf
134                 kmsg=$1/boot/boot.msg
135
136                 echo "device=cd:" >> ${icfg}
137                 echo "root=/dev/ram" >> ${icfg}
138                 echo "fgcolor=white" >> ${icfg}
139                 echo "bgcolor=black" >> ${icfg}
140                 echo "message=/boot/boot.msg" >> ${icfg}
141                 
142                 # Here is where I fix up the boot.msg file.
143                 sed -e 's/ARCH/PPC/' \
144                         -e 's/HARDWARE/64-bit Apple and IBM hardware/' \
145                         -i $kmsg
146
147                 # Setup the IBM yaboot.conf     
148                 etc_icfg=$1/etc/yaboot.conf
149                 mkdir -p $1/etc 
150                 IBM_YABOOT="FALSE"
151                 echo "root=/dev/ram" >> ${etc_icfg}
152                 echo "fgcolor=white" >> ${etc_icfg}
153                 echo "bgcolor=black" >> ${etc_icfg}
154                 echo "message=/boot/boot.msg" >> ${etc_icfg}
155                 
156                 for x in ${clst_boot_kernel}
157                 do      
158                         eval "clst_kernel_console=\$clst_boot_kernel_${x}_console"
159                         eval "clst_kernel_machine_type=\$clst_boot_kernel_${x}_machine_type"
160                         eval custom_kopts=\$${x}_kernelopts
161                                 
162                         echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
163                         if [ "${clst_kernel_machine_type}" == "ibm" ]
164                         then
165                                 IBM_YABOOT="true"
166                                 if [ -n "${clst_kernel_console}" ]
167                                 then
168                                         echo >> ${etc_icfg}
169                                         echo "image=/boot/${x}" >> ${etc_icfg}
170
171                                         if [ -e "$1/boot/${x}.igz" ]
172                                         then
173                                                 echo "initrd=/boot/${x}.igz" >> ${etc_icfg}
174                                         fi
175
176                                         echo "label=${x}" >> ${etc_icfg}
177                                         echo "read-write" >> ${icfg}
178                                         if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
179                                         then
180                                                 echo "append=\"${default_append_line} splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet\"" >> ${etc_icfg}
181                                         else
182                                                 echo "append=\"${default_append_line}\"" >> ${etc_icfg}
183                                         fi
184
185                                         for y in ${clst_kernel_console}
186                                         do
187                                                 echo ${y}
188                                                 echo >> ${etc_icfg}
189                                                 echo "image=/boot/${x}" >> ${etc_icfg}
190
191                                                 if [ -e "$1/boot/${x}.igz" ]
192                                                 then
193                                                         echo "initrd=/boot/${x}.igz" >> ${etc_icfg}
194                                                 fi
195
196                                                 echo "label=${x}-${y} " >> ${etc_icfg}
197                                                 echo "read-write" >> ${icfg}
198                                                 echo "append=\"${default_append_line} console=${y}\"" >> ${etc_icfg}
199                                         done
200                                 else
201                                         echo >> ${etc_icfg}
202                                         echo "image=/boot/${x}" >> ${etc_icfg}
203
204                                         if [ -e "$1/boot/${x}.igz" ]
205                                         then
206                                                 echo "initrd=/boot/${x}.igz" >> ${etc_icfg}
207                                         fi
208
209                                         echo "label=${x}" >> ${etc_icfg}
210                                         echo "read-write" >> ${etc_icfg}
211                                         if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
212                                         then
213                                                 echo "append=\"${default_append_line} splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet\"" >> ${etc_icfg}
214                                         else
215                                                 echo "append=\"${default_append_line}\"" >> ${etc_icfg}
216                                         fi
217                                 fi
218                         else
219                                 if [ -n "${clst_kernel_console}" ]
220                                 then
221                                         echo >> ${icfg}
222                                         echo "image=/boot/${x}" >> ${icfg}
223
224                                         if [ -e "$1/boot/${x}.igz" ]
225                                         then
226                                                 echo "initrd=/boot/${x}.igz" >> ${icfg}
227                                         fi
228
229                                         echo "label=${x}" >> ${icfg}
230                                         echo "read-write" >> ${icfg}
231                                         if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
232                                         then
233                                                 echo "append=\"${default_append_line} splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet\"" >> ${icfg}
234                                         else
235                                                 echo "append=\"${default_append_line}\"" >> ${icfg}
236                                         fi
237                                         
238                                         for y in ${clst_kernel_console}
239                                         do
240                                                 echo >> ${icfg}
241                                                 echo "image=/boot/${x}" >> ${icfg}
242
243                                                 if [ -e "$1/boot/${x}.igz" ]
244                                                 then
245                                                         echo "initrd=/boot/${x}.igz" >> ${icfg}
246                                                 fi
247
248                                                 echo "label=${x}-${y} " >> ${icfg}
249                                                 echo "read-write" >> ${icfg}
250                                                 echo "append=\"${default_append_line} console=${y}\"" >> ${icfg}
251                                         done
252                                 else
253                                         echo >> ${icfg}
254                                         echo "image=/boot/${x}" >> ${icfg}
255
256                                         if [ -e "$1/boot/${x}.igz" ]
257                                         then
258                                                 echo "initrd=/boot/${x}.igz" >> ${icfg}
259                                         fi
260
261                                         echo "label=${x}" >> ${icfg}
262                                         echo "read-write" >> ${icfg}
263                                         if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
264                                         then
265                                                 echo "append=\"${default_append_line} splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet\"" >> ${icfg}
266                                         else
267                                                 echo "append=\"${default_append_line}\"" >> ${icfg}
268                                         fi
269                                 fi
270                         fi
271                 done
272
273                 if [ "${IBM_YABOOT}" == "FALSE" ]
274                 then 
275                         rm ${etc_kmsg}
276                         rmdir $1/etc
277                         if [ -d $1/ppc ]
278                         then
279                                 rm -r $1/ppc
280                         fi
281                 fi
282
283                 ;;
284         sparc*)
285                 # NO SOFTLEVEL SUPPORT YET
286                 
287                 scfg=$1/boot/silo.conf
288                 echo "default=\"help\"" > ${scfg}
289                 echo "message=\"/boot/boot.msg\"" >> ${scfg}
290
291                 for x in ${clst_boot_kernel}
292                 do
293                         echo >> ${icfg}
294                         echo "image=\"/boot/${x}\"" >> ${scfg}
295                         echo -e "\tlabel=\"${x}\"" >> ${scfg}
296                         echo -e "\tappend=\"initrd=/boot/${x}.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts} cdroot\"" >> ${scfg}
297
298                 done
299
300                 echo "image=\"cat /boot/silo.conf\"" >> ${scfg}
301                 echo -e "label=\"config\"" >> ${scfg}
302                 echo "image=\"cat /boot/video.msg\"" >> ${scfg}
303                 echo -e "label=\"video\"" >> ${scfg}
304                 echo "image=\"cat /boot/help.msg\"" >> ${scfg}
305                 echo -e "label=\"help\"" >> ${scfg}
306                 echo "image=\"cat /boot/parameters.msg\"" >> ${scfg}
307                 echo -e "label=\"parameters\"" >> ${scfg}
308                 ;;
309         ia64)
310                 # NO SOFTLEVEL SUPPORT YET
311                 
312                 iacfg=$1/boot/elilo.conf
313                 echo 'prompt' > ${iacfg}
314                 echo 'message=/efi/boot/elilo.msg' >> ${iacfg}
315                 echo 'chooser=simple' >> ${iacfg}
316                 echo 'timeout=50' >> ${iacfg}
317                 echo 'relocatable' >> ${iacfg}
318                 echo >> ${iacfg}
319                 for x in ${clst_boot_kernel}
320                 do
321                         echo "image=/efi/boot/${x}" >> ${iacfg}
322                         echo "  label=${x}" >> ${iacfg}
323                         echo '  append="'initrd=${x}.igz ${default_append_line}'"' >> ${iacfg}
324                         echo "  initrd=/efi/boot/${x}.igz" >> ${iacfg}
325                         echo >> ${iacfg}
326                         echo "image=/efi/boot/${x}" >> ${iacfg}
327                         echo "  label=${x}-serial">> ${iacfg}
328                         echo '  append="'initrd=${x}.igz ${default_append_line}' console=tty0 console=ttyS0,9600"' >> ${iacfg}
329                         echo "  initrd=/efi/boot/${x}.igz" >> ${iacfg}
330                         echo >> ${iacfg}
331                         echo "image=/efi/boot/${x}" >> ${iacfg}
332                         echo "  label=${x}-sgi">> ${iacfg}
333                         echo '  append="'initrd=${x}.igz ${default_append_line}' console=tty0 console=ttySG0,115200"' >> ${iacfg}
334                         echo "  initrd=/efi/boot/${x}.igz" >> ${iacfg}
335                         echo >> ${iacfg}
336                         mv $1/boot/${x}{,.igz} $1/boot/efi/boot
337                 done
338                 cp ${iacfg} $1/boot/efi/boot
339                 ;;
340         x86|amd64)
341                 if [ -e $1/isolinux/isolinux.bin ]
342                 then
343                         cp -f $1/boot/* $1/isolinux
344                         # the rest of this function sets up the config file for isolinux
345                         icfg=$1/isolinux/isolinux.cfg
346                         kmsg=$1/isolinux/kernels.msg
347                         echo "default ${first}" > ${icfg}
348                         echo "timeout 150" >> ${icfg}
349                         echo "prompt 1" >> ${icfg}
350                         echo "display boot.msg" >> ${icfg}
351                         echo "F1 kernels.msg" >> ${icfg}
352                         echo "F2 F2.msg" >> ${icfg}
353                         echo "F3 F3.msg" >> ${icfg}
354                         echo "F4 F4.msg" >> ${icfg}
355                         echo "F5 F5.msg" >> ${icfg}
356                         echo "F6 F6.msg" >> ${icfg}
357                         echo "F7 F7.msg" >> ${icfg}
358
359                         echo "Available kernels:" > ${kmsg}
360                         for i in 2 3 4 5 6 7
361                         do
362                                 cp ${clst_sharedir}/livecd/files/x86-F$i.msg \
363                                         $1/isolinux/F$i.msg
364                         done
365
366                         for x in ${clst_boot_kernel}
367                         do
368                                 eval custom_kopts=\$${x}_kernelopts
369                                 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
370                                 echo >> ${icfg}
371                                 
372                                 eval "clst_kernel_softlevel=\$clst_boot_kernel_${x}_softlevel"
373
374                                 if [ -n "${clst_kernel_softlevel}" ]
375                                 then
376                                         for y in ${clst_kernel_softlevel}
377                                         do
378                                                 echo "label ${x}-${y}" >> ${icfg}
379                                                 echo "  kernel ${x}" >> ${icfg}
380                                                 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
381                                                 then
382                                                         echo "  append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791 splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet" >> ${icfg}
383                                                 elif [ "${clst_livecd_splash_type}" == "bootplash" -a -n "${clst_livecd_splash_theme}" ]
384                                                 then
385                                                         echo "  append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791 splash=silent" >> ${icfg}
386                                                 else
387                                                         echo "  append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791" >> ${icfg}
388                                                 fi
389
390                                                 echo >> ${icfg}
391                                                 echo "   ${x}" >> ${kmsg}
392                                                 echo "label ${x}-${y}-nofb" >> ${icfg}
393                                                 echo "  kernel ${x}" >> ${icfg}
394                                                 echo "  append ${default_append_line} softlevel=${y} initrd=${x}.igz" >> ${icfg}
395                                                 echo >> ${icfg}
396                                                 echo "   ${x}-nofb" >> ${kmsg}
397                                         done
398                                 else
399                                         echo "label ${x}" >> ${icfg}
400                                         echo "  kernel ${x}" >> ${icfg}
401                                         if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
402                                         then
403                                                 echo "  append ${default_append_line} initrd=${x}.igz vga=791 splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet" >> ${icfg}
404                                         elif [ "${clst_livecd_splash_type}" == "bootplash" -a -n "${clst_livecd_splash_theme}" ]
405                                         then
406                                                 echo "  append ${default_append_line} initrd=${x}.igz vga=791 splash=silent" >> ${icfg}
407                                         else
408                                                 echo "  append ${default_append_line} initrd=${x}.igz vga=791" >> ${icfg}
409                                         fi
410                                         echo >> ${icfg}
411                                         echo "   ${x}" >> ${kmsg}
412                                         echo "label ${x}-nofb" >> ${icfg}
413                                         echo "  kernel ${x}" >> ${icfg}
414                                         echo "  append ${default_append_line} initrd=${x}.igz" >> ${icfg}
415                                         echo >> ${icfg}
416                                         echo "   ${x}-nofb" >> ${kmsg}
417                                 fi
418                         done
419
420                         if [ -f $1/isolinux/memtest86 ]
421                         then
422                                 echo >> $icfg
423                                 echo "   memtest86" >> $kmsg
424                                 echo "label memtest86" >> $icfg
425                                 echo "  kernel memtest86" >> $icfg
426                         fi
427                 fi
428
429                 if [ -e $1/boot/efi/elilo.efi ]
430                 then
431                         [ -e $1/isolinux/elilo.efi ] && rm -f $1/isolinux/elilo.efi
432                         iacfg=$1/boot/elilo.conf
433                         echo 'prompt' > ${iacfg}
434                         echo 'message=/efi/boot/elilo.msg' >> ${iacfg}
435                         echo 'chooser=simple' >> ${iacfg}
436                         echo 'timeout=50' >> ${iacfg}
437                         echo >> ${iacfg}
438                         for x in ${clst_boot_kernel}
439                         do
440                                 echo "image=/efi/boot/${x}" >> ${iacfg}
441                                 echo "  label=${x}" >> ${iacfg}
442                                 echo '  append="'initrd=${x}.igz ${default_append_line}'"' >> ${iacfg}
443                                 echo "  initrd=/efi/boot/${x}.igz" >> ${iacfg}
444                                 echo >> ${iacfg}
445                                 echo "image=/efi/boot/${x}" >> ${iacfg}
446                                 echo >> ${iacfg}
447                                 cp -f $1/boot/${x}{,.igz} $1/boot/efi/boot > /dev/null
448                                 cp -f $1/isolinux/${x}{,.igz} $1/boot/efi/boot > /dev/null
449                         done
450                         cp ${iacfg} $1/boot/efi/boot
451                 fi
452
453                 if [ -e $1/boot/grub/stage2_eltorito ]
454                 then
455                         icfg=$1/boot/grub/grub.conf
456                         echo "default 1" > ${icfg}
457                         echo "timeout 150" >> ${icfg}
458                         echo "pager on" >> ${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 /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 /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                 [ ! -d "${scratch}/kernels" ] && mkdir ${scratch}/kernels
549                 [ ! -d "${scratch}/kernels/misc" ] && mkdir ${scratch}/kernels/misc
550                 [ ! -d "${scratch}/arcload" ] && 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                         [ -e "${1}/boot/${x}" ] && mv ${1}/boot/${x} ${scratch}/kernels
557                         [ -e "${1}/boot/${x}.igz" ] && mv ${1}/boot/${x}.igz ${scratch}/kernels/misc
558                 done
559                 [ -d "${1}/boot" ] && rmdir ${1}/boot
560
561                 # Source the arcload source file to generated required sections of arc.cf
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                 [ -e "${1}/sashARCS" ] && mv ${1}/sashARCS ${scratch}/arcload
597                 [ -e "${1}/sash64" ] && mv ${1}/sash64 ${scratch}/arcload
598                 [ -e "${1}/arc.cf" ] && mv ${1}/arc.cf ${scratch}/arcload
599                 ;;
600 esac
601 exit $?