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