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